Updated FFMPEG, and enabled some new formats, including Atrac3+
This commit is contained in:
parent
895cb7440f
commit
24a3573503
151 changed files with 13040 additions and 3985 deletions
|
@ -222,7 +222,6 @@
|
||||||
830F0D4917FC85ED00042E8F /* intmath.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D4517FC85ED00042E8F /* intmath.h */; };
|
830F0D4917FC85ED00042E8F /* intmath.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D4517FC85ED00042E8F /* intmath.h */; };
|
||||||
830F0D4D17FC862400042E8F /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4A17FC862300042E8F /* time.c */; };
|
830F0D4D17FC862400042E8F /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4A17FC862300042E8F /* time.c */; };
|
||||||
830F0D4F17FC862400042E8F /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4C17FC862400042E8F /* utils.c */; };
|
830F0D4F17FC862400042E8F /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4C17FC862400042E8F /* utils.c */; };
|
||||||
830F0D5117FC880E00042E8F /* time_.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D5017FC880E00042E8F /* time_.h */; };
|
|
||||||
830F0D5317FC891800042E8F /* file_open.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5217FC891800042E8F /* file_open.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 */; };
|
830F0D5817FC893E00042E8F /* bitstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5417FC893E00042E8F /* bitstream.c */; };
|
||||||
830F0D5917FC893E00042E8F /* codec_desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5517FC893E00042E8F /* codec_desc.c */; };
|
830F0D5917FC893E00042E8F /* codec_desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5517FC893E00042E8F /* codec_desc.c */; };
|
||||||
|
@ -278,6 +277,22 @@
|
||||||
830F0DD117FC934D00042E8F /* spdif.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DCF17FC934D00042E8F /* spdif.c */; };
|
830F0DD117FC934D00042E8F /* spdif.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DCF17FC934D00042E8F /* spdif.c */; };
|
||||||
830F0DD217FC934D00042E8F /* spdif.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DD017FC934D00042E8F /* spdif.h */; };
|
830F0DD217FC934D00042E8F /* spdif.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DD017FC934D00042E8F /* spdif.h */; };
|
||||||
830F0DD617FC93E400042E8F /* xwma.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DD417FC93E400042E8F /* xwma.c */; };
|
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 */; };
|
833C3795180328A300CBA602 /* takdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3794180328A300CBA602 /* takdec.c */; };
|
||||||
833C379A180328B300CBA602 /* tak_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3796180328B300CBA602 /* tak_parser.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 */; };
|
833C379B180328B300CBA602 /* tak.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3797180328B300CBA602 /* tak.c */; };
|
||||||
|
@ -401,8 +416,6 @@
|
||||||
838491021807CDC000E7332D /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491001807CDC000E7332D /* lpc.c */; };
|
838491021807CDC000E7332D /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491001807CDC000E7332D /* lpc.c */; };
|
||||||
838491031807CDC000E7332D /* lpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491011807CDC000E7332D /* lpc.h */; };
|
838491031807CDC000E7332D /* lpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491011807CDC000E7332D /* lpc.h */; };
|
||||||
838491051807CDEC00E7332D /* cbrt_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491041807CDEC00E7332D /* cbrt_tablegen.h */; };
|
838491051807CDEC00E7332D /* cbrt_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491041807CDEC00E7332D /* cbrt_tablegen.h */; };
|
||||||
838491081807CDF400E7332D /* lls.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491061807CDF400E7332D /* lls.c */; };
|
|
||||||
838491091807CDF400E7332D /* lls.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491071807CDF400E7332D /* lls.h */; };
|
|
||||||
8384910B1807CE2A00E7332D /* lls_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910A1807CE2A00E7332D /* lls_init.c */; };
|
8384910B1807CE2A00E7332D /* lls_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910A1807CE2A00E7332D /* lls_init.c */; };
|
||||||
8384910D1807CEB600E7332D /* sbrdsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910C1807CEB600E7332D /* sbrdsp.c */; };
|
8384910D1807CEB600E7332D /* sbrdsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910C1807CEB600E7332D /* sbrdsp.c */; };
|
||||||
8384910F1807CEC400E7332D /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910E1807CEC400E7332D /* lpc.c */; };
|
8384910F1807CEC400E7332D /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910E1807CEC400E7332D /* lpc.c */; };
|
||||||
|
@ -430,7 +443,6 @@
|
||||||
8393B80518052BC200913C76 /* mpegaudiodsp_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */; };
|
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 */; };
|
8393B80718052BC200913C76 /* mpegaudiodsp_float.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */; };
|
||||||
8393B80A18052BC200913C76 /* mpegaudiodsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F618052BC200913C76 /* mpegaudiodsp.h */; };
|
8393B80A18052BC200913C76 /* mpegaudiodsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F618052BC200913C76 /* mpegaudiodsp.h */; };
|
||||||
8393B80B18052BC200913C76 /* mpegaudioenc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7F718052BC200913C76 /* mpegaudioenc.c */; };
|
|
||||||
8393B80C18052BC200913C76 /* mpegaudiotab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F818052BC200913C76 /* mpegaudiotab.h */; };
|
8393B80C18052BC200913C76 /* mpegaudiotab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F818052BC200913C76 /* mpegaudiotab.h */; };
|
||||||
8393B80E18052BD500913C76 /* mpegaudiodsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B80D18052BD500913C76 /* mpegaudiodsp.c */; };
|
8393B80E18052BD500913C76 /* mpegaudiodsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B80D18052BD500913C76 /* mpegaudiodsp.c */; };
|
||||||
8393B81118052DB700913C76 /* bitstream_filter.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B80F18052DB700913C76 /* bitstream_filter.c */; };
|
8393B81118052DB700913C76 /* bitstream_filter.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B80F18052DB700913C76 /* bitstream_filter.c */; };
|
||||||
|
@ -665,7 +677,6 @@
|
||||||
830F0D4517FC85ED00042E8F /* intmath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intmath.h; sourceTree = "<group>"; };
|
830F0D4517FC85ED00042E8F /* intmath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intmath.h; sourceTree = "<group>"; };
|
||||||
830F0D4A17FC862300042E8F /* time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = time.c; sourceTree = "<group>"; };
|
830F0D4A17FC862300042E8F /* time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = time.c; sourceTree = "<group>"; };
|
||||||
830F0D4C17FC862400042E8F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = "<group>"; };
|
830F0D4C17FC862400042E8F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = "<group>"; };
|
||||||
830F0D5017FC880E00042E8F /* time_.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time_.h; sourceTree = "<group>"; };
|
|
||||||
830F0D5217FC891800042E8F /* file_open.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = file_open.c; sourceTree = "<group>"; };
|
830F0D5217FC891800042E8F /* file_open.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = file_open.c; sourceTree = "<group>"; };
|
||||||
830F0D5417FC893E00042E8F /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = "<group>"; };
|
830F0D5417FC893E00042E8F /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = "<group>"; };
|
||||||
830F0D5517FC893E00042E8F /* codec_desc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = codec_desc.c; sourceTree = "<group>"; };
|
830F0D5517FC893E00042E8F /* codec_desc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = codec_desc.c; sourceTree = "<group>"; };
|
||||||
|
@ -721,6 +732,22 @@
|
||||||
830F0DCF17FC934D00042E8F /* spdif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spdif.c; sourceTree = "<group>"; };
|
830F0DCF17FC934D00042E8F /* spdif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spdif.c; sourceTree = "<group>"; };
|
||||||
830F0DD017FC934D00042E8F /* spdif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spdif.h; sourceTree = "<group>"; };
|
830F0DD017FC934D00042E8F /* spdif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spdif.h; sourceTree = "<group>"; };
|
||||||
830F0DD417FC93E400042E8F /* xwma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xwma.c; sourceTree = "<group>"; };
|
830F0DD417FC93E400042E8F /* xwma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xwma.c; sourceTree = "<group>"; };
|
||||||
|
832F4BA418CD4F47003E940E /* lls2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lls2.c; sourceTree = "<group>"; };
|
||||||
|
832F4BA518CD4F47003E940E /* lls2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lls2.h; sourceTree = "<group>"; };
|
||||||
|
832F4BA918CD4F6B003E940E /* atrac3plus_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atrac3plus_data.h; sourceTree = "<group>"; };
|
||||||
|
832F4BAA18CD4F6B003E940E /* atrac3plus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3plus.c; sourceTree = "<group>"; };
|
||||||
|
832F4BAB18CD4F6B003E940E /* atrac3plus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atrac3plus.h; sourceTree = "<group>"; };
|
||||||
|
832F4BAC18CD4F6B003E940E /* atrac3plusdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3plusdec.c; sourceTree = "<group>"; };
|
||||||
|
832F4BAD18CD4F6B003E940E /* atrac3plusdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3plusdsp.c; sourceTree = "<group>"; };
|
||||||
|
832F4BB418CD4FEA003E940E /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macros.h; sourceTree = "<group>"; };
|
||||||
|
832F4BB518CD4FEA003E940E /* timestamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timestamp.h; sourceTree = "<group>"; };
|
||||||
|
832F4BB818CD53E9003E940E /* ttadsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttadsp.c; sourceTree = "<group>"; };
|
||||||
|
832F4BB918CD53E9003E940E /* ttadsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttadsp.h; sourceTree = "<group>"; };
|
||||||
|
832F4BBE18CD5DD9003E940E /* downmix_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = downmix_info.c; sourceTree = "<group>"; };
|
||||||
|
832F4BBF18CD5DD9003E940E /* downmix_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = downmix_info.h; sourceTree = "<group>"; };
|
||||||
|
832F4BC218CD5DE2003E940E /* time_.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time_.h; sourceTree = "<group>"; };
|
||||||
|
832F4BC418CD601B003E940E /* ttadsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttadsp_init.c; sourceTree = "<group>"; };
|
||||||
|
832F4BC618CD6052003E940E /* dcadsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dcadsp_init.c; sourceTree = "<group>"; };
|
||||||
833C3794180328A300CBA602 /* takdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = takdec.c; sourceTree = "<group>"; };
|
833C3794180328A300CBA602 /* takdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = takdec.c; sourceTree = "<group>"; };
|
||||||
833C3796180328B300CBA602 /* tak_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tak_parser.c; sourceTree = "<group>"; };
|
833C3796180328B300CBA602 /* tak_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tak_parser.c; sourceTree = "<group>"; };
|
||||||
833C3797180328B300CBA602 /* tak.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tak.c; sourceTree = "<group>"; };
|
833C3797180328B300CBA602 /* tak.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tak.c; sourceTree = "<group>"; };
|
||||||
|
@ -844,8 +871,6 @@
|
||||||
838491001807CDC000E7332D /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
|
838491001807CDC000E7332D /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
|
||||||
838491011807CDC000E7332D /* lpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpc.h; sourceTree = "<group>"; };
|
838491011807CDC000E7332D /* lpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpc.h; sourceTree = "<group>"; };
|
||||||
838491041807CDEC00E7332D /* cbrt_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cbrt_tablegen.h; sourceTree = "<group>"; };
|
838491041807CDEC00E7332D /* cbrt_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cbrt_tablegen.h; sourceTree = "<group>"; };
|
||||||
838491061807CDF400E7332D /* lls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lls.c; sourceTree = "<group>"; };
|
|
||||||
838491071807CDF400E7332D /* lls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lls.h; sourceTree = "<group>"; };
|
|
||||||
8384910A1807CE2A00E7332D /* lls_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lls_init.c; sourceTree = "<group>"; };
|
8384910A1807CE2A00E7332D /* lls_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lls_init.c; sourceTree = "<group>"; };
|
||||||
8384910C1807CEB600E7332D /* sbrdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sbrdsp.c; sourceTree = "<group>"; };
|
8384910C1807CEB600E7332D /* sbrdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sbrdsp.c; sourceTree = "<group>"; };
|
||||||
8384910E1807CEC400E7332D /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
|
8384910E1807CEC400E7332D /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
|
||||||
|
@ -873,7 +898,6 @@
|
||||||
8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_data.c; sourceTree = "<group>"; };
|
8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_data.c; sourceTree = "<group>"; };
|
||||||
8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_float.c; sourceTree = "<group>"; };
|
8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_float.c; sourceTree = "<group>"; };
|
||||||
8393B7F618052BC200913C76 /* mpegaudiodsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiodsp.h; sourceTree = "<group>"; };
|
8393B7F618052BC200913C76 /* mpegaudiodsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiodsp.h; sourceTree = "<group>"; };
|
||||||
8393B7F718052BC200913C76 /* mpegaudioenc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudioenc.c; sourceTree = "<group>"; };
|
|
||||||
8393B7F818052BC200913C76 /* mpegaudiotab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiotab.h; sourceTree = "<group>"; };
|
8393B7F818052BC200913C76 /* mpegaudiotab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiotab.h; sourceTree = "<group>"; };
|
||||||
8393B80D18052BD500913C76 /* mpegaudiodsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp.c; sourceTree = "<group>"; };
|
8393B80D18052BD500913C76 /* mpegaudiodsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp.c; sourceTree = "<group>"; };
|
||||||
8393B80F18052DB700913C76 /* bitstream_filter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream_filter.c; sourceTree = "<group>"; };
|
8393B80F18052DB700913C76 /* bitstream_filter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream_filter.c; sourceTree = "<group>"; };
|
||||||
|
@ -967,6 +991,13 @@
|
||||||
830F0B8E17FC4FB900042E8F /* libavcodec */ = {
|
830F0B8E17FC4FB900042E8F /* libavcodec */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
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 */,
|
833E5F9D18A31EC4006A85F9 /* twinvq_data.h */,
|
||||||
833E5F9E18A31EC4006A85F9 /* twinvq.c */,
|
833E5F9E18A31EC4006A85F9 /* twinvq.c */,
|
||||||
833E5F9F18A31EC4006A85F9 /* twinvq.h */,
|
833E5F9F18A31EC4006A85F9 /* twinvq.h */,
|
||||||
|
@ -1074,7 +1105,6 @@
|
||||||
8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */,
|
8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */,
|
||||||
8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */,
|
8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */,
|
||||||
8393B7F618052BC200913C76 /* mpegaudiodsp.h */,
|
8393B7F618052BC200913C76 /* mpegaudiodsp.h */,
|
||||||
8393B7F718052BC200913C76 /* mpegaudioenc.c */,
|
|
||||||
8393B7F818052BC200913C76 /* mpegaudiotab.h */,
|
8393B7F818052BC200913C76 /* mpegaudiotab.h */,
|
||||||
833C37D418032E7000CBA602 /* jrevdct.c */,
|
833C37D418032E7000CBA602 /* jrevdct.c */,
|
||||||
833C37CA18032D4800CBA602 /* golomb.c */,
|
833C37CA18032D4800CBA602 /* golomb.c */,
|
||||||
|
@ -1308,8 +1338,13 @@
|
||||||
830F0BBA17FC4FB900042E8F /* libavutil */ = {
|
830F0BBA17FC4FB900042E8F /* libavutil */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
838491061807CDF400E7332D /* lls.c */,
|
832F4BC218CD5DE2003E940E /* time_.h */,
|
||||||
838491071807CDF400E7332D /* lls.h */,
|
832F4BBE18CD5DD9003E940E /* downmix_info.c */,
|
||||||
|
832F4BBF18CD5DD9003E940E /* downmix_info.h */,
|
||||||
|
832F4BB418CD4FEA003E940E /* macros.h */,
|
||||||
|
832F4BB518CD4FEA003E940E /* timestamp.h */,
|
||||||
|
832F4BA418CD4F47003E940E /* lls2.c */,
|
||||||
|
832F4BA518CD4F47003E940E /* lls2.h */,
|
||||||
838490721807B07000E7332D /* md5.c */,
|
838490721807B07000E7332D /* md5.c */,
|
||||||
838490731807B07000E7332D /* md5.h */,
|
838490731807B07000E7332D /* md5.h */,
|
||||||
8384906E1807B04200E7332D /* lfg.c */,
|
8384906E1807B04200E7332D /* lfg.c */,
|
||||||
|
@ -1319,7 +1354,6 @@
|
||||||
83BCB8E117FCA64400760340 /* timecode.h */,
|
83BCB8E117FCA64400760340 /* timecode.h */,
|
||||||
830F0DB117FC8FCE00042E8F /* log2_tab.c */,
|
830F0DB117FC8FCE00042E8F /* log2_tab.c */,
|
||||||
830F0D5217FC891800042E8F /* file_open.c */,
|
830F0D5217FC891800042E8F /* file_open.c */,
|
||||||
830F0D5017FC880E00042E8F /* time_.h */,
|
|
||||||
830F0D4A17FC862300042E8F /* time.c */,
|
830F0D4A17FC862300042E8F /* time.c */,
|
||||||
830F0D4C17FC862400042E8F /* utils.c */,
|
830F0D4C17FC862400042E8F /* utils.c */,
|
||||||
830F0D4217FC85ED00042E8F /* integer.c */,
|
830F0D4217FC85ED00042E8F /* integer.c */,
|
||||||
|
@ -1438,6 +1472,8 @@
|
||||||
830F0D0717FC80B400042E8F /* x86 */ = {
|
830F0D0717FC80B400042E8F /* x86 */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
832F4BC618CD6052003E940E /* dcadsp_init.c */,
|
||||||
|
832F4BC418CD601B003E940E /* ttadsp_init.c */,
|
||||||
838491101807CEF400E7332D /* sbrdsp_init.c */,
|
838491101807CEF400E7332D /* sbrdsp_init.c */,
|
||||||
8384910E1807CEC400E7332D /* lpc.c */,
|
8384910E1807CEC400E7332D /* lpc.c */,
|
||||||
838490841807B17C00E7332D /* ac3dsp_init.c */,
|
838490841807B17C00E7332D /* ac3dsp_init.c */,
|
||||||
|
@ -1477,12 +1513,13 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
83BCB8E217FCA64400760340 /* avconfig.h in Headers */,
|
||||||
830F0D3417FC841B00042E8F /* opt.h in Headers */,
|
830F0D3417FC841B00042E8F /* opt.h in Headers */,
|
||||||
830F0C1C17FC523000042E8F /* url.h in Headers */,
|
830F0C1C17FC523000042E8F /* url.h in Headers */,
|
||||||
83BCB8E217FCA64400760340 /* avconfig.h in Headers */,
|
|
||||||
830F0BDC17FC4FB900042E8F /* old_codec_ids.h in Headers */,
|
830F0BDC17FC4FB900042E8F /* old_codec_ids.h in Headers */,
|
||||||
830F0C0B17FC4FB900042E8F /* pixfmt.h in Headers */,
|
830F0C0B17FC4FB900042E8F /* pixfmt.h in Headers */,
|
||||||
830F0C0517FC4FB900042E8F /* intfloat_readwrite.h in Headers */,
|
830F0C0517FC4FB900042E8F /* intfloat_readwrite.h in Headers */,
|
||||||
|
832F4BBB18CD53E9003E940E /* ttadsp.h in Headers */,
|
||||||
830F0C0417FC4FB900042E8F /* intfloat.h in Headers */,
|
830F0C0417FC4FB900042E8F /* intfloat.h in Headers */,
|
||||||
830F0C0717FC4FB900042E8F /* mathematics.h in Headers */,
|
830F0C0717FC4FB900042E8F /* mathematics.h in Headers */,
|
||||||
838491031807CDC000E7332D /* lpc.h in Headers */,
|
838491031807CDC000E7332D /* lpc.h in Headers */,
|
||||||
|
@ -1502,6 +1539,7 @@
|
||||||
830F0BE317FC4FB900042E8F /* version.h in Headers */,
|
830F0BE317FC4FB900042E8F /* version.h in Headers */,
|
||||||
830F0BFA17FC4FB900042E8F /* attributes.h in Headers */,
|
830F0BFA17FC4FB900042E8F /* attributes.h in Headers */,
|
||||||
830F0BFF17FC4FB900042E8F /* common.h in Headers */,
|
830F0BFF17FC4FB900042E8F /* common.h in Headers */,
|
||||||
|
832F4BB618CD4FEA003E940E /* macros.h in Headers */,
|
||||||
830F0BFB17FC4FB900042E8F /* avutil.h in Headers */,
|
830F0BFB17FC4FB900042E8F /* avutil.h in Headers */,
|
||||||
830F0C0D17FC4FB900042E8F /* samplefmt.h in Headers */,
|
830F0C0D17FC4FB900042E8F /* samplefmt.h in Headers */,
|
||||||
830F0BFD17FC4FB900042E8F /* buffer.h in Headers */,
|
830F0BFD17FC4FB900042E8F /* buffer.h in Headers */,
|
||||||
|
@ -1598,11 +1636,12 @@
|
||||||
830F0DCA17FC931700042E8F /* pcm.h in Headers */,
|
830F0DCA17FC931700042E8F /* pcm.h in Headers */,
|
||||||
830F0CCC17FC7F1E00042E8F /* celp_filters.h in Headers */,
|
830F0CCC17FC7F1E00042E8F /* celp_filters.h in Headers */,
|
||||||
830C4B5C180C3434007674D6 /* amrnbdata.h in Headers */,
|
830C4B5C180C3434007674D6 /* amrnbdata.h in Headers */,
|
||||||
830F0D5117FC880E00042E8F /* time_.h in Headers */,
|
|
||||||
830F0BD717FC4FB900042E8F /* get_bits.h in Headers */,
|
830F0BD717FC4FB900042E8F /* get_bits.h in Headers */,
|
||||||
830F0C2417FC527400042E8F /* atomic.h in Headers */,
|
830F0C2417FC527400042E8F /* atomic.h in Headers */,
|
||||||
|
832F4BC318CD5DE2003E940E /* time_.h in Headers */,
|
||||||
833E5FA118A31EC4006A85F9 /* twinvq_data.h in Headers */,
|
833E5FA118A31EC4006A85F9 /* twinvq_data.h in Headers */,
|
||||||
830F0C5D17FC7CEA00042E8F /* id3v1.h in Headers */,
|
830F0C5D17FC7CEA00042E8F /* id3v1.h in Headers */,
|
||||||
|
832F4BAF18CD4F6B003E940E /* atrac3plus_data.h in Headers */,
|
||||||
838490631807AF0100E7332D /* ac3dec.h in Headers */,
|
838490631807AF0100E7332D /* ac3dec.h in Headers */,
|
||||||
838490C31807C37300E7332D /* atrac.h in Headers */,
|
838490C31807C37300E7332D /* atrac.h in Headers */,
|
||||||
830F0C6A17FC7DB100042E8F /* avassert.h in Headers */,
|
830F0C6A17FC7DB100042E8F /* avassert.h in Headers */,
|
||||||
|
@ -1620,7 +1659,6 @@
|
||||||
830F0C6D17FC7DB100042E8F /* buffer_internal.h in Headers */,
|
830F0C6D17FC7DB100042E8F /* buffer_internal.h in Headers */,
|
||||||
830F0DBB17FC921D00042E8F /* emms.h in Headers */,
|
830F0DBB17FC921D00042E8F /* emms.h in Headers */,
|
||||||
830F0C2217FC527400042E8F /* atomic_gcc.h in Headers */,
|
830F0C2217FC527400042E8F /* atomic_gcc.h in Headers */,
|
||||||
838491091807CDF400E7332D /* lls.h in Headers */,
|
|
||||||
838490F21807C57B00E7332D /* aacadtsdec.h in Headers */,
|
838490F21807C57B00E7332D /* aacadtsdec.h in Headers */,
|
||||||
830F0CD117FC7F1E00042E8F /* dct.h in Headers */,
|
830F0CD117FC7F1E00042E8F /* dct.h in Headers */,
|
||||||
830F0DBC17FC921D00042E8F /* timer.h in Headers */,
|
830F0DBC17FC921D00042E8F /* timer.h in Headers */,
|
||||||
|
@ -1628,6 +1666,7 @@
|
||||||
830F0BD817FC4FB900042E8F /* internal.h in Headers */,
|
830F0BD817FC4FB900042E8F /* internal.h in Headers */,
|
||||||
830F0BE517FC4FB900042E8F /* wma_common.h in Headers */,
|
830F0BE517FC4FB900042E8F /* wma_common.h in Headers */,
|
||||||
830F0CDB17FC7F1E00042E8F /* error_resilience.h in Headers */,
|
830F0CDB17FC7F1E00042E8F /* error_resilience.h in Headers */,
|
||||||
|
832F4BB718CD4FEA003E940E /* timestamp.h in Headers */,
|
||||||
830F0C4A17FC7CA300042E8F /* avio_internal.h in Headers */,
|
830F0C4A17FC7CA300042E8F /* avio_internal.h in Headers */,
|
||||||
830F0C7017FC7DB100042E8F /* pixdesc.h in Headers */,
|
830F0C7017FC7DB100042E8F /* pixdesc.h in Headers */,
|
||||||
833C37C318032CF600CBA602 /* dirac_arith.h in Headers */,
|
833C37C318032CF600CBA602 /* dirac_arith.h in Headers */,
|
||||||
|
@ -1638,6 +1677,7 @@
|
||||||
830F0CE817FC7F1E00042E8F /* hpeldsp.h in Headers */,
|
830F0CE817FC7F1E00042E8F /* hpeldsp.h in Headers */,
|
||||||
830F0D8B17FC8E8B00042E8F /* aacpsdsp.h in Headers */,
|
830F0D8B17FC8E8B00042E8F /* aacpsdsp.h in Headers */,
|
||||||
830F0CD617FC7F1E00042E8F /* dctref.h in Headers */,
|
830F0CD617FC7F1E00042E8F /* dctref.h in Headers */,
|
||||||
|
832F4BA718CD4F47003E940E /* lls2.h in Headers */,
|
||||||
838490F61807C57B00E7332D /* aacps_tablegen.h in Headers */,
|
838490F61807C57B00E7332D /* aacps_tablegen.h in Headers */,
|
||||||
830F0C1917FC523000042E8F /* rdt.h in Headers */,
|
830F0C1917FC523000042E8F /* rdt.h in Headers */,
|
||||||
838490941807BC9400E7332D /* dcadsp.h in Headers */,
|
838490941807BC9400E7332D /* dcadsp.h in Headers */,
|
||||||
|
@ -1680,8 +1720,10 @@
|
||||||
830F0C8117FC7ED100042E8F /* crc.h in Headers */,
|
830F0C8117FC7ED100042E8F /* crc.h in Headers */,
|
||||||
833C379C180328B300CBA602 /* tak.h in Headers */,
|
833C379C180328B300CBA602 /* tak.h in Headers */,
|
||||||
830F0DB817FC921D00042E8F /* asm.h in Headers */,
|
830F0DB817FC921D00042E8F /* asm.h in Headers */,
|
||||||
|
832F4BC118CD5DD9003E940E /* downmix_info.h in Headers */,
|
||||||
830F0CC517FC7F1E00042E8F /* acelp_pitch_delay.h in Headers */,
|
830F0CC517FC7F1E00042E8F /* acelp_pitch_delay.h in Headers */,
|
||||||
838490D91807C47E00E7332D /* g729postfilter.h in Headers */,
|
838490D91807C47E00E7332D /* g729postfilter.h in Headers */,
|
||||||
|
832F4BB118CD4F6B003E940E /* atrac3plus.h in Headers */,
|
||||||
830F0D8F17FC8E8B00042E8F /* sbrdsp.h in Headers */,
|
830F0D8F17FC8E8B00042E8F /* sbrdsp.h in Headers */,
|
||||||
830F0CCE17FC7F1E00042E8F /* celp_math.h in Headers */,
|
830F0CCE17FC7F1E00042E8F /* celp_math.h in Headers */,
|
||||||
8384905D1807AF0100E7332D /* ac3_parser.h in Headers */,
|
8384905D1807AF0100E7332D /* ac3_parser.h in Headers */,
|
||||||
|
@ -1755,7 +1797,6 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
838490DA1807C47E00E7332D /* g726.c in Sources */,
|
838490DA1807C47E00E7332D /* g726.c in Sources */,
|
||||||
838491081807CDF400E7332D /* lls.c in Sources */,
|
|
||||||
833C37A918032AAD00CBA602 /* img2.c in Sources */,
|
833C37A918032AAD00CBA602 /* img2.c in Sources */,
|
||||||
838490701807B04200E7332D /* lfg.c in Sources */,
|
838490701807B04200E7332D /* lfg.c in Sources */,
|
||||||
838490981807BC9C00E7332D /* dtshddec.c in Sources */,
|
838490981807BC9C00E7332D /* dtshddec.c in Sources */,
|
||||||
|
@ -1768,6 +1809,7 @@
|
||||||
830F0CF417FC7F1E00042E8F /* rdft.c in Sources */,
|
830F0CF417FC7F1E00042E8F /* rdft.c in Sources */,
|
||||||
830F0DB217FC8FCE00042E8F /* log2_tab.c in Sources */,
|
830F0DB217FC8FCE00042E8F /* log2_tab.c in Sources */,
|
||||||
830F0BEE17FC4FB900042E8F /* allformats.c in Sources */,
|
830F0BEE17FC4FB900042E8F /* allformats.c in Sources */,
|
||||||
|
832F4BB218CD4F6B003E940E /* atrac3plusdec.c in Sources */,
|
||||||
830F0D4817FC85ED00042E8F /* intmath.c in Sources */,
|
830F0D4817FC85ED00042E8F /* intmath.c in Sources */,
|
||||||
8384904F1807898A00E7332D /* ape.c in Sources */,
|
8384904F1807898A00E7332D /* ape.c in Sources */,
|
||||||
830F0CF017FC7F1E00042E8F /* ratecontrol.c in Sources */,
|
830F0CF017FC7F1E00042E8F /* ratecontrol.c in Sources */,
|
||||||
|
@ -1804,6 +1846,7 @@
|
||||||
830F0BF217FC4FB900042E8F /* avio.c in Sources */,
|
830F0BF217FC4FB900042E8F /* avio.c in Sources */,
|
||||||
830C4B5F180C3434007674D6 /* amrwbdec.c in Sources */,
|
830C4B5F180C3434007674D6 /* amrwbdec.c in Sources */,
|
||||||
838490DC1807C47E00E7332D /* g723_1.c in Sources */,
|
838490DC1807C47E00E7332D /* g723_1.c in Sources */,
|
||||||
|
832F4BC518CD601B003E940E /* ttadsp_init.c in Sources */,
|
||||||
830F0CE217FC7F1E00042E8F /* frame_thread_encoder.c in Sources */,
|
830F0CE217FC7F1E00042E8F /* frame_thread_encoder.c in Sources */,
|
||||||
830C4B61180C343C007674D6 /* amr.c in Sources */,
|
830C4B61180C343C007674D6 /* amr.c in Sources */,
|
||||||
838491151807D1D200E7332D /* tta.c in Sources */,
|
838491151807D1D200E7332D /* tta.c in Sources */,
|
||||||
|
@ -1881,6 +1924,7 @@
|
||||||
830F0CDE17FC7F1E00042E8F /* faanidct.c in Sources */,
|
830F0CDE17FC7F1E00042E8F /* faanidct.c in Sources */,
|
||||||
833C379B180328B300CBA602 /* tak.c in Sources */,
|
833C379B180328B300CBA602 /* tak.c in Sources */,
|
||||||
830F0CC917FC7F1E00042E8F /* bit_depth_template.c in Sources */,
|
830F0CC917FC7F1E00042E8F /* bit_depth_template.c in Sources */,
|
||||||
|
832F4BC718CD6052003E940E /* dcadsp_init.c in Sources */,
|
||||||
8384906C1807AFB800E7332D /* aac_ac3_parser.c in Sources */,
|
8384906C1807AFB800E7332D /* aac_ac3_parser.c in Sources */,
|
||||||
8393B7E318052BB000913C76 /* mpeg.c in Sources */,
|
8393B7E318052BB000913C76 /* mpeg.c in Sources */,
|
||||||
838491111807CEF400E7332D /* sbrdsp_init.c in Sources */,
|
838491111807CEF400E7332D /* sbrdsp_init.c in Sources */,
|
||||||
|
@ -1911,11 +1955,13 @@
|
||||||
830F0D5F17FC89BD00042E8F /* options.c in Sources */,
|
830F0D5F17FC89BD00042E8F /* options.c in Sources */,
|
||||||
8393B7FE18052BC200913C76 /* mpegaudiodata.c in Sources */,
|
8393B7FE18052BC200913C76 /* mpegaudiodata.c in Sources */,
|
||||||
833C37D318032E4800CBA602 /* dsputil_init.c in Sources */,
|
833C37D318032E4800CBA602 /* dsputil_init.c in Sources */,
|
||||||
|
832F4BA618CD4F47003E940E /* lls2.c in Sources */,
|
||||||
830F0DB917FC921D00042E8F /* cpu.c in Sources */,
|
830F0DB917FC921D00042E8F /* cpu.c in Sources */,
|
||||||
830F0C7D17FC7E4E00042E8F /* mathematics.c in Sources */,
|
830F0C7D17FC7E4E00042E8F /* mathematics.c in Sources */,
|
||||||
830F0BDD17FC4FB900042E8F /* parser.c in Sources */,
|
830F0BDD17FC4FB900042E8F /* parser.c in Sources */,
|
||||||
830F0C5C17FC7CEA00042E8F /* id3v1.c in Sources */,
|
830F0C5C17FC7CEA00042E8F /* id3v1.c in Sources */,
|
||||||
8393B7F918052BC200913C76 /* mpegaudio_parser.c in Sources */,
|
8393B7F918052BC200913C76 /* mpegaudio_parser.c in Sources */,
|
||||||
|
832F4BBA18CD53E9003E940E /* ttadsp.c in Sources */,
|
||||||
830F0CFC17FC7F1E00042E8F /* videodsp.c in Sources */,
|
830F0CFC17FC7F1E00042E8F /* videodsp.c in Sources */,
|
||||||
830F0D8C17FC8E8B00042E8F /* dv_profile.c in Sources */,
|
830F0D8C17FC8E8B00042E8F /* dv_profile.c in Sources */,
|
||||||
833C37B118032AEF00CBA602 /* diracdsp.c in Sources */,
|
833C37B118032AEF00CBA602 /* diracdsp.c in Sources */,
|
||||||
|
@ -1929,7 +1975,9 @@
|
||||||
8384904D1807898200E7332D /* apedec.c in Sources */,
|
8384904D1807898200E7332D /* apedec.c in Sources */,
|
||||||
830F0D2E17FC841B00042E8F /* channel_layout.c in Sources */,
|
830F0D2E17FC841B00042E8F /* channel_layout.c in Sources */,
|
||||||
830F0CE517FC7F1E00042E8F /* h264chroma.c in Sources */,
|
830F0CE517FC7F1E00042E8F /* h264chroma.c in Sources */,
|
||||||
|
832F4BB318CD4F6B003E940E /* atrac3plusdsp.c in Sources */,
|
||||||
830F0BE717FC4FB900042E8F /* wmadec.c in Sources */,
|
830F0BE717FC4FB900042E8F /* wmadec.c in Sources */,
|
||||||
|
832F4BC018CD5DD9003E940E /* downmix_info.c in Sources */,
|
||||||
838490931807BC9400E7332D /* dcadsp.c in Sources */,
|
838490931807BC9400E7332D /* dcadsp.c in Sources */,
|
||||||
838490FF1807C58500E7332D /* aacdec.c in Sources */,
|
838490FF1807C58500E7332D /* aacdec.c in Sources */,
|
||||||
830F0CC617FC7F1E00042E8F /* acelp_vectors.c in Sources */,
|
830F0CC617FC7F1E00042E8F /* acelp_vectors.c in Sources */,
|
||||||
|
@ -1944,6 +1992,7 @@
|
||||||
830F0D3817FC844E00042E8F /* parseutils.c in Sources */,
|
830F0D3817FC844E00042E8F /* parseutils.c in Sources */,
|
||||||
830F0D2017FC82AB00042E8F /* cpu.c in Sources */,
|
830F0D2017FC82AB00042E8F /* cpu.c in Sources */,
|
||||||
8393B7FC18052BC200913C76 /* mpegaudio.c in Sources */,
|
8393B7FC18052BC200913C76 /* mpegaudio.c in Sources */,
|
||||||
|
832F4BB018CD4F6B003E940E /* atrac3plus.c in Sources */,
|
||||||
838490D81807C47E00E7332D /* g729postfilter.c in Sources */,
|
838490D81807C47E00E7332D /* g729postfilter.c in Sources */,
|
||||||
833C37C618032CF600CBA602 /* dirac_parser.c in Sources */,
|
833C37C618032CF600CBA602 /* dirac_parser.c in Sources */,
|
||||||
830F0CED17FC7F1E00042E8F /* mpeg12data.c in Sources */,
|
830F0CED17FC7F1E00042E8F /* mpeg12data.c in Sources */,
|
||||||
|
@ -1954,7 +2003,6 @@
|
||||||
830F0BE817FC4FB900042E8F /* wmalosslessdec.c in Sources */,
|
830F0BE817FC4FB900042E8F /* wmalosslessdec.c in Sources */,
|
||||||
838490621807AF0100E7332D /* ac3dec.c in Sources */,
|
838490621807AF0100E7332D /* ac3dec.c in Sources */,
|
||||||
83BCB8E317FCA64400760340 /* timecode.c in Sources */,
|
83BCB8E317FCA64400760340 /* timecode.c in Sources */,
|
||||||
8393B80B18052BC200913C76 /* mpegaudioenc.c in Sources */,
|
|
||||||
8384910D1807CEB600E7332D /* sbrdsp.c in Sources */,
|
8384910D1807CEB600E7332D /* sbrdsp.c in Sources */,
|
||||||
8384911A1807D1D900E7332D /* ttadata.c in Sources */,
|
8384911A1807D1D900E7332D /* ttadata.c in Sources */,
|
||||||
838490B91807C1C300E7332D /* truespeech.c in Sources */,
|
838490B91807C1C300E7332D /* truespeech.c in Sources */,
|
||||||
|
@ -2009,7 +2057,6 @@
|
||||||
GCC_PREFIX_HEADER = FFMPEG_Prefix.pch;
|
GCC_PREFIX_HEADER = FFMPEG_Prefix.pch;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
||||||
"ffmpeg-minimal",
|
"ffmpeg-minimal",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = Info.plist;
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
@ -2034,7 +2081,6 @@
|
||||||
GCC_PREFIX_HEADER = FFMPEG_Prefix.pch;
|
GCC_PREFIX_HEADER = FFMPEG_Prefix.pch;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
||||||
"ffmpeg-minimal",
|
"ffmpeg-minimal",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = Info.plist;
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
@ -2049,6 +2095,7 @@
|
||||||
1DEB91B208733DA50010E9CD /* Debug */ = {
|
1DEB91B208733DA50010E9CD /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CODE_SIGN_IDENTITY = "Christopher Snowhill";
|
CODE_SIGN_IDENTITY = "Christopher Snowhill";
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
@ -2063,6 +2110,7 @@
|
||||||
1DEB91B308733DA50010E9CD /* Release */ = {
|
1DEB91B308733DA50010E9CD /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CODE_SIGN_IDENTITY = "Christopher Snowhill";
|
CODE_SIGN_IDENTITY = "Christopher Snowhill";
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#define ARCH_X86 1
|
#define ARCH_X86 1
|
||||||
#define ARCH_ARM 0
|
#define ARCH_ARM 0
|
||||||
#define ARCH_PPC 0
|
#define ARCH_PPC 0
|
||||||
|
#define ARCH_AARCH64 0
|
||||||
#define ARCH_ALPHA 0
|
#define ARCH_ALPHA 0
|
||||||
#define ARCH_BFIN 0
|
#define ARCH_BFIN 0
|
||||||
#define ARCH_SH4 0
|
#define ARCH_SH4 0
|
||||||
|
@ -79,6 +80,7 @@
|
||||||
#define CONFIG_RISKY 1
|
#define CONFIG_RISKY 1
|
||||||
#define CONFIG_FTRAPV 0
|
#define CONFIG_FTRAPV 0
|
||||||
#define CONFIG_SMALL 0
|
#define CONFIG_SMALL 0
|
||||||
|
#define CONFIG_XVMC 0
|
||||||
|
|
||||||
#define NULL_IF_CONFIG_SMALL(a) a
|
#define NULL_IF_CONFIG_SMALL(a) a
|
||||||
|
|
||||||
|
@ -88,8 +90,9 @@
|
||||||
#define CONFIG_H264_VAAPI_HWACCEL 0
|
#define CONFIG_H264_VAAPI_HWACCEL 0
|
||||||
#define CONFIG_H264_VDA_HWACCEL 0
|
#define CONFIG_H264_VDA_HWACCEL 0
|
||||||
#define CONFIG_H264_VDPAU_HWACCEL 0
|
#define CONFIG_H264_VDPAU_HWACCEL 0
|
||||||
|
#define CONFIG_MPEG1_XVMC_HWACCEL 0
|
||||||
#define CONFIG_MPEG1_VDPAU_HWACCEL 0
|
#define CONFIG_MPEG1_VDPAU_HWACCEL 0
|
||||||
#define CONFIG_MPEG1_DXVA2_HWACCEL 0
|
#define CONFIG_MPEG2_XVMC_HWACCEL 0
|
||||||
#define CONFIG_MPEG2_DXVA2_HWACCEL 0
|
#define CONFIG_MPEG2_DXVA2_HWACCEL 0
|
||||||
#define CONFIG_MPEG2_VAAPI_HWACCEL 0
|
#define CONFIG_MPEG2_VAAPI_HWACCEL 0
|
||||||
#define CONFIG_MPEG2_VDPAU_HWACCEL 0
|
#define CONFIG_MPEG2_VDPAU_HWACCEL 0
|
||||||
|
@ -135,6 +138,7 @@
|
||||||
#define CONFIG_CAVS_DECODER 0
|
#define CONFIG_CAVS_DECODER 0
|
||||||
#define CONFIG_CDGRAPHICS_DECODER 0
|
#define CONFIG_CDGRAPHICS_DECODER 0
|
||||||
#define CONFIG_CDXL_DECODER 0
|
#define CONFIG_CDXL_DECODER 0
|
||||||
|
#define CONFIG_CINEPAK_ENCODER 0
|
||||||
#define CONFIG_CINEPAK_DECODER 0
|
#define CONFIG_CINEPAK_DECODER 0
|
||||||
#define CONFIG_CLJR_ENCODER 0
|
#define CONFIG_CLJR_ENCODER 0
|
||||||
#define CONFIG_CLJR_DECODER 0
|
#define CONFIG_CLJR_DECODER 0
|
||||||
|
@ -170,6 +174,7 @@
|
||||||
#define CONFIG_FFV1_DECODER 0
|
#define CONFIG_FFV1_DECODER 0
|
||||||
#define CONFIG_FFVHUFF_ENCODER 0
|
#define CONFIG_FFVHUFF_ENCODER 0
|
||||||
#define CONFIG_FFVHUFF_DECODER 0
|
#define CONFIG_FFVHUFF_DECODER 0
|
||||||
|
#define CONFIG_FIC_DECODER 0
|
||||||
#define CONFIG_FLASHSV_ENCODER 0
|
#define CONFIG_FLASHSV_ENCODER 0
|
||||||
#define CONFIG_FLASHSV_DECODER 0
|
#define CONFIG_FLASHSV_DECODER 0
|
||||||
#define CONFIG_FLASHSV2_ENCODER 0
|
#define CONFIG_FLASHSV2_ENCODER 0
|
||||||
|
@ -194,6 +199,8 @@
|
||||||
#define CONFIG_H264_CRYSTALHD_DECODER 0
|
#define CONFIG_H264_CRYSTALHD_DECODER 0
|
||||||
#define CONFIG_H264_VDA_DECODER 0
|
#define CONFIG_H264_VDA_DECODER 0
|
||||||
#define CONFIG_H264_VDPAU_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_ENCODER 0
|
||||||
#define CONFIG_HUFFYUV_DECODER 0
|
#define CONFIG_HUFFYUV_DECODER 0
|
||||||
#define CONFIG_IDCIN_DECODER 0
|
#define CONFIG_IDCIN_DECODER 0
|
||||||
|
@ -398,6 +405,7 @@
|
||||||
#define CONFIG_APE_DECODER 1
|
#define CONFIG_APE_DECODER 1
|
||||||
#define CONFIG_ATRAC1_DECODER 0
|
#define CONFIG_ATRAC1_DECODER 0
|
||||||
#define CONFIG_ATRAC3_DECODER 1
|
#define CONFIG_ATRAC3_DECODER 1
|
||||||
|
#define CONFIG_ATRAC3P_DECODER 1
|
||||||
#define CONFIG_BINKAUDIO_DCT_DECODER 0
|
#define CONFIG_BINKAUDIO_DCT_DECODER 0
|
||||||
#define CONFIG_BINKAUDIO_RDFT_DECODER 0
|
#define CONFIG_BINKAUDIO_RDFT_DECODER 0
|
||||||
#define CONFIG_BMV_AUDIO_DECODER 0
|
#define CONFIG_BMV_AUDIO_DECODER 0
|
||||||
|
@ -427,6 +435,7 @@
|
||||||
#define CONFIG_MP2_ENCODER 0
|
#define CONFIG_MP2_ENCODER 0
|
||||||
#define CONFIG_MP2_DECODER 0
|
#define CONFIG_MP2_DECODER 0
|
||||||
#define CONFIG_MP2FLOAT_DECODER 1
|
#define CONFIG_MP2FLOAT_DECODER 1
|
||||||
|
#define CONFIG_MP2FIXED_ENCODER 0
|
||||||
#define CONFIG_MP3_DECODER 0
|
#define CONFIG_MP3_DECODER 0
|
||||||
#define CONFIG_MP3FLOAT_DECODER 1
|
#define CONFIG_MP3FLOAT_DECODER 1
|
||||||
#define CONFIG_MP3ADU_DECODER 0
|
#define CONFIG_MP3ADU_DECODER 0
|
||||||
|
@ -550,6 +559,7 @@
|
||||||
#define CONFIG_ADPCM_G722_DECODER 1
|
#define CONFIG_ADPCM_G722_DECODER 1
|
||||||
#define CONFIG_ADPCM_G726_ENCODER 0
|
#define CONFIG_ADPCM_G726_ENCODER 0
|
||||||
#define CONFIG_ADPCM_G726_DECODER 1
|
#define CONFIG_ADPCM_G726_DECODER 1
|
||||||
|
#define CONFIG_ADPCM_G726LE_DECODER 1
|
||||||
#define CONFIG_ADPCM_IMA_AMV_DECODER 0
|
#define CONFIG_ADPCM_IMA_AMV_DECODER 0
|
||||||
#define CONFIG_ADPCM_IMA_APC_DECODER 0
|
#define CONFIG_ADPCM_IMA_APC_DECODER 0
|
||||||
#define CONFIG_ADPCM_IMA_DK3_DECODER 1
|
#define CONFIG_ADPCM_IMA_DK3_DECODER 1
|
||||||
|
@ -644,8 +654,10 @@
|
||||||
#define CONFIG_LIBVPX_VP9_ENCODER 0
|
#define CONFIG_LIBVPX_VP9_ENCODER 0
|
||||||
#define CONFIG_LIBVPX_VP9_DECODER 0
|
#define CONFIG_LIBVPX_VP9_DECODER 0
|
||||||
#define CONFIG_LIBWAVPACK_ENCODER 0
|
#define CONFIG_LIBWAVPACK_ENCODER 0
|
||||||
|
#define CONFIG_LIBWEBP_ENCODER 0
|
||||||
#define CONFIG_LIBX264_ENCODER 0
|
#define CONFIG_LIBX264_ENCODER 0
|
||||||
#define CONFIG_LIBX264RGB_ENCODER 0
|
#define CONFIG_LIBX264RGB_ENCODER 0
|
||||||
|
#define CONFIG_LIBX265_ENCODER 0
|
||||||
#define CONFIG_LIBXAVS_ENCODER 0
|
#define CONFIG_LIBXAVS_ENCODER 0
|
||||||
#define CONFIG_LIBXVID_ENCODER 0
|
#define CONFIG_LIBXVID_ENCODER 0
|
||||||
#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
|
#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
|
||||||
|
@ -673,6 +685,7 @@
|
||||||
#define CONFIG_H261_PARSER 0
|
#define CONFIG_H261_PARSER 0
|
||||||
#define CONFIG_H263_PARSER 0
|
#define CONFIG_H263_PARSER 0
|
||||||
#define CONFIG_H264_PARSER 0
|
#define CONFIG_H264_PARSER 0
|
||||||
|
#define CONFIG_HEVC_PARSER 0
|
||||||
#define CONFIG_MJPEG_PARSER 0
|
#define CONFIG_MJPEG_PARSER 0
|
||||||
#define CONFIG_MLP_PARSER 0
|
#define CONFIG_MLP_PARSER 0
|
||||||
#define CONFIG_MPEG4VIDEO_PARSER 0
|
#define CONFIG_MPEG4VIDEO_PARSER 0
|
||||||
|
@ -687,6 +700,7 @@
|
||||||
#define CONFIG_VORBIS_PARSER 0
|
#define CONFIG_VORBIS_PARSER 0
|
||||||
#define CONFIG_VP3_PARSER 0
|
#define CONFIG_VP3_PARSER 0
|
||||||
#define CONFIG_VP8_PARSER 0
|
#define CONFIG_VP8_PARSER 0
|
||||||
|
#define CONFIG_VP9_PARSER 0
|
||||||
|
|
||||||
#define CONFIG_AAC_ADTSTOASC_BSF 1
|
#define CONFIG_AAC_ADTSTOASC_BSF 1
|
||||||
#define CONFIG_CHOMP_BSF 0
|
#define CONFIG_CHOMP_BSF 0
|
||||||
|
@ -809,9 +823,12 @@
|
||||||
#define CONFIG_H263_DEMUXER 0
|
#define CONFIG_H263_DEMUXER 0
|
||||||
#define CONFIG_H264_MUXER 0
|
#define CONFIG_H264_MUXER 0
|
||||||
#define CONFIG_H264_DEMUXER 0
|
#define CONFIG_H264_DEMUXER 0
|
||||||
#define CONFIG_H265_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_MUXER 0
|
||||||
#define CONFIG_HLS_DEMUXER 0
|
#define CONFIG_HLS_DEMUXER 0
|
||||||
|
#define CONFIG_HNM_DEMUXER 0
|
||||||
#define CONFIG_ICO_MUXER 0
|
#define CONFIG_ICO_MUXER 0
|
||||||
#define CONFIG_ICO_DEMUXER 0
|
#define CONFIG_ICO_DEMUXER 0
|
||||||
#define CONFIG_IDCIN_DEMUXER 0
|
#define CONFIG_IDCIN_DEMUXER 0
|
||||||
|
@ -900,6 +917,7 @@
|
||||||
#define CONFIG_OGG_DEMUXER 0
|
#define CONFIG_OGG_DEMUXER 0
|
||||||
#define CONFIG_OMA_MUXER 0
|
#define CONFIG_OMA_MUXER 0
|
||||||
#define CONFIG_OMA_DEMUXER 0
|
#define CONFIG_OMA_DEMUXER 0
|
||||||
|
#define CONFIG_OPUS_MUXER 0
|
||||||
#define CONFIG_PAF_DEMUXER 0
|
#define CONFIG_PAF_DEMUXER 0
|
||||||
#define CONFIG_PCM_ALAW_MUXER 0
|
#define CONFIG_PCM_ALAW_MUXER 0
|
||||||
#define CONFIG_PCM_ALAW_DEMUXER 0
|
#define CONFIG_PCM_ALAW_DEMUXER 0
|
||||||
|
@ -970,6 +988,7 @@
|
||||||
#define CONFIG_SAP_DEMUXER 0
|
#define CONFIG_SAP_DEMUXER 0
|
||||||
#define CONFIG_SBG_DEMUXER 0
|
#define CONFIG_SBG_DEMUXER 0
|
||||||
#define CONFIG_SDP_DEMUXER 0
|
#define CONFIG_SDP_DEMUXER 0
|
||||||
|
#define CONFIG_SDR2_DEMUXER 0
|
||||||
#define CONFIG_SEGAFILM_DEMUXER 0
|
#define CONFIG_SEGAFILM_DEMUXER 0
|
||||||
#define CONFIG_SEGMENT_MUXER 0
|
#define CONFIG_SEGMENT_MUXER 0
|
||||||
#define CONFIG_SHORTEN_DEMUXER 0
|
#define CONFIG_SHORTEN_DEMUXER 0
|
||||||
|
@ -984,6 +1003,7 @@
|
||||||
#define CONFIG_SOX_DEMUXER 0
|
#define CONFIG_SOX_DEMUXER 0
|
||||||
#define CONFIG_SPDIF_MUXER 0
|
#define CONFIG_SPDIF_MUXER 0
|
||||||
#define CONFIG_SPDIF_DEMUXER 1
|
#define CONFIG_SPDIF_DEMUXER 1
|
||||||
|
#define CONFIG_SPEEX_MUXER 0
|
||||||
#define CONFIG_SRT_MUXER 0
|
#define CONFIG_SRT_MUXER 0
|
||||||
#define CONFIG_SRT_DEMUXER 0
|
#define CONFIG_SRT_DEMUXER 0
|
||||||
#define CONFIG_STR_DEMUXER 0
|
#define CONFIG_STR_DEMUXER 0
|
||||||
|
@ -1005,6 +1025,7 @@
|
||||||
#define CONFIG_TTA_DEMUXER 1
|
#define CONFIG_TTA_DEMUXER 1
|
||||||
#define CONFIG_TXD_DEMUXER 0
|
#define CONFIG_TXD_DEMUXER 0
|
||||||
#define CONFIG_TTY_DEMUXER 0
|
#define CONFIG_TTY_DEMUXER 0
|
||||||
|
#define CONFIG_UNCODEDFRAMECRC_MUXER 0
|
||||||
#define CONFIG_VC1_MUXER 0
|
#define CONFIG_VC1_MUXER 0
|
||||||
#define CONFIG_VC1_DEMUXER 0
|
#define CONFIG_VC1_DEMUXER 0
|
||||||
#define CONFIG_VC1T_MUXER 0
|
#define CONFIG_VC1T_MUXER 0
|
||||||
|
@ -1066,6 +1087,7 @@
|
||||||
#define CONFIG_RTP_PROTOCOL 0
|
#define CONFIG_RTP_PROTOCOL 0
|
||||||
#define CONFIG_SCTP_PROTOCOL 0
|
#define CONFIG_SCTP_PROTOCOL 0
|
||||||
#define CONFIG_SRTP_PROTOCOL 0
|
#define CONFIG_SRTP_PROTOCOL 0
|
||||||
|
#define CONFIG_SUBFILE_PROTOCOL 0
|
||||||
#define CONFIG_TCP_PROTOCOL 0
|
#define CONFIG_TCP_PROTOCOL 0
|
||||||
#define CONFIG_TLS_PROTOCOL 0
|
#define CONFIG_TLS_PROTOCOL 0
|
||||||
#define CONFIG_UDP_PROTOCOL 0
|
#define CONFIG_UDP_PROTOCOL 0
|
||||||
|
|
|
@ -234,7 +234,7 @@ typedef struct SingleChannelElement {
|
||||||
int sf_idx[128]; ///< scalefactor indices (used by encoder)
|
int sf_idx[128]; ///< scalefactor indices (used by encoder)
|
||||||
uint8_t zeroes[128]; ///< band is not coded (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, coeffs)[1024]; ///< coefficients for IMDCT
|
||||||
DECLARE_ALIGNED(32, float, saved)[1024]; ///< overlap
|
DECLARE_ALIGNED(32, float, saved)[1536]; ///< overlap
|
||||||
DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer
|
DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer
|
||||||
DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP
|
DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP
|
||||||
PredictorState predictor_state[MAX_PREDICTORS];
|
PredictorState predictor_state[MAX_PREDICTORS];
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
|
#include "libavutil/internal.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "aac_ac3_parser.h"
|
#include "aac_ac3_parser.h"
|
||||||
|
|
||||||
|
@ -82,20 +84,27 @@ get_next:
|
||||||
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
||||||
avctx->sample_rate = s->sample_rate;
|
avctx->sample_rate = s->sample_rate;
|
||||||
|
|
||||||
/* allow downmixing to stereo (or mono for AC-3) */
|
/* (E-)AC-3: allow downmixing to stereo or mono */
|
||||||
AV_NOWARN_DEPRECATED(
|
#if FF_API_REQUEST_CHANNELS
|
||||||
if(avctx->request_channels > 0 &&
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
avctx->request_channels < s->channels &&
|
if (avctx->request_channels == 1)
|
||||||
(avctx->request_channels <= 2 ||
|
avctx->request_channel_layout = AV_CH_LAYOUT_MONO;
|
||||||
(avctx->request_channels == 1 &&
|
else if (avctx->request_channels == 2)
|
||||||
(avctx->codec_id == AV_CODEC_ID_AC3 ||
|
avctx->request_channel_layout = AV_CH_LAYOUT_STEREO;
|
||||||
avctx->codec_id == AV_CODEC_ID_EAC3)))) {
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
avctx->channels = avctx->request_channels;
|
#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 {
|
} else {
|
||||||
avctx->channels = s->channels;
|
avctx->channels = s->channels;
|
||||||
avctx->channel_layout = s->channel_layout;
|
avctx->channel_layout = s->channel_layout;
|
||||||
}
|
}
|
||||||
);
|
|
||||||
s1->duration = s->samples;
|
s1->duration = s->samples;
|
||||||
avctx->audio_service_type = s->service_type;
|
avctx->audio_service_type = s->service_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
|
||||||
buf_size -= get_bits_count(&gb)/8;
|
buf_size -= get_bits_count(&gb)/8;
|
||||||
buf += get_bits_count(&gb)/8;
|
buf += get_bits_count(&gb)/8;
|
||||||
}
|
}
|
||||||
|
av_free(avctx->extradata);
|
||||||
avctx->extradata_size = 2 + pce_size;
|
avctx->extradata_size = 2 + pce_size;
|
||||||
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* AAC decoder
|
* AAC decoder
|
||||||
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
||||||
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
||||||
|
* Copyright (c) 2008-2013 Alex Converse <alex.converse@gmail.com>
|
||||||
*
|
*
|
||||||
* AAC LATM decoder
|
* AAC LATM decoder
|
||||||
* Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
|
* Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
|
||||||
|
@ -73,6 +74,7 @@
|
||||||
* N SinuSoidal Coding (Transient, Sinusoid, Noise)
|
* N SinuSoidal Coding (Transient, Sinusoid, Noise)
|
||||||
* Y Parametric Stereo
|
* Y Parametric Stereo
|
||||||
* N Direct Stream Transfer
|
* N Direct Stream Transfer
|
||||||
|
* Y Enhanced AAC Low Delay (ER AAC ELD)
|
||||||
*
|
*
|
||||||
* Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication.
|
* Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication.
|
||||||
* - HE AAC v2 comprises LC AAC with Spectral Band Replication and
|
* - HE AAC v2 comprises LC AAC with Spectral Band Replication and
|
||||||
|
@ -104,6 +106,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if ARCH_ARM
|
#if ARCH_ARM
|
||||||
|
@ -194,6 +197,9 @@ static int frame_configure_elements(AVCodecContext *avctx)
|
||||||
|
|
||||||
/* get output buffer */
|
/* get output buffer */
|
||||||
av_frame_unref(ac->frame);
|
av_frame_unref(ac->frame);
|
||||||
|
if (!avctx->channels)
|
||||||
|
return 1;
|
||||||
|
|
||||||
ac->frame->nb_samples = 2048;
|
ac->frame->nb_samples = 2048;
|
||||||
if ((ret = ff_get_buffer(avctx, ac->frame, 0)) < 0)
|
if ((ret = ff_get_buffer(avctx, ac->frame, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -532,6 +538,25 @@ static int set_default_channel_config(AVCodecContext *avctx,
|
||||||
*tags = tags_per_config[channel_config];
|
*tags = tags_per_config[channel_config];
|
||||||
memcpy(layout_map, aac_channel_layout_map[channel_config - 1],
|
memcpy(layout_map, aac_channel_layout_map[channel_config - 1],
|
||||||
*tags * sizeof(*layout_map));
|
*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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,9 +819,9 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
|
||||||
case AOT_ER_AAC_LD:
|
case AOT_ER_AAC_LD:
|
||||||
res_flags = get_bits(gb, 3);
|
res_flags = get_bits(gb, 3);
|
||||||
if (res_flags) {
|
if (res_flags) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
avpriv_report_missing_feature(avctx,
|
||||||
"AAC data resilience not supported (flags %x)\n",
|
"AAC data resilience (flags %x)",
|
||||||
res_flags);
|
res_flags);
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -810,15 +835,75 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
|
||||||
case AOT_ER_AAC_LD:
|
case AOT_ER_AAC_LD:
|
||||||
ep_config = get_bits(gb, 2);
|
ep_config = get_bits(gb, 2);
|
||||||
if (ep_config) {
|
if (ep_config) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
avpriv_report_missing_feature(avctx,
|
||||||
"epConfig %d is not supported.\n",
|
"epConfig %d", ep_config);
|
||||||
ep_config);
|
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
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.
|
* Decode audio specific configuration; reference: table 1.13.
|
||||||
*
|
*
|
||||||
|
@ -877,11 +962,16 @@ static int decode_audio_specific_config(AACContext *ac,
|
||||||
m4ac, m4ac->chan_config)) < 0)
|
m4ac, m4ac->chan_config)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
|
case AOT_ER_AAC_ELD:
|
||||||
|
if ((ret = decode_eld_specific_config(ac, avctx, &gb,
|
||||||
|
m4ac, m4ac->chan_config)) < 0)
|
||||||
|
return ret;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
avpriv_report_missing_feature(avctx,
|
||||||
"Audio object type %s%d is not supported.\n",
|
"Audio object type %s%d",
|
||||||
m4ac->sbr == 1 ? "SBR+" : "",
|
m4ac->sbr == 1 ? "SBR+" : "",
|
||||||
m4ac->object_type);
|
m4ac->object_type);
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1047,7 +1137,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||||
ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0 * 32768.0);
|
ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0 * 32768.0);
|
||||||
// window initialization
|
// window initialization
|
||||||
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
|
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
|
||||||
ff_kbd_window_init(ff_aac_kbd_long_512, 4.0, 512);
|
|
||||||
ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
|
ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
|
||||||
ff_init_ff_sine_windows(10);
|
ff_init_ff_sine_windows(10);
|
||||||
ff_init_ff_sine_windows( 9);
|
ff_init_ff_sine_windows( 9);
|
||||||
|
@ -1117,22 +1206,25 @@ static void decode_ltp(LongTermPrediction *ltp,
|
||||||
static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||||
GetBitContext *gb)
|
GetBitContext *gb)
|
||||||
{
|
{
|
||||||
if (get_bits1(gb)) {
|
int aot = ac->oc[1].m4ac.object_type;
|
||||||
av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n");
|
if (aot != AOT_ER_AAC_ELD) {
|
||||||
return AVERROR_INVALIDDATA;
|
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->window_sequence[1] = ics->window_sequence[0];
|
|
||||||
ics->window_sequence[0] = get_bits(gb, 2);
|
|
||||||
if (ac->oc[1].m4ac.object_type == 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->num_window_groups = 1;
|
||||||
ics->group_len[0] = 1;
|
ics->group_len[0] = 1;
|
||||||
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
||||||
|
@ -1154,30 +1246,33 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||||
} else {
|
} else {
|
||||||
ics->max_sfb = get_bits(gb, 6);
|
ics->max_sfb = get_bits(gb, 6);
|
||||||
ics->num_windows = 1;
|
ics->num_windows = 1;
|
||||||
if (ac->oc[1].m4ac.object_type == AOT_ER_AAC_LD) {
|
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->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->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)
|
if (!ics->num_swb || !ics->swb_offset)
|
||||||
return AVERROR_BUG;
|
return AVERROR_BUG;
|
||||||
} else {
|
} else {
|
||||||
ics->swb_offset = ff_swb_offset_1024[ac->oc[1].m4ac.sampling_index];
|
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->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;
|
||||||
}
|
}
|
||||||
ics->tns_max_bands = ff_tns_max_bands_1024[ac->oc[1].m4ac.sampling_index];
|
|
||||||
ics->predictor_present = get_bits1(gb);
|
|
||||||
ics->predictor_reset_group = 0;
|
|
||||||
if (ics->predictor_present) {
|
if (ics->predictor_present) {
|
||||||
if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
|
if (aot == AOT_AAC_MAIN) {
|
||||||
if (decode_prediction(ac, ics, gb)) {
|
if (decode_prediction(ac, ics, gb)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
} else if (ac->oc[1].m4ac.object_type == AOT_AAC_LC ||
|
} else if (aot == AOT_AAC_LC ||
|
||||||
ac->oc[1].m4ac.object_type == AOT_ER_AAC_LC) {
|
aot == AOT_ER_AAC_LC) {
|
||||||
av_log(ac->avctx, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Prediction is not allowed in AAC-LC.\n");
|
"Prediction is not allowed in AAC-LC.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (ac->oc[1].m4ac.object_type == AOT_ER_AAC_LD) {
|
if (aot == AOT_ER_AAC_LD) {
|
||||||
av_log(ac->avctx, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"LTP in ER AAC LD not yet implemented.\n");
|
"LTP in ER AAC LD not yet implemented.\n");
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
|
@ -1332,12 +1427,12 @@ static int decode_pulses(Pulse *pulse, GetBitContext *gb,
|
||||||
return -1;
|
return -1;
|
||||||
pulse->pos[0] = swb_offset[pulse_swb];
|
pulse->pos[0] = swb_offset[pulse_swb];
|
||||||
pulse->pos[0] += get_bits(gb, 5);
|
pulse->pos[0] += get_bits(gb, 5);
|
||||||
if (pulse->pos[0] > 1023)
|
if (pulse->pos[0] >= swb_offset[num_swb])
|
||||||
return -1;
|
return -1;
|
||||||
pulse->amp[0] = get_bits(gb, 4);
|
pulse->amp[0] = get_bits(gb, 4);
|
||||||
for (i = 1; i < pulse->num_pulse; i++) {
|
for (i = 1; i < pulse->num_pulse; i++) {
|
||||||
pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1];
|
pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1];
|
||||||
if (pulse->pos[i] > 1023)
|
if (pulse->pos[i] >= swb_offset[num_swb])
|
||||||
return -1;
|
return -1;
|
||||||
pulse->amp[i] = get_bits(gb, 4);
|
pulse->amp[i] = get_bits(gb, 4);
|
||||||
}
|
}
|
||||||
|
@ -1802,9 +1897,15 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||||
TemporalNoiseShaping *tns = &sce->tns;
|
TemporalNoiseShaping *tns = &sce->tns;
|
||||||
IndividualChannelStream *ics = &sce->ics;
|
IndividualChannelStream *ics = &sce->ics;
|
||||||
float *out = sce->coeffs;
|
float *out = sce->coeffs;
|
||||||
int global_gain, er_syntax, pulse_present = 0;
|
int global_gain, eld_syntax, er_syntax, pulse_present = 0;
|
||||||
int ret;
|
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
|
/* This assignment is to silence a GCC warning about the variable being used
|
||||||
* uninitialized when in fact it always is.
|
* uninitialized when in fact it always is.
|
||||||
*/
|
*/
|
||||||
|
@ -1825,11 +1926,8 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
pulse_present = 0;
|
pulse_present = 0;
|
||||||
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;
|
|
||||||
if (!scale_flag) {
|
if (!scale_flag) {
|
||||||
if ((pulse_present = get_bits1(gb))) {
|
if (!eld_syntax && (pulse_present = get_bits1(gb))) {
|
||||||
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
||||||
av_log(ac->avctx, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Pulse tool not allowed in eight short sequence.\n");
|
"Pulse tool not allowed in eight short sequence.\n");
|
||||||
|
@ -1845,7 +1943,7 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||||
if (tns->present && !er_syntax)
|
if (tns->present && !er_syntax)
|
||||||
if (decode_tns(ac, tns, gb, ics) < 0)
|
if (decode_tns(ac, tns, gb, ics) < 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
if (get_bits1(gb)) {
|
if (!eld_syntax && get_bits1(gb)) {
|
||||||
avpriv_request_sample(ac->avctx, "SSR");
|
avpriv_request_sample(ac->avctx, "SSR");
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
@ -1945,8 +2043,9 @@ static void apply_intensity_stereo(AACContext *ac,
|
||||||
static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
|
static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
|
||||||
{
|
{
|
||||||
int i, ret, common_window, ms_present = 0;
|
int i, ret, common_window, ms_present = 0;
|
||||||
|
int eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
|
||||||
|
|
||||||
common_window = get_bits1(gb);
|
common_window = eld_syntax || get_bits1(gb);
|
||||||
if (common_window) {
|
if (common_window) {
|
||||||
if (decode_ics_info(ac, &cpe->ch[0].ics, gb))
|
if (decode_ics_info(ac, &cpe->ch[0].ics, gb))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
@ -2188,10 +2287,12 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
||||||
} else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) {
|
} 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.sbr = 1;
|
||||||
ac->oc[1].m4ac.ps = 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,
|
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
|
||||||
ac->oc[1].status, 1);
|
ac->oc[1].status, 1);
|
||||||
} else {
|
} else {
|
||||||
ac->oc[1].m4ac.sbr = 1;
|
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);
|
res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
|
||||||
break;
|
break;
|
||||||
|
@ -2431,19 +2532,81 @@ static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
|
||||||
float *in = sce->coeffs;
|
float *in = sce->coeffs;
|
||||||
float *out = sce->ret;
|
float *out = sce->ret;
|
||||||
float *saved = sce->saved;
|
float *saved = sce->saved;
|
||||||
const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_512 : ff_sine_512;
|
|
||||||
float *buf = ac->buf_mdct;
|
float *buf = ac->buf_mdct;
|
||||||
|
|
||||||
// imdct
|
// imdct
|
||||||
ac->mdct.imdct_half(&ac->mdct_ld, buf, in);
|
ac->mdct.imdct_half(&ac->mdct_ld, buf, in);
|
||||||
|
|
||||||
// window overlapping
|
// window overlapping
|
||||||
ac->fdsp.vector_fmul_window(out, saved, buf, lwindow_prev, 256);
|
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
|
// buffer update
|
||||||
memcpy(saved, buf + 256, 256 * sizeof(float));
|
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).
|
* Apply dependent channel coupling (applied before IMDCT).
|
||||||
*
|
*
|
||||||
|
@ -2541,10 +2704,16 @@ static void spectral_to_sample(AACContext *ac)
|
||||||
{
|
{
|
||||||
int i, type;
|
int i, type;
|
||||||
void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce);
|
void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce);
|
||||||
if (ac->oc[1].m4ac.object_type == AOT_ER_AAC_LD)
|
switch (ac->oc[1].m4ac.object_type) {
|
||||||
|
case AOT_ER_AAC_LD:
|
||||||
imdct_and_window = imdct_and_windowing_ld;
|
imdct_and_window = imdct_and_windowing_ld;
|
||||||
else
|
break;
|
||||||
|
case AOT_ER_AAC_ELD:
|
||||||
|
imdct_and_window = imdct_and_windowing_eld;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
imdct_and_window = ac->imdct_and_windowing;
|
imdct_and_window = ac->imdct_and_windowing;
|
||||||
|
}
|
||||||
for (type = 3; type >= 0; type--) {
|
for (type = 3; type >= 0; type--) {
|
||||||
for (i = 0; i < MAX_ELEM_ID; i++) {
|
for (i = 0; i < MAX_ELEM_ID; i++) {
|
||||||
ChannelElement *che = ac->che[type][i];
|
ChannelElement *che = ac->che[type][i];
|
||||||
|
@ -2654,8 +2823,9 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||||
int err, i;
|
int err, i;
|
||||||
int samples = 1024;
|
int samples = 1024;
|
||||||
int chan_config = ac->oc[1].m4ac.chan_config;
|
int chan_config = ac->oc[1].m4ac.chan_config;
|
||||||
|
int aot = ac->oc[1].m4ac.object_type;
|
||||||
|
|
||||||
if (ac->oc[1].m4ac.object_type == AOT_ER_AAC_LD)
|
if (aot == AOT_ER_AAC_LD || aot == AOT_ER_AAC_ELD)
|
||||||
samples >>= 1;
|
samples >>= 1;
|
||||||
|
|
||||||
ac->frame = data;
|
ac->frame = data;
|
||||||
|
@ -2663,6 +2833,10 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||||
if ((err = frame_configure_elements(avctx)) < 0)
|
if ((err = frame_configure_elements(avctx)) < 0)
|
||||||
return err;
|
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;
|
ac->tags_mapped = 0;
|
||||||
|
|
||||||
if (chan_config < 0 || chan_config >= 8) {
|
if (chan_config < 0 || chan_config >= 8) {
|
||||||
|
@ -2679,7 +2853,8 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||||
elem_type, elem_id);
|
elem_type, elem_id);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
skip_bits(gb, 4);
|
if (aot != AOT_ER_AAC_ELD)
|
||||||
|
skip_bits(gb, 4);
|
||||||
switch (elem_type) {
|
switch (elem_type) {
|
||||||
case TYPE_SCE:
|
case TYPE_SCE:
|
||||||
err = decode_ics(ac, &che->ch[0], gb, 0, 0);
|
err = decode_ics(ac, &che->ch[0], gb, 0, 0);
|
||||||
|
@ -2698,6 +2873,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||||
spectral_to_sample(ac);
|
spectral_to_sample(ac);
|
||||||
|
|
||||||
ac->frame->nb_samples = samples;
|
ac->frame->nb_samples = samples;
|
||||||
|
ac->frame->sample_rate = avctx->sample_rate;
|
||||||
*got_frame_ptr = 1;
|
*got_frame_ptr = 1;
|
||||||
|
|
||||||
skip_bits_long(gb, get_bits_left(gb));
|
skip_bits_long(gb, get_bits_left(gb));
|
||||||
|
@ -2731,6 +2907,10 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||||
if ((err = frame_configure_elements(avctx)) < 0)
|
if ((err = frame_configure_elements(avctx)) < 0)
|
||||||
goto fail;
|
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;
|
ac->tags_mapped = 0;
|
||||||
// parse
|
// parse
|
||||||
while ((elem_type = get_bits(gb, 3)) != TYPE_END) {
|
while ((elem_type = get_bits(gb, 3)) != TYPE_END) {
|
||||||
|
@ -2828,22 +3008,6 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||||
|
|
||||||
multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
|
multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
|
||||||
samples <<= multiplier;
|
samples <<= multiplier;
|
||||||
/* 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 (samples)
|
|
||||||
ac->frame->nb_samples = samples;
|
|
||||||
else
|
|
||||||
av_frame_unref(ac->frame);
|
|
||||||
*got_frame_ptr = !!samples;
|
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ac->oc[1].status && audio_found) {
|
if (ac->oc[1].status && audio_found) {
|
||||||
avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier;
|
avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier;
|
||||||
|
@ -2857,6 +3021,25 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||||
if (side && side_size>=4)
|
if (side && side_size>=4)
|
||||||
AV_WL32(side, 2*AV_RL32(side));
|
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;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
pop_output_configuration(ac);
|
pop_output_configuration(ac);
|
||||||
|
@ -2915,6 +3098,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
case AOT_ER_AAC_LC:
|
case AOT_ER_AAC_LC:
|
||||||
case AOT_ER_AAC_LTP:
|
case AOT_ER_AAC_LTP:
|
||||||
case AOT_ER_AAC_LD:
|
case AOT_ER_AAC_LD:
|
||||||
|
case AOT_ER_AAC_ELD:
|
||||||
err = aac_decode_er_frame(avctx, data, got_frame_ptr, &gb);
|
err = aac_decode_er_frame(avctx, data, got_frame_ptr, &gb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -323,14 +323,15 @@ static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[8
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Split one subband into 6 subsubbands with a complex filter */
|
/** Split one subband into 6 subsubbands with a complex filter */
|
||||||
static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], const float (*filter)[8][2], int len)
|
static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2],
|
||||||
|
TABLE_CONST float (*filter)[8][2], int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int N = 8;
|
int N = 8;
|
||||||
LOCAL_ALIGNED_16(float, temp, [8], [2]);
|
LOCAL_ALIGNED_16(float, temp, [8], [2]);
|
||||||
|
|
||||||
for (i = 0; i < len; i++, in++) {
|
for (i = 0; i < len; i++, in++) {
|
||||||
dsp->hybrid_analysis(temp, in, filter, 1, N);
|
dsp->hybrid_analysis(temp, in, (const float (*)[8][2]) filter, 1, N);
|
||||||
out[0][i][0] = temp[6][0];
|
out[0][i][0] = temp[6][0];
|
||||||
out[0][i][1] = temp[6][1];
|
out[0][i][1] = temp[6][1];
|
||||||
out[1][i][0] = temp[7][0];
|
out[1][i][0] = temp[7][0];
|
||||||
|
@ -346,12 +347,14 @@ static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hybrid4_8_12_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], const float (*filter)[8][2], int N, int len)
|
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;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++, in++) {
|
for (i = 0; i < len; i++, in++) {
|
||||||
dsp->hybrid_analysis(out[0] + i, in, filter, 32, N);
|
dsp->hybrid_analysis(out[0] + i, in, (const float (*)[8][2]) filter, 32, N);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,6 +433,7 @@ static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64],
|
||||||
#define DECAY_SLOPE 0.05f
|
#define DECAY_SLOPE 0.05f
|
||||||
/// Number of frequency bands that can be addressed by the parameter index, b(k)
|
/// 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_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
|
/// Number of frequency bands that can be addressed by the sub subband index, k
|
||||||
static const int NR_BANDS[] = { 71, 91 };
|
static const int NR_BANDS[] = { 71, 91 };
|
||||||
/// Start frequency band for the all-pass filter decay slope
|
/// Start frequency band for the all-pass filter decay slope
|
||||||
|
@ -686,7 +690,8 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
|
||||||
memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0]));
|
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],
|
ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k],
|
||||||
phi_fract[is34][k], Q_fract_allpass[is34][k],
|
phi_fract[is34][k],
|
||||||
|
(const float (*)[2]) Q_fract_allpass[is34][k],
|
||||||
transient_gain[b], g_decay_slope, nL - n0);
|
transient_gain[b], g_decay_slope, nL - n0);
|
||||||
}
|
}
|
||||||
for (; k < SHORT_DELAY_BAND[is34]; k++) {
|
for (; k < SHORT_DELAY_BAND[is34]; k++) {
|
||||||
|
@ -764,7 +769,7 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2
|
||||||
int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
|
int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
|
||||||
int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_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;
|
const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;
|
||||||
const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
|
TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
|
||||||
|
|
||||||
//Remapping
|
//Remapping
|
||||||
if (ps->num_env_old) {
|
if (ps->num_env_old) {
|
||||||
|
@ -825,7 +830,7 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2
|
||||||
h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];
|
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];
|
h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];
|
||||||
|
|
||||||
if (!PS_BASELINE && ps->enable_ipdopd && 2*b <= NR_PAR_BANDS[is34]) {
|
if (!PS_BASELINE && ps->enable_ipdopd && b < NR_IPDOPD_BANDS[is34]) {
|
||||||
//The spec say says to only run this smoother when enable_ipdopd
|
//The spec say says to only run this smoother when enable_ipdopd
|
||||||
//is set but the reference decoder appears to run it constantly
|
//is set but the reference decoder appears to run it constantly
|
||||||
float h11i, h12i, h21i, h22i;
|
float h11i, h12i, h21i, h22i;
|
||||||
|
@ -915,7 +920,7 @@ int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float
|
||||||
memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));
|
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);
|
hybrid_analysis(&ps->dsp, Lbuf, ps->in_buf, L, is34, len);
|
||||||
decorrelation(ps, Rbuf, Lbuf, is34);
|
decorrelation(ps, Rbuf, (const float (*)[32][2]) Lbuf, is34);
|
||||||
stereo_processing(ps, Lbuf, Rbuf, is34);
|
stereo_processing(ps, Lbuf, Rbuf, is34);
|
||||||
hybrid_synthesis(&ps->dsp, L, Lbuf, is34, len);
|
hybrid_synthesis(&ps->dsp, L, Lbuf, is34, len);
|
||||||
hybrid_synthesis(&ps->dsp, R, Rbuf, is34, len);
|
hybrid_synthesis(&ps->dsp, R, Rbuf, is34, len);
|
||||||
|
|
93
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.c
Normal file
93
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.c
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* Generate a header file for hardcoded Parametric Stereo tables
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 Alex Converse <alex.converse@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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#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;
|
||||||
|
}
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#if CONFIG_HARDCODED_TABLES
|
#if CONFIG_HARDCODED_TABLES
|
||||||
#define ps_tableinit()
|
#define ps_tableinit()
|
||||||
|
#define TABLE_CONST const
|
||||||
#include "libavcodec/aacps_tables.h"
|
#include "libavcodec/aacps_tables.h"
|
||||||
#else
|
#else
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
#define NR_ALLPASS_BANDS20 30
|
#define NR_ALLPASS_BANDS20 30
|
||||||
#define NR_ALLPASS_BANDS34 50
|
#define NR_ALLPASS_BANDS34 50
|
||||||
#define PS_AP_LINKS 3
|
#define PS_AP_LINKS 3
|
||||||
|
#define TABLE_CONST
|
||||||
static float pd_re_smooth[8*8*8];
|
static float pd_re_smooth[8*8*8];
|
||||||
static float pd_im_smooth[8*8*8];
|
static float pd_im_smooth[8*8*8];
|
||||||
static float HA[46][8][4];
|
static float HA[46][8][4];
|
||||||
|
@ -45,7 +47,7 @@ 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_0_12)[12][8][2];
|
||||||
static DECLARE_ALIGNED(16, float, f34_1_8) [ 8][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 DECLARE_ALIGNED(16, float, f34_2_4) [ 4][8][2];
|
||||||
static DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][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 DECLARE_ALIGNED(16, float, phi_fract)[2][50][2];
|
||||||
|
|
||||||
static const float g0_Q8[] = {
|
static const float g0_Q8[] = {
|
||||||
|
|
|
@ -93,7 +93,7 @@ static void ps_hybrid_synthesis_deint_c(float out[2][38][64],
|
||||||
|
|
||||||
static void ps_decorrelate_c(float (*out)[2], float (*delay)[2],
|
static void ps_decorrelate_c(float (*out)[2], float (*delay)[2],
|
||||||
float (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2],
|
float (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2],
|
||||||
const float phi_fract[2], float (*Q_fract)[2],
|
const float phi_fract[2], const float (*Q_fract)[2],
|
||||||
const float *transient_gain,
|
const float *transient_gain,
|
||||||
float g_decay_slope,
|
float g_decay_slope,
|
||||||
int len)
|
int len)
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef struct PSDSPContext {
|
||||||
int i, int len);
|
int i, int len);
|
||||||
void (*decorrelate)(float (*out)[2], float (*delay)[2],
|
void (*decorrelate)(float (*out)[2], float (*delay)[2],
|
||||||
float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2],
|
float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2],
|
||||||
const float phi_fract[2], float (*Q_fract)[2],
|
const float phi_fract[2], const float (*Q_fract)[2],
|
||||||
const float *transient_gain,
|
const float *transient_gain,
|
||||||
float g_decay_slope,
|
float g_decay_slope,
|
||||||
int len);
|
int len);
|
||||||
|
|
965
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsy.c
Normal file
965
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsy.c
Normal file
|
@ -0,0 +1,965 @@
|
||||||
|
/*
|
||||||
|
* 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,
|
||||||
|
};
|
|
@ -34,7 +34,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024];
|
DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024];
|
||||||
DECLARE_ALIGNED(32, float, ff_aac_kbd_long_512 )[512];
|
|
||||||
DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128];
|
DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128];
|
||||||
|
|
||||||
const uint8_t ff_aac_num_swb_1024[] = {
|
const uint8_t ff_aac_num_swb_1024[] = {
|
||||||
|
@ -1237,7 +1236,494 @@ const uint8_t ff_tns_max_bands_1024[] = {
|
||||||
31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
|
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[] = {
|
const uint8_t ff_tns_max_bands_128[] = {
|
||||||
9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
|
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,
|
||||||
|
};
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024];
|
DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024];
|
||||||
DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_512 )[512];
|
|
||||||
DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128];
|
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
|
/* @name number of scalefactor window bands for long and short transform windows respectively
|
||||||
|
@ -75,6 +75,7 @@ extern const uint16_t * const ff_swb_offset_512 [13];
|
||||||
extern const uint16_t * const ff_swb_offset_128 [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_1024[13];
|
||||||
|
extern const uint8_t ff_tns_max_bands_512 [13];
|
||||||
extern const uint8_t ff_tns_max_bands_128 [13];
|
extern const uint8_t ff_tns_max_bands_128 [13];
|
||||||
|
|
||||||
#endif /* AVCODEC_AACTAB_H */
|
#endif /* AVCODEC_AACTAB_H */
|
||||||
|
|
|
@ -82,6 +82,38 @@ typedef enum {
|
||||||
AC3_CHMODE_3F2R
|
AC3_CHMODE_3F2R
|
||||||
} AC3ChannelMode;
|
} 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 {
|
typedef struct AC3BitAllocParameters {
|
||||||
int sr_code;
|
int sr_code;
|
||||||
int sr_shift;
|
int sr_shift;
|
||||||
|
@ -110,6 +142,9 @@ typedef struct AC3HeaderInfo {
|
||||||
int surround_mix_level; ///< Surround mix level index
|
int surround_mix_level; ///< Surround mix level index
|
||||||
uint16_t channel_map;
|
uint16_t channel_map;
|
||||||
int num_blocks; ///< number of audio blocks
|
int num_blocks; ///< number of audio blocks
|
||||||
|
#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
|
||||||
|
int dolby_surround_mode;
|
||||||
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** @name Derived values
|
/** @name Derived values
|
||||||
|
@ -122,6 +157,9 @@ typedef struct AC3HeaderInfo {
|
||||||
uint16_t frame_size;
|
uint16_t frame_size;
|
||||||
uint64_t channel_layout;
|
uint64_t channel_layout;
|
||||||
/** @} */
|
/** @} */
|
||||||
|
#if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI
|
||||||
|
int dolby_surround_mode;
|
||||||
|
#endif
|
||||||
} AC3HeaderInfo;
|
} AC3HeaderInfo;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -47,9 +47,16 @@ static const uint8_t center_levels[4] = { 4, 5, 6, 5 };
|
||||||
static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
|
static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
|
||||||
|
|
||||||
|
|
||||||
int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **phdr)
|
||||||
{
|
{
|
||||||
int frame_size_code;
|
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));
|
memset(hdr, 0, sizeof(*hdr));
|
||||||
|
|
||||||
|
@ -68,6 +75,9 @@ int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||||
hdr->center_mix_level = 5; // -4.5dB
|
hdr->center_mix_level = 5; // -4.5dB
|
||||||
hdr->surround_mix_level = 6; // -6.0dB
|
hdr->surround_mix_level = 6; // -6.0dB
|
||||||
|
|
||||||
|
/* set default dolby surround mode */
|
||||||
|
hdr->dolby_surround_mode = AC3_DSURMOD_NOTINDICATED;
|
||||||
|
|
||||||
if(hdr->bitstream_id <= 10) {
|
if(hdr->bitstream_id <= 10) {
|
||||||
/* Normal AC-3 */
|
/* Normal AC-3 */
|
||||||
hdr->crc1 = get_bits(gbc, 16);
|
hdr->crc1 = get_bits(gbc, 16);
|
||||||
|
@ -85,7 +95,7 @@ int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||||
hdr->channel_mode = get_bits(gbc, 3);
|
hdr->channel_mode = get_bits(gbc, 3);
|
||||||
|
|
||||||
if(hdr->channel_mode == AC3_CHMODE_STEREO) {
|
if(hdr->channel_mode == AC3_CHMODE_STEREO) {
|
||||||
skip_bits(gbc, 2); // skip dsurmod
|
hdr->dolby_surround_mode = get_bits(gbc, 2);
|
||||||
} else {
|
} else {
|
||||||
if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
|
if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
|
||||||
hdr-> center_mix_level = center_levels[get_bits(gbc, 2)];
|
hdr-> center_mix_level = center_levels[get_bits(gbc, 2)];
|
||||||
|
@ -141,6 +151,15 @@ int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||||
return 0;
|
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,
|
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||||
int *need_next_header, int *new_frame_start)
|
int *need_next_header, int *new_frame_start)
|
||||||
{
|
{
|
||||||
|
@ -149,11 +168,11 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||||
uint64_t u64;
|
uint64_t u64;
|
||||||
uint8_t u8[8];
|
uint8_t u8[8];
|
||||||
} tmp = { av_be2ne64(state) };
|
} tmp = { av_be2ne64(state) };
|
||||||
AC3HeaderInfo hdr;
|
AC3HeaderInfo hdr, *phdr = &hdr;
|
||||||
GetBitContext gbc;
|
GetBitContext gbc;
|
||||||
|
|
||||||
init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
|
init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
|
||||||
err = avpriv_ac3_parse_header(&gbc, &hdr);
|
err = avpriv_ac3_parse_header2(&gbc, &phdr);
|
||||||
|
|
||||||
if(err < 0)
|
if(err < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -31,11 +31,14 @@
|
||||||
* Parse the header up to the lfeon element, which is the first 52 or 54 bits
|
* Parse the header up to the lfeon element, which is the first 52 or 54 bits
|
||||||
* depending on the audio coding mode.
|
* depending on the audio coding mode.
|
||||||
* @param[in] gbc BitContext containing the first 54 bits of the frame.
|
* @param[in] gbc BitContext containing the first 54 bits of the frame.
|
||||||
* @param[out] hdr Pointer to struct where header info is written.
|
* @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,
|
* @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)
|
* -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.
|
* 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);
|
int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
|
||||||
|
|
||||||
#endif /* AVCODEC_AC3_PARSER_H */
|
#endif /* AVCODEC_AC3_PARSER_H */
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/crc.h"
|
#include "libavutil/crc.h"
|
||||||
|
#include "libavutil/downmix_info.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
@ -77,6 +79,15 @@ static const float gain_levels[9] = {
|
||||||
LEVEL_MINUS_9DB
|
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
|
* Table for default stereo downmixing coefficients
|
||||||
* reference: Section 7.8.2 Downmixing Into Two Channels
|
* reference: Section 7.8.2 Downmixing Into Two Channels
|
||||||
|
@ -179,13 +190,20 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||||
|
|
||||||
/* allow downmixing to stereo or mono */
|
/* allow downmixing to stereo or mono */
|
||||||
AV_NOWARN_DEPRECATED(
|
#if FF_API_REQUEST_CHANNELS
|
||||||
if (avctx->channels > 0 && avctx->request_channels > 0 &&
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
avctx->request_channels < avctx->channels &&
|
if (avctx->request_channels == 1)
|
||||||
avctx->request_channels <= 2) {
|
avctx->request_channel_layout = AV_CH_LAYOUT_MONO;
|
||||||
avctx->channels = avctx->request_channels;
|
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;
|
s->downmixed = 1;
|
||||||
|
|
||||||
for (i = 0; i < AC3_MAX_CHANNELS; i++) {
|
for (i = 0; i < AC3_MAX_CHANNELS; i++) {
|
||||||
|
@ -220,12 +238,26 @@ static int ac3_parse_header(AC3DecodeContext *s)
|
||||||
|
|
||||||
skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
|
skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
|
||||||
|
|
||||||
/* skip the timecodes (or extra bitstream information for Alternate Syntax)
|
/* skip the timecodes or parse the Alternate Bit Stream Syntax */
|
||||||
TODO: read & use the xbsi1 downmix levels */
|
if (s->bitstream_id != 6) {
|
||||||
if (get_bits1(gbc))
|
if (get_bits1(gbc))
|
||||||
skip_bits(gbc, 14); //skip timecode1 / xbsi1
|
skip_bits(gbc, 14); //skip timecode1
|
||||||
if (get_bits1(gbc))
|
if (get_bits1(gbc))
|
||||||
skip_bits(gbc, 14); //skip timecode2 / xbsi2
|
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 */
|
/* skip additional bitstream info */
|
||||||
if (get_bits1(gbc)) {
|
if (get_bits1(gbc)) {
|
||||||
|
@ -243,18 +275,18 @@ static int ac3_parse_header(AC3DecodeContext *s)
|
||||||
*/
|
*/
|
||||||
static int parse_frame_header(AC3DecodeContext *s)
|
static int parse_frame_header(AC3DecodeContext *s)
|
||||||
{
|
{
|
||||||
AC3HeaderInfo hdr;
|
AC3HeaderInfo hdr, *phdr=&hdr;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = avpriv_ac3_parse_header(&s->gbc, &hdr);
|
err = avpriv_ac3_parse_header2(&s->gbc, &phdr);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* get decoding parameters from header info */
|
/* get decoding parameters from header info */
|
||||||
s->bit_alloc_params.sr_code = hdr.sr_code;
|
s->bit_alloc_params.sr_code = hdr.sr_code;
|
||||||
|
s->bitstream_id = hdr.bitstream_id;
|
||||||
s->bitstream_mode = hdr.bitstream_mode;
|
s->bitstream_mode = hdr.bitstream_mode;
|
||||||
s->channel_mode = hdr.channel_mode;
|
s->channel_mode = hdr.channel_mode;
|
||||||
s->channel_layout = hdr.channel_layout;
|
|
||||||
s->lfe_on = hdr.lfe_on;
|
s->lfe_on = hdr.lfe_on;
|
||||||
s->bit_alloc_params.sr_shift = hdr.sr_shift;
|
s->bit_alloc_params.sr_shift = hdr.sr_shift;
|
||||||
s->sample_rate = hdr.sample_rate;
|
s->sample_rate = hdr.sample_rate;
|
||||||
|
@ -263,11 +295,18 @@ static int parse_frame_header(AC3DecodeContext *s)
|
||||||
s->fbw_channels = s->channels - s->lfe_on;
|
s->fbw_channels = s->channels - s->lfe_on;
|
||||||
s->lfe_ch = s->fbw_channels + 1;
|
s->lfe_ch = s->fbw_channels + 1;
|
||||||
s->frame_size = hdr.frame_size;
|
s->frame_size = hdr.frame_size;
|
||||||
|
s->preferred_downmix = AC3_DMIXMOD_NOTINDICATED;
|
||||||
s->center_mix_level = hdr.center_mix_level;
|
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 = 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->num_blocks = hdr.num_blocks;
|
||||||
s->frame_type = hdr.frame_type;
|
s->frame_type = hdr.frame_type;
|
||||||
s->substreamid = hdr.substreamid;
|
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) {
|
if (s->lfe_on) {
|
||||||
s->start_freq[s->lfe_ch] = 0;
|
s->start_freq[s->lfe_ch] = 0;
|
||||||
|
@ -276,7 +315,7 @@ static int parse_frame_header(AC3DecodeContext *s)
|
||||||
s->channel_in_cpl[s->lfe_ch] = 0;
|
s->channel_in_cpl[s->lfe_ch] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr.bitstream_id <= 10) {
|
if (s->bitstream_id <= 10) {
|
||||||
s->eac3 = 0;
|
s->eac3 = 0;
|
||||||
s->snr_offset_strategy = 2;
|
s->snr_offset_strategy = 2;
|
||||||
s->block_switch_syntax = 1;
|
s->block_switch_syntax = 1;
|
||||||
|
@ -491,6 +530,10 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
|
||||||
break;
|
break;
|
||||||
default: /* 6 to 15 */
|
default: /* 6 to 15 */
|
||||||
/* Shift mantissa and sign-extend it. */
|
/* 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 = get_sbits(gbc, quantization_tab[bap]);
|
||||||
mantissa <<= 24 - quantization_tab[bap];
|
mantissa <<= 24 - quantization_tab[bap];
|
||||||
break;
|
break;
|
||||||
|
@ -750,8 +793,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||||
i = !s->channel_mode;
|
i = !s->channel_mode;
|
||||||
do {
|
do {
|
||||||
if (get_bits1(gbc)) {
|
if (get_bits1(gbc)) {
|
||||||
s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)] - 1.0) *
|
/* Allow asymmetric application of DRC when drc_scale > 1.
|
||||||
s->drc_scale) + 1.0;
|
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) {
|
} else if (blk == 0) {
|
||||||
s->dynamic_range[i] = 1.0f;
|
s->dynamic_range[i] = 1.0f;
|
||||||
}
|
}
|
||||||
|
@ -1274,6 +1322,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||||
int blk, ch, err, ret;
|
int blk, ch, err, ret;
|
||||||
const uint8_t *channel_map;
|
const uint8_t *channel_map;
|
||||||
const float *output[AC3_MAX_CHANNELS];
|
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
|
/* copy input buffer to decoder context to avoid reading past the end
|
||||||
of the buffer, which can be caused by a damaged input stream. */
|
of the buffer, which can be caused by a damaged input stream. */
|
||||||
|
@ -1333,6 +1383,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||||
if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2],
|
if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2],
|
||||||
s->frame_size - 2)) {
|
s->frame_size - 2)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
|
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;
|
err = AAC_AC3_PARSE_ERROR_CRC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1350,16 +1402,15 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||||
s->output_mode = s->channel_mode;
|
s->output_mode = s->channel_mode;
|
||||||
if (s->lfe_on)
|
if (s->lfe_on)
|
||||||
s->output_mode |= AC3_OUTPUT_LFEON;
|
s->output_mode |= AC3_OUTPUT_LFEON;
|
||||||
AV_NOWARN_DEPRECATED(
|
if (s->channels > 1 &&
|
||||||
if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
|
avctx->request_channel_layout == AV_CH_LAYOUT_MONO) {
|
||||||
avctx->request_channels < s->channels) {
|
s->out_channels = 1;
|
||||||
s->out_channels = avctx->request_channels;
|
s->output_mode = AC3_CHMODE_MONO;
|
||||||
s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
|
} else if (s->channels > 2 &&
|
||||||
s->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode];
|
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
||||||
|
s->out_channels = 2;
|
||||||
|
s->output_mode = AC3_CHMODE_STEREO;
|
||||||
}
|
}
|
||||||
);
|
|
||||||
avctx->channels = s->out_channels;
|
|
||||||
avctx->channel_layout = s->channel_layout;
|
|
||||||
|
|
||||||
s->loro_center_mix_level = gain_levels[s-> center_mix_level];
|
s->loro_center_mix_level = gain_levels[s-> center_mix_level];
|
||||||
s->loro_surround_mix_level = gain_levels[s->surround_mix_level];
|
s->loro_surround_mix_level = gain_levels[s->surround_mix_level];
|
||||||
|
@ -1375,6 +1426,9 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
avctx->channels = s->out_channels;
|
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 */
|
/* set audio service type based on bitstream mode for AC-3 */
|
||||||
avctx->audio_service_type = s->bitstream_mode;
|
avctx->audio_service_type = s->bitstream_mode;
|
||||||
|
@ -1418,6 +1472,62 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||||
for (ch = 0; ch < s->out_channels; ch++)
|
for (ch = 0; ch < s->out_channels; ch++)
|
||||||
memcpy(s->output[ch], output[ch], sizeof(**output) * AC3_BLOCK_SIZE);
|
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;
|
*got_frame_ptr = 1;
|
||||||
|
|
||||||
return FFMIN(buf_size, s->frame_size);
|
return FFMIN(buf_size, s->frame_size);
|
||||||
|
@ -1438,7 +1548,7 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx)
|
||||||
#define OFFSET(x) offsetof(AC3DecodeContext, x)
|
#define OFFSET(x) offsetof(AC3DecodeContext, x)
|
||||||
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
|
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
|
||||||
static const AVOption options[] = {
|
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, 1.0, PAR },
|
{ "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"},
|
{"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_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
|
||||||
|
|
|
@ -79,14 +79,22 @@ typedef struct AC3DecodeContext {
|
||||||
int bit_rate; ///< stream bit rate, in bits-per-second
|
int bit_rate; ///< stream bit rate, in bits-per-second
|
||||||
int sample_rate; ///< sample frequency, in Hz
|
int sample_rate; ///< sample frequency, in Hz
|
||||||
int num_blocks; ///< number of audio blocks
|
int num_blocks; ///< number of audio blocks
|
||||||
|
int bitstream_id; ///< bitstream id (bsid)
|
||||||
int bitstream_mode; ///< bitstream mode (bsmod)
|
int bitstream_mode; ///< bitstream mode (bsmod)
|
||||||
int channel_mode; ///< channel mode (acmod)
|
int channel_mode; ///< channel mode (acmod)
|
||||||
int channel_layout; ///< channel layout
|
|
||||||
int lfe_on; ///< lfe channel in use
|
int lfe_on; ///< lfe channel in use
|
||||||
int channel_map; ///< custom channel map
|
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; ///< 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; ///< 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 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;
|
int preferred_stereo_downmix;
|
||||||
|
|
|
@ -239,6 +239,19 @@ static void ac3_downmix_c(float **samples, float (*matrix)[2],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
|
||||||
{
|
{
|
||||||
c->ac3_exponent_min = ac3_exponent_min_c;
|
c->ac3_exponent_min = ac3_exponent_min_c;
|
||||||
|
@ -253,6 +266,7 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
|
||||||
c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c;
|
c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c;
|
||||||
c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c;
|
c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c;
|
||||||
c->downmix = ac3_downmix_c;
|
c->downmix = ac3_downmix_c;
|
||||||
|
c->apply_window_int16 = apply_window_int16_c;
|
||||||
|
|
||||||
if (ARCH_ARM)
|
if (ARCH_ARM)
|
||||||
ff_ac3dsp_init_arm(c, bit_exact);
|
ff_ac3dsp_init_arm(c, bit_exact);
|
||||||
|
|
|
@ -134,6 +134,20 @@ typedef struct AC3DSPContext {
|
||||||
|
|
||||||
void (*downmix)(float **samples, float (*matrix)[2], int out_ch,
|
void (*downmix)(float **samples, float (*matrix)[2], int out_ch,
|
||||||
int in_ch, int len);
|
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;
|
} AC3DSPContext;
|
||||||
|
|
||||||
void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact);
|
void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact);
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
#ifndef AVCODEC_AC3TAB_H
|
#ifndef AVCODEC_AC3TAB_H
|
||||||
#define AVCODEC_AC3TAB_H
|
#define AVCODEC_AC3TAB_H
|
||||||
|
|
||||||
#include "config.h"
|
#include <stdint.h>
|
||||||
#include "libavutil/common.h"
|
|
||||||
|
#include "libavutil/internal.h"
|
||||||
#include "ac3.h"
|
#include "ac3.h"
|
||||||
|
|
||||||
#if CONFIG_HARDCODED_TABLES
|
#if CONFIG_HARDCODED_TABLES
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
byte & 0x0F, 4, 0);
|
byte & 0x0F, 4, 0);
|
||||||
}
|
}
|
||||||
} else if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_3) {
|
} else if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_3) {
|
||||||
for (n = nb_samples / 3; n > 0; n--) {
|
for (n = (nb_samples<<st) / 3; n > 0; n--) {
|
||||||
int byte = bytestream2_get_byteu(&gb);
|
int byte = bytestream2_get_byteu(&gb);
|
||||||
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
|
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
|
||||||
byte >> 5 , 3, 0);
|
byte >> 5 , 3, 0);
|
||||||
|
|
|
@ -47,7 +47,7 @@ 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 *ff_adpcm_index_tables[4] = {
|
const int8_t * const ff_adpcm_index_tables[4] = {
|
||||||
&adpcm_index_table2[0],
|
&adpcm_index_table2[0],
|
||||||
&adpcm_index_table3[0],
|
&adpcm_index_table3[0],
|
||||||
&ff_adpcm_index_table[0],
|
&ff_adpcm_index_table[0],
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
static const uint8_t ff_adpcm_ima_block_sizes[4] = { 4, 12, 4, 20 };
|
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 };
|
static const uint8_t ff_adpcm_ima_block_samples[4] = { 16, 32, 8, 32 };
|
||||||
|
|
||||||
extern const int8_t *ff_adpcm_index_tables[4];
|
extern const int8_t * const ff_adpcm_index_tables[4];
|
||||||
extern const int8_t ff_adpcm_index_table[16];
|
extern const int8_t ff_adpcm_index_table[16];
|
||||||
extern const int16_t ff_adpcm_step_table[89];
|
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_oki_step_table[49];
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
* Provide registration of all codecs, parsers and bitstream filters for libavcodec.
|
* Provide registration of all codecs, parsers and bitstream filters for libavcodec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "avcodec.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "avcodec.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define REGISTER_HWACCEL(X, x) \
|
#define REGISTER_HWACCEL(X, x) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -79,7 +80,9 @@ void avcodec_register_all(void)
|
||||||
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
|
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
|
||||||
REGISTER_HWACCEL(H264_VDA, h264_vda);
|
REGISTER_HWACCEL(H264_VDA, h264_vda);
|
||||||
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
|
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
|
||||||
|
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
|
||||||
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
|
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
|
||||||
|
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
|
||||||
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
|
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
|
||||||
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
|
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
|
||||||
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
|
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
|
||||||
|
@ -119,7 +122,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(CAVS, cavs);
|
REGISTER_DECODER(CAVS, cavs);
|
||||||
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
|
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
|
||||||
REGISTER_DECODER(CDXL, cdxl);
|
REGISTER_DECODER(CDXL, cdxl);
|
||||||
REGISTER_DECODER(CINEPAK, cinepak);
|
REGISTER_ENCDEC (CINEPAK, cinepak);
|
||||||
REGISTER_ENCDEC (CLJR, cljr);
|
REGISTER_ENCDEC (CLJR, cljr);
|
||||||
REGISTER_DECODER(CLLC, cllc);
|
REGISTER_DECODER(CLLC, cllc);
|
||||||
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
|
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
|
||||||
|
@ -147,6 +150,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(EXR, exr);
|
REGISTER_DECODER(EXR, exr);
|
||||||
REGISTER_ENCDEC (FFV1, ffv1);
|
REGISTER_ENCDEC (FFV1, ffv1);
|
||||||
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
|
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
|
||||||
|
REGISTER_DECODER(FIC, fic);
|
||||||
REGISTER_ENCDEC (FLASHSV, flashsv);
|
REGISTER_ENCDEC (FLASHSV, flashsv);
|
||||||
REGISTER_ENCDEC (FLASHSV2, flashsv2);
|
REGISTER_ENCDEC (FLASHSV2, flashsv2);
|
||||||
REGISTER_DECODER(FLIC, flic);
|
REGISTER_DECODER(FLIC, flic);
|
||||||
|
@ -164,6 +168,8 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
|
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
|
||||||
REGISTER_DECODER(H264_VDA, h264_vda);
|
REGISTER_DECODER(H264_VDA, h264_vda);
|
||||||
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
|
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
|
||||||
|
REGISTER_DECODER(HEVC, hevc);
|
||||||
|
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
|
||||||
REGISTER_ENCDEC (HUFFYUV, huffyuv);
|
REGISTER_ENCDEC (HUFFYUV, huffyuv);
|
||||||
REGISTER_DECODER(IDCIN, idcin);
|
REGISTER_DECODER(IDCIN, idcin);
|
||||||
REGISTER_DECODER(IFF_BYTERUN1, iff_byterun1);
|
REGISTER_DECODER(IFF_BYTERUN1, iff_byterun1);
|
||||||
|
@ -187,7 +193,9 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(MJPEGB, mjpegb);
|
REGISTER_DECODER(MJPEGB, mjpegb);
|
||||||
REGISTER_DECODER(MMVIDEO, mmvideo);
|
REGISTER_DECODER(MMVIDEO, mmvideo);
|
||||||
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
|
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
|
||||||
|
#if FF_API_XVMC
|
||||||
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
|
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
|
||||||
|
#endif /* FF_API_XVMC */
|
||||||
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
|
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
|
||||||
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
|
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
|
||||||
REGISTER_ENCDEC (MPEG4, mpeg4);
|
REGISTER_ENCDEC (MPEG4, mpeg4);
|
||||||
|
@ -320,6 +328,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(APE, ape);
|
REGISTER_DECODER(APE, ape);
|
||||||
REGISTER_DECODER(ATRAC1, atrac1);
|
REGISTER_DECODER(ATRAC1, atrac1);
|
||||||
REGISTER_DECODER(ATRAC3, atrac3);
|
REGISTER_DECODER(ATRAC3, atrac3);
|
||||||
|
REGISTER_DECODER(ATRAC3P, atrac3p);
|
||||||
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
|
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
|
||||||
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
|
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
|
||||||
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
|
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
|
||||||
|
@ -344,6 +353,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(MP1FLOAT, mp1float);
|
REGISTER_DECODER(MP1FLOAT, mp1float);
|
||||||
REGISTER_ENCDEC (MP2, mp2);
|
REGISTER_ENCDEC (MP2, mp2);
|
||||||
REGISTER_DECODER(MP2FLOAT, mp2float);
|
REGISTER_DECODER(MP2FLOAT, mp2float);
|
||||||
|
REGISTER_ENCODER(MP2FIXED, mp2fixed);
|
||||||
REGISTER_DECODER(MP3, mp3);
|
REGISTER_DECODER(MP3, mp3);
|
||||||
REGISTER_DECODER(MP3FLOAT, mp3float);
|
REGISTER_DECODER(MP3FLOAT, mp3float);
|
||||||
REGISTER_DECODER(MP3ADU, mp3adu);
|
REGISTER_DECODER(MP3ADU, mp3adu);
|
||||||
|
@ -431,6 +441,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
|
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
|
||||||
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
|
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
|
||||||
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
|
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
|
||||||
|
REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);
|
||||||
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
|
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
|
||||||
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
|
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
|
||||||
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
|
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
|
||||||
|
@ -501,8 +512,10 @@ void avcodec_register_all(void)
|
||||||
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
|
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
|
||||||
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
|
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
|
||||||
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
|
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
|
||||||
|
REGISTER_ENCODER(LIBWEBP, libwebp);
|
||||||
REGISTER_ENCODER(LIBX264, libx264);
|
REGISTER_ENCODER(LIBX264, libx264);
|
||||||
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
|
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
|
||||||
|
REGISTER_ENCODER(LIBX265, libx265);
|
||||||
REGISTER_ENCODER(LIBXAVS, libxavs);
|
REGISTER_ENCODER(LIBXAVS, libxavs);
|
||||||
REGISTER_ENCODER(LIBXVID, libxvid);
|
REGISTER_ENCODER(LIBXVID, libxvid);
|
||||||
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
|
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
|
||||||
|
@ -532,6 +545,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_PARSER(H261, h261);
|
REGISTER_PARSER(H261, h261);
|
||||||
REGISTER_PARSER(H263, h263);
|
REGISTER_PARSER(H263, h263);
|
||||||
REGISTER_PARSER(H264, h264);
|
REGISTER_PARSER(H264, h264);
|
||||||
|
REGISTER_PARSER(HEVC, hevc);
|
||||||
REGISTER_PARSER(MJPEG, mjpeg);
|
REGISTER_PARSER(MJPEG, mjpeg);
|
||||||
REGISTER_PARSER(MLP, mlp);
|
REGISTER_PARSER(MLP, mlp);
|
||||||
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
|
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
|
||||||
|
@ -546,6 +560,7 @@ void avcodec_register_all(void)
|
||||||
REGISTER_PARSER(VORBIS, vorbis);
|
REGISTER_PARSER(VORBIS, vorbis);
|
||||||
REGISTER_PARSER(VP3, vp3);
|
REGISTER_PARSER(VP3, vp3);
|
||||||
REGISTER_PARSER(VP8, vp8);
|
REGISTER_PARSER(VP8, vp8);
|
||||||
|
REGISTER_PARSER(VP9, vp9);
|
||||||
|
|
||||||
/* bitstream filters */
|
/* bitstream filters */
|
||||||
REGISTER_BSF(AAC_ADTSTOASC, aac_adtstoasc);
|
REGISTER_BSF(AAC_ADTSTOASC, aac_adtstoasc);
|
||||||
|
@ -555,7 +570,6 @@ void avcodec_register_all(void)
|
||||||
REGISTER_BSF(IMX_DUMP_HEADER, imx_dump_header);
|
REGISTER_BSF(IMX_DUMP_HEADER, imx_dump_header);
|
||||||
REGISTER_BSF(MJPEG2JPEG, mjpeg2jpeg);
|
REGISTER_BSF(MJPEG2JPEG, mjpeg2jpeg);
|
||||||
REGISTER_BSF(MJPEGA_DUMP_HEADER, mjpega_dump_header);
|
REGISTER_BSF(MJPEGA_DUMP_HEADER, mjpega_dump_header);
|
||||||
REGISTER_BSF(MP3_HEADER_COMPRESS, mp3_header_compress);
|
|
||||||
REGISTER_BSF(MP3_HEADER_DECOMPRESS, mp3_header_decompress);
|
REGISTER_BSF(MP3_HEADER_DECOMPRESS, mp3_header_decompress);
|
||||||
REGISTER_BSF(MOV2TEXTSUB, mov2textsub);
|
REGISTER_BSF(MOV2TEXTSUB, mov2textsub);
|
||||||
REGISTER_BSF(NOISE, noise);
|
REGISTER_BSF(NOISE, noise);
|
||||||
|
|
|
@ -605,10 +605,14 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
|
||||||
rice->ksum += out[i];
|
rice->ksum += out[i];
|
||||||
}
|
}
|
||||||
rice->k = av_log2(rice->ksum / 10) + 1;
|
rice->k = av_log2(rice->ksum / 10) + 1;
|
||||||
|
if (rice->k >= 24)
|
||||||
|
return;
|
||||||
for (; i < 64; i++) {
|
for (; i < 64; i++) {
|
||||||
out[i] = get_rice_ook(&ctx->gb, rice->k);
|
out[i] = get_rice_ook(&ctx->gb, rice->k);
|
||||||
rice->ksum += out[i];
|
rice->ksum += out[i];
|
||||||
rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
|
rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
|
||||||
|
if (rice->k >= 24)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
ksummax = 1 << (rice->k + 7);
|
ksummax = 1 << (rice->k + 7);
|
||||||
ksummin = rice->k ? (1 << (rice->k + 6)) : 0;
|
ksummin = rice->k ? (1 << (rice->k + 6)) : 0;
|
||||||
|
@ -1436,7 +1440,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
}
|
}
|
||||||
if (s->fileversion < 3950) // previous versions overread two bytes
|
if (s->fileversion < 3950) // previous versions overread two bytes
|
||||||
buf_size += 2;
|
buf_size += 2;
|
||||||
av_fast_malloc(&s->data, (unsigned int *) &s->data_size, buf_size);
|
av_fast_padded_malloc(&s->data, &s->data_size, buf_size);
|
||||||
if (!s->data)
|
if (!s->data)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
|
s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
|
||||||
|
@ -1458,7 +1462,8 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
}
|
}
|
||||||
s->ptr += offset;
|
s->ptr += offset;
|
||||||
} else {
|
} else {
|
||||||
init_get_bits(&s->gb, s->ptr, (s->data_end - s->ptr) * 8);
|
if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0)
|
||||||
|
return ret;
|
||||||
if (s->fileversion > 3800)
|
if (s->fileversion > 3800)
|
||||||
skip_bits_long(&s->gb, offset * 8);
|
skip_bits_long(&s->gb, offset * 8);
|
||||||
else
|
else
|
||||||
|
|
|
@ -116,9 +116,6 @@ typedef struct ATRAC3Context {
|
||||||
static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE];
|
static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE];
|
||||||
static VLC_TYPE atrac3_vlc_table[4096][2];
|
static VLC_TYPE atrac3_vlc_table[4096][2];
|
||||||
static VLC spectral_coeff_tab[7];
|
static VLC spectral_coeff_tab[7];
|
||||||
static float gain_tab1[16];
|
|
||||||
static float gain_tab2[31];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regular 512 points IMDCT without overlapping, with the exception of the
|
* Regular 512 points IMDCT without overlapping, with the exception of the
|
||||||
|
@ -175,7 +172,7 @@ static int decode_bytes(const uint8_t *input, uint8_t *out, int bytes)
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold void init_atrac3_window(void)
|
static av_cold void init_imdct_window(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
@ -780,7 +777,7 @@ static av_cold void atrac3_init_static_data(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
init_atrac3_window();
|
init_imdct_window();
|
||||||
ff_atrac_generate_tables();
|
ff_atrac_generate_tables();
|
||||||
|
|
||||||
/* Initialize the VLC tables. */
|
/* Initialize the VLC tables. */
|
||||||
|
@ -792,13 +789,6 @@ static av_cold void atrac3_init_static_data(void)
|
||||||
huff_bits[i], 1, 1,
|
huff_bits[i], 1, 1,
|
||||||
huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate gain tables */
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
gain_tab1[i] = exp2f (4 - i);
|
|
||||||
|
|
||||||
for (i = -15; i < 16; i++)
|
|
||||||
gain_tab2[i + 15] = exp2f (i * -0.125);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int atrac3_decode_init(AVCodecContext *avctx)
|
static av_cold int atrac3_decode_init(AVCodecContext *avctx)
|
||||||
|
|
1818
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.c
Normal file
1818
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.c
Normal file
File diff suppressed because it is too large
Load diff
240
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.h
Normal file
240
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.h
Normal file
|
@ -0,0 +1,240 @@
|
||||||
|
/*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
|
||||||
|
#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 */
|
1914
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus_data.h
Normal file
1914
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus_data.h
Normal file
File diff suppressed because it is too large
Load diff
396
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdec.c
Normal file
396
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdec.c
Normal file
|
@ -0,0 +1,396 @@
|
||||||
|
/*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#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,
|
||||||
|
};
|
638
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdsp.c
Normal file
638
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdsp.c
Normal file
|
@ -0,0 +1,638 @@
|
||||||
|
/*
|
||||||
|
* 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 <math.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,6 +57,15 @@
|
||||||
|
|
||||||
#include "version.h"
|
#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
|
* @defgroup libavc Encoding/Decoding Library
|
||||||
* @{
|
* @{
|
||||||
|
@ -120,7 +129,9 @@ enum AVCodecID {
|
||||||
/* video codecs */
|
/* video codecs */
|
||||||
AV_CODEC_ID_MPEG1VIDEO,
|
AV_CODEC_ID_MPEG1VIDEO,
|
||||||
AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
||||||
|
#if FF_API_XVMC
|
||||||
AV_CODEC_ID_MPEG2VIDEO_XVMC,
|
AV_CODEC_ID_MPEG2VIDEO_XVMC,
|
||||||
|
#endif /* FF_API_XVMC */
|
||||||
AV_CODEC_ID_H261,
|
AV_CODEC_ID_H261,
|
||||||
AV_CODEC_ID_H263,
|
AV_CODEC_ID_H263,
|
||||||
AV_CODEC_ID_RV10,
|
AV_CODEC_ID_RV10,
|
||||||
|
@ -291,6 +302,9 @@ enum AVCodecID {
|
||||||
AV_CODEC_ID_ESCAPE130_DEPRECATED,
|
AV_CODEC_ID_ESCAPE130_DEPRECATED,
|
||||||
AV_CODEC_ID_G2M_DEPRECATED,
|
AV_CODEC_ID_G2M_DEPRECATED,
|
||||||
AV_CODEC_ID_WEBP_DEPRECATED,
|
AV_CODEC_ID_WEBP_DEPRECATED,
|
||||||
|
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_BRENDER_PIX= MKBETAG('B','P','I','X'),
|
||||||
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
|
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
|
||||||
|
@ -317,7 +331,8 @@ enum AVCodecID {
|
||||||
AV_CODEC_ID_SNOW = MKBETAG('S','N','O','W'),
|
AV_CODEC_ID_SNOW = MKBETAG('S','N','O','W'),
|
||||||
AV_CODEC_ID_WEBP = MKBETAG('W','E','B','P'),
|
AV_CODEC_ID_WEBP = MKBETAG('W','E','B','P'),
|
||||||
AV_CODEC_ID_SMVJPEG = MKBETAG('S','M','V','J'),
|
AV_CODEC_ID_SMVJPEG = MKBETAG('S','M','V','J'),
|
||||||
AV_CODEC_ID_H265 = MKBETAG('H','2','6','5'),
|
AV_CODEC_ID_HEVC = MKBETAG('H','2','6','5'),
|
||||||
|
#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
|
||||||
|
|
||||||
/* various PCM "codecs" */
|
/* various PCM "codecs" */
|
||||||
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||||
|
@ -391,6 +406,7 @@ enum AVCodecID {
|
||||||
AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '),
|
AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '),
|
||||||
AV_CODEC_ID_ADPCM_DTK = MKBETAG('D','T','K',' '),
|
AV_CODEC_ID_ADPCM_DTK = MKBETAG('D','T','K',' '),
|
||||||
AV_CODEC_ID_ADPCM_IMA_RAD = MKBETAG('R','A','D',' '),
|
AV_CODEC_ID_ADPCM_IMA_RAD = MKBETAG('R','A','D',' '),
|
||||||
|
AV_CODEC_ID_ADPCM_G726LE = MKBETAG('6','2','7','G'),
|
||||||
|
|
||||||
/* AMR */
|
/* AMR */
|
||||||
AV_CODEC_ID_AMR_NB = 0x12000,
|
AV_CODEC_ID_AMR_NB = 0x12000,
|
||||||
|
@ -517,6 +533,7 @@ enum AVCodecID {
|
||||||
AV_CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'),
|
AV_CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'),
|
||||||
AV_CODEC_ID_SMPTE_KLV = MKBETAG('K','L','V','A'),
|
AV_CODEC_ID_SMPTE_KLV = MKBETAG('K','L','V','A'),
|
||||||
AV_CODEC_ID_DVD_NAV = MKBETAG('D','N','A','V'),
|
AV_CODEC_ID_DVD_NAV = MKBETAG('D','N','A','V'),
|
||||||
|
AV_CODEC_ID_TIMED_ID3 = MKBETAG('T','I','D','3'),
|
||||||
|
|
||||||
|
|
||||||
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
|
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
|
||||||
|
@ -639,16 +656,26 @@ enum AVColorPrimaries{
|
||||||
AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
|
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_SMPTE240M = 7, ///< functionally identical to above
|
||||||
AVCOL_PRI_FILM = 8,
|
AVCOL_PRI_FILM = 8,
|
||||||
|
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
|
||||||
AVCOL_PRI_NB , ///< Not part of ABI
|
AVCOL_PRI_NB , ///< Not part of ABI
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AVColorTransferCharacteristic{
|
enum AVColorTransferCharacteristic{
|
||||||
AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
|
AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
|
||||||
AVCOL_TRC_UNSPECIFIED = 2,
|
AVCOL_TRC_UNSPECIFIED = 2,
|
||||||
AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
|
AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
|
||||||
AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
|
AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
|
||||||
AVCOL_TRC_SMPTE240M = 7,
|
AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
|
||||||
AVCOL_TRC_NB , ///< Not part of ABI
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -690,7 +717,12 @@ typedef struct RcOverride{
|
||||||
float quality_factor;
|
float quality_factor;
|
||||||
} RcOverride;
|
} RcOverride;
|
||||||
|
|
||||||
|
#if FF_API_MAX_BFRAMES
|
||||||
|
/**
|
||||||
|
* @deprecated there is no libavcodec-wide limit on the number of B-frames
|
||||||
|
*/
|
||||||
#define FF_MAX_B_FRAMES 16
|
#define FF_MAX_B_FRAMES 16
|
||||||
|
#endif
|
||||||
|
|
||||||
/* encoding support
|
/* encoding support
|
||||||
These flags can be passed in AVCodecContext.flags before initialization.
|
These flags can be passed in AVCodecContext.flags before initialization.
|
||||||
|
@ -704,6 +736,7 @@ typedef struct RcOverride{
|
||||||
#define CODEC_FLAG_UNALIGNED 0x0001
|
#define CODEC_FLAG_UNALIGNED 0x0001
|
||||||
#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
|
#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_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_QPEL 0x0010 ///< Use qpel MC.
|
||||||
#define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
|
#define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
|
||||||
#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
|
#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
|
||||||
|
@ -716,7 +749,13 @@ typedef struct RcOverride{
|
||||||
#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
|
#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_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
|
||||||
#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
|
#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
|
||||||
#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
|
#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 0x8000 ///< error[?] variables will be set during encoding.
|
#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
|
#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
|
||||||
location instead of only at frame boundaries. */
|
location instead of only at frame boundaries. */
|
||||||
|
@ -754,8 +793,16 @@ typedef struct RcOverride{
|
||||||
*/
|
*/
|
||||||
#define CODEC_CAP_DR1 0x0002
|
#define CODEC_CAP_DR1 0x0002
|
||||||
#define CODEC_CAP_TRUNCATED 0x0008
|
#define CODEC_CAP_TRUNCATED 0x0008
|
||||||
/* Codec can export data for HW decoding (XvMC). */
|
#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
|
||||||
|
* pixel formats (XvMC, VDPAU, VAAPI, etc). The application can pick any of them
|
||||||
|
* including raw image format.
|
||||||
|
* The application can use the passed context to determine bitstream version,
|
||||||
|
* chroma format, resolution etc.
|
||||||
|
*/
|
||||||
#define CODEC_CAP_HWACCEL 0x0010
|
#define CODEC_CAP_HWACCEL 0x0010
|
||||||
|
#endif /* FF_API_XVMC */
|
||||||
/**
|
/**
|
||||||
* Encoder or decoder requires flushing with NULL input at the end in order to
|
* Encoder or decoder requires flushing with NULL input at the end in order to
|
||||||
* give the complete and correct output.
|
* give the complete and correct output.
|
||||||
|
@ -812,12 +859,12 @@ typedef struct RcOverride{
|
||||||
* Codec should fill in channel configuration and samplerate instead of container
|
* Codec should fill in channel configuration and samplerate instead of container
|
||||||
*/
|
*/
|
||||||
#define CODEC_CAP_CHANNEL_CONF 0x0400
|
#define CODEC_CAP_CHANNEL_CONF 0x0400
|
||||||
|
#if FF_API_NEG_LINESIZES
|
||||||
/**
|
/**
|
||||||
* Codec is able to deal with negative linesizes
|
* @deprecated no codecs use this capability
|
||||||
*/
|
*/
|
||||||
#define CODEC_CAP_NEG_LINESIZES 0x0800
|
#define CODEC_CAP_NEG_LINESIZES 0x0800
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Codec supports frame-level multithreading.
|
* Codec supports frame-level multithreading.
|
||||||
*/
|
*/
|
||||||
|
@ -847,6 +894,7 @@ typedef struct RcOverride{
|
||||||
*/
|
*/
|
||||||
#define CODEC_CAP_LOSSLESS 0x80000000
|
#define CODEC_CAP_LOSSLESS 0x80000000
|
||||||
|
|
||||||
|
#if FF_API_MB_TYPE
|
||||||
//The following defines may change, don't expect compatibility if you use them.
|
//The following defines may change, don't expect compatibility if you use them.
|
||||||
#define MB_TYPE_INTRA4x4 0x0001
|
#define MB_TYPE_INTRA4x4 0x0001
|
||||||
#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
|
#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
|
||||||
|
@ -870,6 +918,7 @@ typedef struct RcOverride{
|
||||||
#define MB_TYPE_QUANT 0x00010000
|
#define MB_TYPE_QUANT 0x00010000
|
||||||
#define MB_TYPE_CBP 0x00020000
|
#define MB_TYPE_CBP 0x00020000
|
||||||
//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
|
//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pan Scan area.
|
* Pan Scan area.
|
||||||
|
@ -900,10 +949,12 @@ typedef struct AVPanScan{
|
||||||
int16_t position[3][2];
|
int16_t position[3][2];
|
||||||
}AVPanScan;
|
}AVPanScan;
|
||||||
|
|
||||||
|
#if FF_API_QSCALE_TYPE
|
||||||
#define FF_QSCALE_TYPE_MPEG1 0
|
#define FF_QSCALE_TYPE_MPEG1 0
|
||||||
#define FF_QSCALE_TYPE_MPEG2 1
|
#define FF_QSCALE_TYPE_MPEG2 1
|
||||||
#define FF_QSCALE_TYPE_H264 2
|
#define FF_QSCALE_TYPE_H264 2
|
||||||
#define FF_QSCALE_TYPE_VP56 3
|
#define FF_QSCALE_TYPE_VP56 3
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FF_API_GET_BUFFER
|
#if FF_API_GET_BUFFER
|
||||||
#define FF_BUFFER_TYPE_INTERNAL 1
|
#define FF_BUFFER_TYPE_INTERNAL 1
|
||||||
|
@ -1026,6 +1077,13 @@ enum AVPacketSideDataType {
|
||||||
* follow the timestamp specifier of a WebVTT cue.
|
* follow the timestamp specifier of a WebVTT cue.
|
||||||
*/
|
*/
|
||||||
AV_PKT_DATA_WEBVTT_SETTINGS,
|
AV_PKT_DATA_WEBVTT_SETTINGS,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of zero terminated key/value strings. There is no end marker for
|
||||||
|
* the list, so it is required to rely on the side data size to stop. This
|
||||||
|
* side data includes updated metadata which appeared in the stream.
|
||||||
|
*/
|
||||||
|
AV_PKT_DATA_METADATA_UPDATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1336,7 +1394,9 @@ typedef struct AVCodecContext {
|
||||||
*/
|
*/
|
||||||
int coded_width, coded_height;
|
int coded_width, coded_height;
|
||||||
|
|
||||||
|
#if FF_API_ASPECT_EXTENDED
|
||||||
#define FF_ASPECT_EXTENDED 15
|
#define FF_ASPECT_EXTENDED 15
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the number of pictures in a group of pictures, or 0 for intra_only
|
* the number of pictures in a group of pictures, or 0 for intra_only
|
||||||
|
@ -1663,12 +1723,15 @@ typedef struct AVCodecContext {
|
||||||
#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
|
#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
|
||||||
#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
|
#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
|
||||||
|
|
||||||
|
#if FF_API_XVMC
|
||||||
/**
|
/**
|
||||||
* XVideo Motion Acceleration
|
* XVideo Motion Acceleration
|
||||||
* - encoding: forbidden
|
* - encoding: forbidden
|
||||||
* - decoding: set by decoder
|
* - decoding: set by decoder
|
||||||
|
* @deprecated XvMC doesn't need it anymore.
|
||||||
*/
|
*/
|
||||||
int xvmc_acceleration;
|
attribute_deprecated int xvmc_acceleration;
|
||||||
|
#endif /* FF_API_XVMC */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macroblock decision mode
|
* macroblock decision mode
|
||||||
|
@ -2115,12 +2178,11 @@ typedef struct AVCodecContext {
|
||||||
* If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
|
* If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
|
||||||
* (read and/or written to if it is writable) later by libavcodec.
|
* (read and/or written to if it is writable) later by libavcodec.
|
||||||
*
|
*
|
||||||
* If CODEC_FLAG_EMU_EDGE is not set in s->flags, the buffer must contain an
|
|
||||||
* edge of the size returned by avcodec_get_edge_width() on all sides.
|
|
||||||
*
|
|
||||||
* avcodec_align_dimensions2() should be used to find the required width and
|
* 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.
|
* height, as they normally need to be rounded up to the next multiple of 16.
|
||||||
*
|
*
|
||||||
|
* Some decoders do not support linesizes changing between frames.
|
||||||
|
*
|
||||||
* If frame multithreading is used and thread_safe_callbacks is set,
|
* If frame multithreading is used and thread_safe_callbacks is set,
|
||||||
* this callback may be called from a different thread, but not from more
|
* this callback may be called from a different thread, but not from more
|
||||||
* than one at once. Does not need to be reentrant.
|
* than one at once. Does not need to be reentrant.
|
||||||
|
@ -2403,12 +2465,16 @@ typedef struct AVCodecContext {
|
||||||
*/
|
*/
|
||||||
int workaround_bugs;
|
int workaround_bugs;
|
||||||
#define FF_BUG_AUTODETECT 1 ///< autodetection
|
#define FF_BUG_AUTODETECT 1 ///< autodetection
|
||||||
|
#if FF_API_OLD_MSMPEG4
|
||||||
#define FF_BUG_OLD_MSMPEG4 2
|
#define FF_BUG_OLD_MSMPEG4 2
|
||||||
|
#endif
|
||||||
#define FF_BUG_XVID_ILACE 4
|
#define FF_BUG_XVID_ILACE 4
|
||||||
#define FF_BUG_UMP4 8
|
#define FF_BUG_UMP4 8
|
||||||
#define FF_BUG_NO_PADDING 16
|
#define FF_BUG_NO_PADDING 16
|
||||||
#define FF_BUG_AMV 32
|
#define FF_BUG_AMV 32
|
||||||
|
#if FF_API_AC_VLC
|
||||||
#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
|
#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
|
||||||
|
#endif
|
||||||
#define FF_BUG_QPEL_CHROMA 64
|
#define FF_BUG_QPEL_CHROMA 64
|
||||||
#define FF_BUG_STD_QPEL 128
|
#define FF_BUG_STD_QPEL 128
|
||||||
#define FF_BUG_QPEL_CHROMA2 256
|
#define FF_BUG_QPEL_CHROMA2 256
|
||||||
|
@ -2458,7 +2524,12 @@ typedef struct AVCodecContext {
|
||||||
#define FF_DEBUG_BITSTREAM 4
|
#define FF_DEBUG_BITSTREAM 4
|
||||||
#define FF_DEBUG_MB_TYPE 8
|
#define FF_DEBUG_MB_TYPE 8
|
||||||
#define FF_DEBUG_QP 16
|
#define FF_DEBUG_QP 16
|
||||||
|
#if FF_API_DEBUG_MV
|
||||||
|
/**
|
||||||
|
* @deprecated this option does nothing
|
||||||
|
*/
|
||||||
#define FF_DEBUG_MV 32
|
#define FF_DEBUG_MV 32
|
||||||
|
#endif
|
||||||
#define FF_DEBUG_DCT_COEFF 0x00000040
|
#define FF_DEBUG_DCT_COEFF 0x00000040
|
||||||
#define FF_DEBUG_SKIP 0x00000080
|
#define FF_DEBUG_SKIP 0x00000080
|
||||||
#define FF_DEBUG_STARTCODE 0x00000100
|
#define FF_DEBUG_STARTCODE 0x00000100
|
||||||
|
@ -2466,13 +2537,17 @@ typedef struct AVCodecContext {
|
||||||
#define FF_DEBUG_ER 0x00000400
|
#define FF_DEBUG_ER 0x00000400
|
||||||
#define FF_DEBUG_MMCO 0x00000800
|
#define FF_DEBUG_MMCO 0x00000800
|
||||||
#define FF_DEBUG_BUGS 0x00001000
|
#define FF_DEBUG_BUGS 0x00001000
|
||||||
#define FF_DEBUG_VIS_QP 0x00002000
|
#if FF_API_DEBUG_MV
|
||||||
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
|
#define FF_DEBUG_VIS_QP 0x00002000 ///< only access through AVOptions from outside libavcodec
|
||||||
|
#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec
|
||||||
|
#endif
|
||||||
#define FF_DEBUG_BUFFERS 0x00008000
|
#define FF_DEBUG_BUFFERS 0x00008000
|
||||||
#define FF_DEBUG_THREADS 0x00010000
|
#define FF_DEBUG_THREADS 0x00010000
|
||||||
|
|
||||||
|
#if FF_API_DEBUG_MV
|
||||||
/**
|
/**
|
||||||
* debug
|
* debug
|
||||||
|
* Code outside libavcodec should access this field using AVOptions
|
||||||
* - encoding: Set by user.
|
* - encoding: Set by user.
|
||||||
* - decoding: Set by user.
|
* - decoding: Set by user.
|
||||||
*/
|
*/
|
||||||
|
@ -2480,6 +2555,7 @@ typedef struct AVCodecContext {
|
||||||
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
|
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
|
||||||
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
|
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
|
||||||
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
|
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error recognition; may misdetect some more or less valid parts as errors.
|
* Error recognition; may misdetect some more or less valid parts as errors.
|
||||||
|
@ -2487,14 +2563,21 @@ typedef struct AVCodecContext {
|
||||||
* - decoding: Set by user.
|
* - decoding: Set by user.
|
||||||
*/
|
*/
|
||||||
int err_recognition;
|
int err_recognition;
|
||||||
#define AV_EF_CRCCHECK (1<<0)
|
|
||||||
#define AV_EF_BITSTREAM (1<<1)
|
|
||||||
#define AV_EF_BUFFER (1<<2)
|
|
||||||
#define AV_EF_EXPLODE (1<<3)
|
|
||||||
|
|
||||||
#define AV_EF_CAREFUL (1<<16)
|
/**
|
||||||
#define AV_EF_COMPLIANT (1<<17)
|
* Verify checksums embedded in the bitstream (could be of either encoded or
|
||||||
#define AV_EF_AGGRESSIVE (1<<18)
|
* decoded data, depending on the codec) and print an error message on mismatch.
|
||||||
|
* If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
|
||||||
|
* decoder returning an error.
|
||||||
|
*/
|
||||||
|
#define AV_EF_CRCCHECK (1<<0)
|
||||||
|
#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations
|
||||||
|
#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_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_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2566,7 +2649,9 @@ typedef struct AVCodecContext {
|
||||||
#define FF_IDCT_SIMPLEVIS 18
|
#define FF_IDCT_SIMPLEVIS 18
|
||||||
#define FF_IDCT_FAAN 20
|
#define FF_IDCT_FAAN 20
|
||||||
#define FF_IDCT_SIMPLENEON 22
|
#define FF_IDCT_SIMPLENEON 22
|
||||||
|
#if FF_API_ARCH_ALPHA
|
||||||
#define FF_IDCT_SIMPLEALPHA 23
|
#define FF_IDCT_SIMPLEALPHA 23
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bits per sample/pixel from the demuxer (needed for huffyuv).
|
* bits per sample/pixel from the demuxer (needed for huffyuv).
|
||||||
|
@ -2596,7 +2681,7 @@ typedef struct AVCodecContext {
|
||||||
/**
|
/**
|
||||||
* the picture in the bitstream
|
* the picture in the bitstream
|
||||||
* - encoding: Set by libavcodec.
|
* - encoding: Set by libavcodec.
|
||||||
* - decoding: Set by libavcodec.
|
* - decoding: unused
|
||||||
*/
|
*/
|
||||||
AVFrame *coded_frame;
|
AVFrame *coded_frame;
|
||||||
|
|
||||||
|
@ -2668,13 +2753,13 @@ 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);
|
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
|
||||||
/**
|
/**
|
||||||
* thread opaque
|
* @deprecated this field should not be used from outside of lavc
|
||||||
* Can be used by execute() to store some per AVCodecContext stuff.
|
|
||||||
* - encoding: set by execute()
|
|
||||||
* - decoding: set by execute()
|
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
void *thread_opaque;
|
void *thread_opaque;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* noise vs. sse weight for the nsse comparsion function
|
* noise vs. sse weight for the nsse comparsion function
|
||||||
|
@ -2761,6 +2846,11 @@ typedef struct AVCodecContext {
|
||||||
#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
|
#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
|
||||||
#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
|
#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
|
||||||
|
|
||||||
|
|
||||||
|
#define FF_PROFILE_HEVC_MAIN 1
|
||||||
|
#define FF_PROFILE_HEVC_MAIN_10 2
|
||||||
|
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* level
|
* level
|
||||||
* - encoding: Set by user.
|
* - encoding: Set by user.
|
||||||
|
@ -2801,21 +2891,22 @@ typedef struct AVCodecContext {
|
||||||
uint8_t *subtitle_header;
|
uint8_t *subtitle_header;
|
||||||
int subtitle_header_size;
|
int subtitle_header_size;
|
||||||
|
|
||||||
|
#if FF_API_ERROR_RATE
|
||||||
/**
|
/**
|
||||||
* Simulates errors in the bitstream to test error concealment.
|
* @deprecated use the 'error_rate' private AVOption of the mpegvideo
|
||||||
* - encoding: Set by user.
|
* encoders
|
||||||
* - decoding: unused
|
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
int error_rate;
|
int error_rate;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_CODEC_PKT
|
||||||
/**
|
/**
|
||||||
* Current packet as passed into the decoder, to avoid having
|
* @deprecated this field is not supposed to be accessed from outside lavc
|
||||||
* to pass the packet into every function. Currently only valid
|
|
||||||
* inside lavc and get/release_buffer callbacks.
|
|
||||||
* - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
|
|
||||||
* - encoding: unused
|
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
AVPacket *pkt;
|
AVPacket *pkt;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VBV delay coded in the last frame (in periods of a 27 MHz clock).
|
* VBV delay coded in the last frame (in periods of a 27 MHz clock).
|
||||||
|
@ -2896,6 +2987,34 @@ typedef struct AVCodecContext {
|
||||||
* - encoding: unused
|
* - encoding: unused
|
||||||
*/
|
*/
|
||||||
int skip_alpha;
|
int skip_alpha;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of samples to skip after a discontinuity
|
||||||
|
* - decoding: unused
|
||||||
|
* - encoding: set by libavcodec
|
||||||
|
*/
|
||||||
|
int seek_preroll;
|
||||||
|
|
||||||
|
#if !FF_API_DEBUG_MV
|
||||||
|
/**
|
||||||
|
* debug motion vectors
|
||||||
|
* Code outside libavcodec should access this field using AVOptions
|
||||||
|
* - encoding: Set by user.
|
||||||
|
* - decoding: Set by user.
|
||||||
|
*/
|
||||||
|
int debug_mv;
|
||||||
|
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
|
||||||
|
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
|
||||||
|
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* custom intra quantization matrix
|
||||||
|
* Code outside libavcodec should access this field using av_codec_g/set_chroma_intra_matrix()
|
||||||
|
* - encoding: Set by user, can be NULL.
|
||||||
|
* - decoding: unused.
|
||||||
|
*/
|
||||||
|
uint16_t *chroma_intra_matrix;
|
||||||
} AVCodecContext;
|
} AVCodecContext;
|
||||||
|
|
||||||
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
|
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
|
||||||
|
@ -2907,6 +3026,12 @@ void av_codec_set_codec_descriptor(AVCodecContext *avctx, co
|
||||||
int av_codec_get_lowres(const AVCodecContext *avctx);
|
int av_codec_get_lowres(const AVCodecContext *avctx);
|
||||||
void av_codec_set_lowres(AVCodecContext *avctx, int val);
|
void av_codec_set_lowres(AVCodecContext *avctx, int val);
|
||||||
|
|
||||||
|
int av_codec_get_seek_preroll(const AVCodecContext *avctx);
|
||||||
|
void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
|
||||||
|
|
||||||
|
uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
|
||||||
|
void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AVProfile.
|
* AVProfile.
|
||||||
*/
|
*/
|
||||||
|
@ -3014,6 +3139,10 @@ typedef struct AVCodec {
|
||||||
void (*flush)(AVCodecContext *);
|
void (*flush)(AVCodecContext *);
|
||||||
} AVCodec;
|
} AVCodec;
|
||||||
|
|
||||||
|
int av_codec_get_max_lowres(const AVCodec *codec);
|
||||||
|
|
||||||
|
struct MpegEncContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AVHWAccel.
|
* AVHWAccel.
|
||||||
*/
|
*/
|
||||||
|
@ -3075,6 +3204,7 @@ typedef struct AVHWAccel {
|
||||||
*
|
*
|
||||||
* Meaningful slice information (codec specific) is guaranteed to
|
* Meaningful slice information (codec specific) is guaranteed to
|
||||||
* be parsed at this point. This function is mandatory.
|
* be parsed at this point. This function is mandatory.
|
||||||
|
* The only exception is XvMC, that works on MB level.
|
||||||
*
|
*
|
||||||
* @param avctx the codec context
|
* @param avctx the codec context
|
||||||
* @param buf the slice data buffer base
|
* @param buf the slice data buffer base
|
||||||
|
@ -3102,6 +3232,17 @@ typedef struct AVHWAccel {
|
||||||
* AVCodecContext.release_buffer().
|
* AVCodecContext.release_buffer().
|
||||||
*/
|
*/
|
||||||
int priv_data_size;
|
int priv_data_size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called for every Macroblock in a slice.
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
} AVHWAccel;
|
} AVHWAccel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3225,40 +3366,6 @@ void avcodec_register(AVCodec *codec);
|
||||||
*/
|
*/
|
||||||
void avcodec_register_all(void);
|
void avcodec_register_all(void);
|
||||||
|
|
||||||
|
|
||||||
#if FF_API_ALLOC_CONTEXT
|
|
||||||
/**
|
|
||||||
* Allocate an AVCodecContext and set its fields to default values. The
|
|
||||||
* resulting struct can be deallocated by simply calling av_free().
|
|
||||||
*
|
|
||||||
* @return An AVCodecContext filled with default values or NULL on failure.
|
|
||||||
* @see avcodec_get_context_defaults
|
|
||||||
*
|
|
||||||
* @deprecated use avcodec_alloc_context3()
|
|
||||||
*/
|
|
||||||
attribute_deprecated
|
|
||||||
AVCodecContext *avcodec_alloc_context(void);
|
|
||||||
|
|
||||||
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
|
|
||||||
* we WILL change its arguments and name a few times! */
|
|
||||||
attribute_deprecated
|
|
||||||
AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the fields of the given AVCodecContext to default values.
|
|
||||||
*
|
|
||||||
* @param s The AVCodecContext of which the fields should be set to default values.
|
|
||||||
* @deprecated use avcodec_get_context_defaults3
|
|
||||||
*/
|
|
||||||
attribute_deprecated
|
|
||||||
void avcodec_get_context_defaults(AVCodecContext *s);
|
|
||||||
|
|
||||||
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
|
|
||||||
* we WILL change its arguments and name a few times! */
|
|
||||||
attribute_deprecated
|
|
||||||
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate an AVCodecContext and set its fields to default values. The
|
* Allocate an AVCodecContext and set its fields to default values. The
|
||||||
* resulting struct can be deallocated by calling avcodec_close() on it followed
|
* resulting struct can be deallocated by calling avcodec_close() on it followed
|
||||||
|
@ -3324,20 +3431,21 @@ const AVClass *avcodec_get_subtitle_rect_class(void);
|
||||||
*/
|
*/
|
||||||
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
|
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
|
||||||
|
|
||||||
|
#if FF_API_AVFRAME_LAVC
|
||||||
/**
|
/**
|
||||||
* Allocate an AVFrame and set its fields to default values. The resulting
|
* @deprecated use av_frame_alloc()
|
||||||
* struct must be freed using avcodec_free_frame().
|
|
||||||
*
|
|
||||||
* @return An AVFrame filled with default values or NULL on failure.
|
|
||||||
* @see avcodec_get_frame_defaults
|
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
AVFrame *avcodec_alloc_frame(void);
|
AVFrame *avcodec_alloc_frame(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the fields of the given AVFrame to default values.
|
* Set the fields of the given AVFrame to default values.
|
||||||
*
|
*
|
||||||
* @param frame The AVFrame of which the fields should be set 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);
|
void avcodec_get_frame_defaults(AVFrame *frame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3349,41 +3457,11 @@ void avcodec_get_frame_defaults(AVFrame *frame);
|
||||||
* @warning this function does NOT free the data buffers themselves
|
* @warning this function does NOT free the data buffers themselves
|
||||||
* (it does not know how, since they might have been allocated with
|
* (it does not know how, since they might have been allocated with
|
||||||
* a custom get_buffer()).
|
* a custom get_buffer()).
|
||||||
*/
|
|
||||||
void avcodec_free_frame(AVFrame **frame);
|
|
||||||
|
|
||||||
#if FF_API_AVCODEC_OPEN
|
|
||||||
/**
|
|
||||||
* Initialize the AVCodecContext to use the given AVCodec. Prior to using this
|
|
||||||
* function the context has to be allocated.
|
|
||||||
*
|
*
|
||||||
* The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
|
* @deprecated use av_frame_free()
|
||||||
* avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
|
|
||||||
* retrieving a codec.
|
|
||||||
*
|
|
||||||
* @warning This function is not thread safe!
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* avcodec_register_all();
|
|
||||||
* codec = avcodec_find_decoder(AV_CODEC_ID_H264);
|
|
||||||
* if (!codec)
|
|
||||||
* exit(1);
|
|
||||||
*
|
|
||||||
* context = avcodec_alloc_context3(codec);
|
|
||||||
*
|
|
||||||
* if (avcodec_open(context, codec) < 0)
|
|
||||||
* exit(1);
|
|
||||||
* @endcode
|
|
||||||
*
|
|
||||||
* @param avctx The context which will be set up to use the given codec.
|
|
||||||
* @param codec The codec to use within the context.
|
|
||||||
* @return zero on success, a negative value on error
|
|
||||||
* @see avcodec_alloc_context3, avcodec_find_decoder, avcodec_find_encoder, avcodec_close
|
|
||||||
*
|
|
||||||
* @deprecated use avcodec_open2
|
|
||||||
*/
|
*/
|
||||||
attribute_deprecated
|
attribute_deprecated
|
||||||
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
|
void avcodec_free_frame(AVFrame **frame);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3575,6 +3653,24 @@ int av_packet_merge_side_data(AVPacket *pkt);
|
||||||
|
|
||||||
int av_packet_split_side_data(AVPacket *pkt);
|
int av_packet_split_side_data(AVPacket *pkt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pack a dictionary for use in side_data.
|
||||||
|
*
|
||||||
|
* @param dict The dictionary to pack.
|
||||||
|
* @param size pointer to store the size of the returned data
|
||||||
|
* @return pointer to data if successful, NULL otherwise
|
||||||
|
*/
|
||||||
|
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
|
||||||
|
/**
|
||||||
|
* Unpack a dictionary from side_data.
|
||||||
|
*
|
||||||
|
* @param data data from side_data
|
||||||
|
* @param size size of the data
|
||||||
|
* @param dict the metadata storage dictionary
|
||||||
|
* @return 0 on success, < 0 on failure
|
||||||
|
*/
|
||||||
|
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function to free all the side data stored.
|
* Convenience function to free all the side data stored.
|
||||||
|
@ -3674,14 +3770,20 @@ attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame
|
||||||
*/
|
*/
|
||||||
int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
|
int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
|
||||||
|
|
||||||
|
#if FF_API_EMU_EDGE
|
||||||
/**
|
/**
|
||||||
* Return the amount of padding in pixels which the get_buffer callback must
|
* Return the amount of padding in pixels which the get_buffer callback must
|
||||||
* provide around the edge of the image for codecs which do not have the
|
* provide around the edge of the image for codecs which do not have the
|
||||||
* CODEC_FLAG_EMU_EDGE flag.
|
* CODEC_FLAG_EMU_EDGE flag.
|
||||||
*
|
*
|
||||||
* @return Required padding in pixels.
|
* @return Required padding in pixels.
|
||||||
|
*
|
||||||
|
* @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer
|
||||||
|
* needed
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
unsigned avcodec_get_edge_width(void);
|
unsigned avcodec_get_edge_width(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify width and height values so that they will result in a memory
|
* Modify width and height values so that they will result in a memory
|
||||||
|
@ -3689,8 +3791,6 @@ unsigned avcodec_get_edge_width(void);
|
||||||
* padding.
|
* padding.
|
||||||
*
|
*
|
||||||
* May only be used if a codec with CODEC_CAP_DR1 has been opened.
|
* May only be used if a codec with CODEC_CAP_DR1 has been opened.
|
||||||
* If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
|
|
||||||
* according to avcodec_get_edge_width() before.
|
|
||||||
*/
|
*/
|
||||||
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
|
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
|
||||||
|
|
||||||
|
@ -3700,8 +3800,6 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
|
||||||
* line sizes are a multiple of the respective linesize_align[i].
|
* 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 CODEC_CAP_DR1 has been opened.
|
||||||
* If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
|
|
||||||
* according to avcodec_get_edge_width() before.
|
|
||||||
*/
|
*/
|
||||||
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||||
int linesize_align[AV_NUM_DATA_POINTERS]);
|
int linesize_align[AV_NUM_DATA_POINTERS]);
|
||||||
|
@ -3792,19 +3890,25 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s
|
||||||
* Decode the audio frame of size avpkt->size from avpkt->data into frame.
|
* Decode the audio frame of size avpkt->size from avpkt->data into frame.
|
||||||
*
|
*
|
||||||
* Some decoders may support multiple frames in a single AVPacket. Such
|
* Some decoders may support multiple frames in a single AVPacket. Such
|
||||||
* decoders would then just decode the first frame. In this case,
|
* decoders would then just decode the first frame and the return value would be
|
||||||
* avcodec_decode_audio4 has to be called again with an AVPacket containing
|
* less than the packet size. In this case, avcodec_decode_audio4 has to be
|
||||||
* the remaining data in order to decode the second frame, etc...
|
* called again with an AVPacket containing the remaining data in order to
|
||||||
* Even if no frames are returned, the packet needs to be fed to the decoder
|
* decode the second frame, etc... Even if no frames are returned, the packet
|
||||||
* with remaining data until it is completely consumed or an error occurs.
|
* 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
|
||||||
|
* 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.
|
||||||
*
|
*
|
||||||
* @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
|
* @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
|
||||||
* larger than the actual read bytes because some optimized bitstream
|
* larger than the actual read bytes because some optimized bitstream
|
||||||
* readers read 32 or 64 bits at once and could read over the end.
|
* readers read 32 or 64 bits at once and could read over the end.
|
||||||
*
|
*
|
||||||
* @note You might have to align the input buffer. The alignment requirements
|
|
||||||
* depend on the CPU and the decoder.
|
|
||||||
*
|
|
||||||
* @param avctx the codec context
|
* @param avctx the codec context
|
||||||
* @param[out] frame The AVFrame in which to store decoded audio samples.
|
* @param[out] frame The AVFrame in which to store decoded audio samples.
|
||||||
* The decoder will allocate a buffer for the decoded frame by
|
* The decoder will allocate a buffer for the decoded frame by
|
||||||
|
@ -3819,7 +3923,10 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s
|
||||||
* next call to this function or until closing or flushing the
|
* next call to this function or until closing or flushing the
|
||||||
* decoder. The caller may not write to it.
|
* decoder. The caller may not write to it.
|
||||||
* @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
|
* @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
|
||||||
* non-zero.
|
* 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
|
||||||
|
* call is guaranteed to produce a frame.
|
||||||
* @param[in] avpkt The input AVPacket containing the input buffer.
|
* @param[in] avpkt The input AVPacket containing the input buffer.
|
||||||
* At least avpkt->data and avpkt->size should be set. Some
|
* At least avpkt->data and avpkt->size should be set. Some
|
||||||
* decoders might also require additional fields to be set.
|
* decoders might also require additional fields to be set.
|
||||||
|
@ -3842,13 +3949,6 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
|
||||||
* @warning The end of the input buffer buf should be set to 0 to ensure that
|
* @warning The end of the input buffer buf should be set to 0 to ensure that
|
||||||
* no overreading happens for damaged MPEG streams.
|
* no overreading happens for damaged MPEG streams.
|
||||||
*
|
*
|
||||||
* @note You might have to align the input buffer avpkt->data.
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
|
* @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,
|
* between input and output, these need to be fed with avpkt->data=NULL,
|
||||||
* avpkt->size=0 at the end to return the remaining frames.
|
* avpkt->size=0 at the end to return the remaining frames.
|
||||||
|
@ -3891,6 +3991,14 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
||||||
* and reusing a get_buffer written for video codecs would probably perform badly
|
* and reusing a get_buffer written for video codecs would probably perform badly
|
||||||
* due to a potentially very different allocation pattern.
|
* due to a potentially very different allocation pattern.
|
||||||
*
|
*
|
||||||
|
* Some decoders (those marked with 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 subtitles. It is safe to flush even those decoders that are not
|
||||||
|
* marked with CODEC_CAP_DELAY, then no subtitles will be returned.
|
||||||
|
*
|
||||||
* @param avctx the codec context
|
* @param avctx the codec context
|
||||||
* @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be
|
* @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.
|
freed with avsubtitle_free if *got_sub_ptr is set.
|
||||||
|
@ -4655,12 +4763,20 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const en
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if FF_API_SET_DIMENSIONS
|
||||||
|
/**
|
||||||
|
* @deprecated this function is not supposed to be used from outside of lavc
|
||||||
|
*/
|
||||||
|
attribute_deprecated
|
||||||
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a string representing the codec tag codec_tag in buf.
|
* Put a string representing the codec tag codec_tag in buf.
|
||||||
*
|
*
|
||||||
|
* @param buf buffer to place codec tag in
|
||||||
* @param buf_size size in bytes of buf
|
* @param buf_size size in bytes of buf
|
||||||
|
* @param codec_tag codec tag to assign
|
||||||
* @return the length of the string that would have been generated if
|
* @return the length of the string that would have been generated if
|
||||||
* enough space had been available, excluding the trailing null
|
* enough space had been available, excluding the trailing null
|
||||||
*/
|
*/
|
||||||
|
@ -4851,27 +4967,6 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
|
||||||
|
|
||||||
/* memory */
|
/* memory */
|
||||||
|
|
||||||
/**
|
|
||||||
* Reallocate the given block if it is not large enough, otherwise do nothing.
|
|
||||||
*
|
|
||||||
* @see av_realloc
|
|
||||||
*/
|
|
||||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a buffer, reusing the given one if large enough.
|
|
||||||
*
|
|
||||||
* 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_malloc(void *ptr, unsigned int *size, size_t min_size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same behaviour av_fast_malloc but the buffer has additional
|
* Same behaviour av_fast_malloc but the buffer has additional
|
||||||
* FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
|
* FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
|
||||||
|
|
|
@ -237,6 +237,7 @@ int av_copy_packet_side_data(AVPacket *pkt, AVPacket *src)
|
||||||
pkt->side_data[i].type = src->side_data[i].type;
|
pkt->side_data[i].type = src->side_data[i].type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pkt->side_data_elems = src->side_data_elems;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
failed_alloc:
|
failed_alloc:
|
||||||
|
@ -380,7 +381,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
int av_packet_split_side_data(AVPacket *pkt){
|
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){
|
if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){
|
||||||
int i;
|
int i;
|
||||||
unsigned int size, orig_pktsize = pkt->size;
|
unsigned int size;
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
p = pkt->data + pkt->size - 8 - 5;
|
p = pkt->data + pkt->size - 8 - 5;
|
||||||
|
@ -401,7 +402,7 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||||
for (i=0; ; i++){
|
for (i=0; ; i++){
|
||||||
size= AV_RB32(p);
|
size= AV_RB32(p);
|
||||||
av_assert0(size<=INT_MAX && p - pkt->data >= size);
|
av_assert0(size<=INT_MAX && p - pkt->data >= size);
|
||||||
pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
pkt->side_data[i].size = size;
|
pkt->side_data[i].size = size;
|
||||||
pkt->side_data[i].type = p[4]&127;
|
pkt->side_data[i].type = p[4]&127;
|
||||||
if (!pkt->side_data[i].data)
|
if (!pkt->side_data[i].data)
|
||||||
|
@ -413,19 +414,72 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||||
p-= size+5;
|
p-= size+5;
|
||||||
}
|
}
|
||||||
pkt->size -= 8;
|
pkt->size -= 8;
|
||||||
/* 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(pkt->data + pkt->size, 0,
|
|
||||||
FFMIN(orig_pktsize - pkt->size, FF_INPUT_BUFFER_PADDING_SIZE));
|
|
||||||
pkt->side_data_elems = i+1;
|
pkt->side_data_elems = i+1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
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 av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||||
int size)
|
int size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,8 +112,11 @@ static int alloc_table(VLC *vlc, int size, int use_static)
|
||||||
abort(); // cannot do anything, init_vlc() is used with too little memory
|
abort(); // cannot do anything, init_vlc() is used with too little memory
|
||||||
vlc->table_allocated += (1 << vlc->bits);
|
vlc->table_allocated += (1 << vlc->bits);
|
||||||
vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2);
|
vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2);
|
||||||
if (!vlc->table)
|
if (!vlc->table) {
|
||||||
|
vlc->table_allocated = 0;
|
||||||
|
vlc->table_size = 0;
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +232,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||||
/* note: realloc has been done, so reload tables */
|
/* note: realloc has been done, so reload tables */
|
||||||
table = &vlc->table[table_index];
|
table = &vlc->table[table_index];
|
||||||
table[j][0] = index; //code
|
table[j][0] = index; //code
|
||||||
|
av_assert0(table[j][0] == index);
|
||||||
i = k-1;
|
i = k-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "avcodec.h"
|
|
||||||
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
|
#include "avcodec.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static const AVCodecDescriptor codec_descriptors[] = {
|
static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
/* video codecs */
|
/* video codecs */
|
||||||
|
@ -42,6 +42,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
|
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
|
||||||
.props = AV_CODEC_PROP_LOSSY,
|
.props = AV_CODEC_PROP_LOSSY,
|
||||||
},
|
},
|
||||||
|
#if FF_API_XVMC
|
||||||
{
|
{
|
||||||
.id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
|
.id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
|
@ -49,6 +50,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
|
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
|
||||||
.props = AV_CODEC_PROP_LOSSY,
|
.props = AV_CODEC_PROP_LOSSY,
|
||||||
},
|
},
|
||||||
|
#endif /* FF_API_XVMC */
|
||||||
{
|
{
|
||||||
.id = AV_CODEC_ID_H261,
|
.id = AV_CODEC_ID_H261,
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
|
@ -225,13 +227,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
|
.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,
|
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.id = AV_CODEC_ID_H265,
|
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
|
||||||
.name = "h265",
|
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("H.265 / HEVC"),
|
|
||||||
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.id = AV_CODEC_ID_INDEO3,
|
.id = AV_CODEC_ID_INDEO3,
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
|
@ -1394,6 +1389,27 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
|
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
|
||||||
AV_CODEC_PROP_LOSSLESS,
|
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" */
|
/* various PCM "codecs" */
|
||||||
{
|
{
|
||||||
|
@ -1853,6 +1869,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Radical"),
|
.long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Radical"),
|
||||||
.props = AV_CODEC_PROP_LOSSY,
|
.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 */
|
/* AMR */
|
||||||
{
|
{
|
||||||
|
@ -2606,6 +2629,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
||||||
.name = "dvd_nav_packet",
|
.name = "dvd_nav_packet",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("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"),
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "put_bits.h"
|
#include "libavutil/error.h"
|
||||||
|
|
||||||
#include "dca.h"
|
#include "dca.h"
|
||||||
|
#include "put_bits.h"
|
||||||
|
|
||||||
const uint32_t avpriv_dca_sample_rates[16] =
|
const uint32_t avpriv_dca_sample_rates[16] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -7305,224 +7305,222 @@ DECLARE_ALIGNED(16, static const float, fir_32bands_nonperfect)[] =
|
||||||
+1.390191784E-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)[] =
|
DECLARE_ALIGNED(16, static const float, lfe_fir_64)[] =
|
||||||
{
|
{
|
||||||
2.658434386830777e-4, 9.029330685734748e-3,
|
SCALE(2.658434386830777e-4), SCALE(9.029330685734748e-3),
|
||||||
7.939263433218002e-2, 2.425158768892288e-1,
|
SCALE(7.939263433218002e-2), SCALE(2.425158768892288e-1),
|
||||||
3.430179357528686e-1, 2.398228943347931e-1,
|
SCALE(3.430179357528686e-1), SCALE(2.398228943347931e-1),
|
||||||
7.746443897485733e-2, 8.622321300208569e-3,
|
SCALE(7.746443897485733e-2), SCALE(8.622321300208569e-3),
|
||||||
8.179365249816328e-5, 9.450953453779220e-3,
|
SCALE(8.179365249816328e-5), SCALE(9.450953453779220e-3),
|
||||||
8.134882897138596e-2, 2.451938837766648e-1,
|
SCALE(8.134882897138596e-2), SCALE(2.451938837766648e-1),
|
||||||
3.429597318172455e-1, 2.371159791946411e-1,
|
SCALE(3.429597318172455e-1), SCALE(2.371159791946411e-1),
|
||||||
7.556436210870743e-2, 8.229630999267101e-3,
|
SCALE(7.556436210870743e-2), SCALE(8.229630999267101e-3),
|
||||||
9.439323912374676e-5, 9.887560270726680e-3,
|
SCALE(9.439323912374676e-5), SCALE(9.887560270726680e-3),
|
||||||
8.333285897970200e-2, 2.478559017181396e-1,
|
SCALE(8.333285897970200e-2), SCALE(2.478559017181396e-1),
|
||||||
3.428434133529663e-1, 2.343961596488952e-1,
|
SCALE(3.428434133529663e-1), SCALE(2.343961596488952e-1),
|
||||||
7.369252294301987e-2, 7.850865833461285e-3,
|
SCALE(7.369252294301987e-2), SCALE(7.850865833461285e-3),
|
||||||
1.082170274457894e-4, 1.033949479460716e-2,
|
SCALE(1.082170274457894e-4), SCALE(1.033949479460716e-2),
|
||||||
8.534456789493561e-2, 2.505008876323700e-1,
|
SCALE(8.534456789493561e-2), SCALE(2.505008876323700e-1),
|
||||||
3.426689505577088e-1, 2.316644787788391e-1,
|
SCALE(3.426689505577088e-1), SCALE(2.316644787788391e-1),
|
||||||
7.184901088476181e-2, 7.485736627131701e-3,
|
SCALE(7.184901088476181e-2), SCALE(7.485736627131701e-3),
|
||||||
1.233371440321207e-4, 1.080708485096693e-2,
|
SCALE(1.233371440321207e-4), SCALE(1.080708485096693e-2),
|
||||||
8.738376945257187e-2, 2.531278133392334e-1,
|
SCALE(8.738376945257187e-2), SCALE(2.531278133392334e-1),
|
||||||
3.424364924430847e-1, 2.289219647645950e-1,
|
SCALE(3.424364924430847e-1), SCALE(2.289219647645950e-1),
|
||||||
7.003392279148102e-2, 7.133882027119398e-3,
|
SCALE(7.003392279148102e-2), SCALE(7.133882027119398e-3),
|
||||||
1.397485757479444e-4, 1.129068247973919e-2,
|
SCALE(1.397485757479444e-4), SCALE(1.129068247973919e-2),
|
||||||
8.945026248693466e-2, 2.557355761528015e-1,
|
SCALE(8.945026248693466e-2), SCALE(2.557355761528015e-1),
|
||||||
3.421461284160614e-1, 2.261696159839630e-1,
|
SCALE(3.421461284160614e-1), SCALE(2.261696159839630e-1),
|
||||||
6.824731826782227e-2, 6.794991903007030e-3,
|
SCALE(6.824731826782227e-2), SCALE(6.794991903007030e-3),
|
||||||
1.575958012836054e-4, 1.179065089672804e-2,
|
SCALE(1.575958012836054e-4), SCALE(1.179065089672804e-2),
|
||||||
9.154383838176728e-2, 2.583232223987580e-1,
|
SCALE(9.154383838176728e-2), SCALE(2.583232223987580e-1),
|
||||||
3.417979776859284e-1, 2.234084606170654e-1,
|
SCALE(3.417979776859284e-1), SCALE(2.234084606170654e-1),
|
||||||
6.648923456668854e-2, 6.468691397458315e-3,
|
SCALE(6.648923456668854e-2), SCALE(6.468691397458315e-3),
|
||||||
1.769922382663936e-4, 1.230732165277004e-2,
|
SCALE(1.769922382663936e-4), SCALE(1.230732165277004e-2),
|
||||||
9.366425126791000e-2, 2.608896791934967e-1,
|
SCALE(9.366425126791000e-2), SCALE(2.608896791934967e-1),
|
||||||
3.413922190666198e-1, 2.206395119428635e-1,
|
SCALE(3.413922190666198e-1), SCALE(2.206395119428635e-1),
|
||||||
6.475970894098282e-2, 6.154712289571762e-3,
|
SCALE(6.475970894098282e-2), SCALE(6.154712289571762e-3),
|
||||||
1.981738605536520e-4, 1.284105982631445e-2,
|
SCALE(1.981738605536520e-4), SCALE(1.284105982631445e-2),
|
||||||
9.581124037504196e-2, 2.634339034557342e-1,
|
SCALE(9.581124037504196e-2), SCALE(2.634339034557342e-1),
|
||||||
3.409290313720703e-1, 2.178637981414795e-1,
|
SCALE(3.409290313720703e-1), SCALE(2.178637981414795e-1),
|
||||||
6.305878609418869e-2, 5.852684378623962e-3,
|
SCALE(6.305878609418869e-2), SCALE(5.852684378623962e-3),
|
||||||
2.211847313446924e-4, 1.339218579232693e-2,
|
SCALE(2.211847313446924e-4), SCALE(1.339218579232693e-2),
|
||||||
9.798453748226166e-2, 2.659549415111542e-1,
|
SCALE(9.798453748226166e-2), SCALE(2.659549415111542e-1),
|
||||||
3.404086530208588e-1, 2.150822728872299e-1,
|
SCALE(3.404086530208588e-1), SCALE(2.150822728872299e-1),
|
||||||
6.138643622398376e-2, 5.562345497310162e-3,
|
SCALE(6.138643622398376e-2), SCALE(5.562345497310162e-3),
|
||||||
2.460231189616024e-4, 1.396108977496624e-2,
|
SCALE(2.460231189616024e-4), SCALE(1.396108977496624e-2),
|
||||||
1.001838669180870e-1, 2.684516608715058e-1,
|
SCALE(1.001838669180870e-1), SCALE(2.684516608715058e-1),
|
||||||
3.398312926292420e-1, 2.122959494590759e-1,
|
SCALE(3.398312926292420e-1), SCALE(2.122959494590759e-1),
|
||||||
5.974265560507774e-2, 5.283284001052380e-3,
|
SCALE(5.974265560507774e-2), SCALE(5.283284001052380e-3),
|
||||||
2.726115926634520e-4, 1.454808749258518e-2,
|
SCALE(2.726115926634520e-4), SCALE(1.454808749258518e-2),
|
||||||
1.024089083075523e-1, 2.709231376647949e-1,
|
SCALE(1.024089083075523e-1), SCALE(2.709231376647949e-1),
|
||||||
3.391972482204438e-1, 2.095058411359787e-1,
|
SCALE(3.391972482204438e-1), SCALE(2.095058411359787e-1),
|
||||||
5.812742188572884e-2, 5.015311297029257e-3,
|
SCALE(5.812742188572884e-2), SCALE(5.015311297029257e-3),
|
||||||
3.013863170053810e-4, 1.515355054289102e-2,
|
SCALE(3.013863170053810e-4), SCALE(1.515355054289102e-2),
|
||||||
1.046593263745308e-1, 2.733682692050934e-1,
|
SCALE(1.046593263745308e-1), SCALE(2.733682692050934e-1),
|
||||||
3.385068178176880e-1, 2.067128717899322e-1,
|
SCALE(3.385068178176880e-1), SCALE(2.067128717899322e-1),
|
||||||
5.654069408774376e-2, 4.758012015372515e-3,
|
SCALE(5.654069408774376e-2), SCALE(4.758012015372515e-3),
|
||||||
3.328395541757345e-4, 1.577781140804291e-2,
|
SCALE(3.328395541757345e-4), SCALE(1.577781140804291e-2),
|
||||||
1.069347932934761e-1, 2.757860720157624e-1,
|
SCALE(1.069347932934761e-1), SCALE(2.757860720157624e-1),
|
||||||
3.377602994441986e-1, 2.039180546998978e-1,
|
SCALE(3.377602994441986e-1), SCALE(2.039180546998978e-1),
|
||||||
5.498242005705833e-2, 4.511159844696522e-3,
|
SCALE(5.498242005705833e-2), SCALE(4.511159844696522e-3),
|
||||||
3.658991190604866e-4, 1.642123050987720e-2,
|
SCALE(3.658991190604866e-4), SCALE(1.642123050987720e-2),
|
||||||
1.092349365353584e-1, 2.781755328178406e-1,
|
SCALE(1.092349365353584e-1), SCALE(2.781755328178406e-1),
|
||||||
3.369580209255218e-1, 2.011223286390304e-1,
|
SCALE(3.369580209255218e-1), SCALE(2.011223286390304e-1),
|
||||||
5.345252528786659e-2, 4.274417180567980e-3,
|
SCALE(5.345252528786659e-2), SCALE(4.274417180567980e-3),
|
||||||
4.018281470052898e-4, 1.708412915468216e-2,
|
SCALE(4.018281470052898e-4), SCALE(1.708412915468216e-2),
|
||||||
1.115593686699867e-1, 2.805356979370117e-1,
|
SCALE(1.115593686699867e-1), SCALE(2.805356979370117e-1),
|
||||||
3.361004292964936e-1, 1.983266174793244e-1,
|
SCALE(3.361004292964936e-1), SCALE(1.983266174793244e-1),
|
||||||
5.195093154907227e-2, 4.047499038279056e-3,
|
SCALE(5.195093154907227e-2), SCALE(4.047499038279056e-3),
|
||||||
4.401875485200435e-4, 1.776690222322941e-2,
|
SCALE(4.401875485200435e-4), SCALE(1.776690222322941e-2),
|
||||||
1.139076948165894e-1, 2.828655838966370e-1,
|
SCALE(1.139076948165894e-1), SCALE(2.828655838966370e-1),
|
||||||
3.351879119873047e-1, 1.955319195985794e-1,
|
SCALE(3.351879119873047e-1), SCALE(1.955319195985794e-1),
|
||||||
5.047753453254700e-2, 3.830091329291463e-3,
|
SCALE(5.047753453254700e-2), SCALE(3.830091329291463e-3),
|
||||||
4.812776169274002e-4, 1.846982724964619e-2,
|
SCALE(4.812776169274002e-4), SCALE(1.846982724964619e-2),
|
||||||
1.162794977426529e-1, 2.851640880107880e-1,
|
SCALE(1.162794977426529e-1), SCALE(2.851640880107880e-1),
|
||||||
3.342207968235016e-1, 1.927391141653061e-1,
|
SCALE(3.342207968235016e-1), SCALE(1.927391141653061e-1),
|
||||||
4.903224110603333e-2, 3.621967276558280e-3,
|
SCALE(4.903224110603333e-2), SCALE(3.621967276558280e-3),
|
||||||
5.252459668554366e-4, 1.919330470263958e-2,
|
SCALE(5.252459668554366e-4), SCALE(1.919330470263958e-2),
|
||||||
1.186743453145027e-1, 2.874303460121155e-1,
|
SCALE(1.186743453145027e-1), SCALE(2.874303460121155e-1),
|
||||||
3.331996202468872e-1, 1.899491697549820e-1,
|
SCALE(3.331996202468872e-1), SCALE(1.899491697549820e-1),
|
||||||
4.761491715908051e-2, 3.422776935622096e-3,
|
SCALE(4.761491715908051e-2), SCALE(3.422776935622096e-3),
|
||||||
5.721592460758984e-4, 1.993762329220772e-2,
|
SCALE(5.721592460758984e-4), SCALE(1.993762329220772e-2),
|
||||||
1.210917681455612e-1, 2.896633744239807e-1,
|
SCALE(1.210917681455612e-1), SCALE(2.896633744239807e-1),
|
||||||
3.321248590946198e-1, 1.871629506349564e-1,
|
SCALE(3.321248590946198e-1), SCALE(1.871629506349564e-1),
|
||||||
4.622544348239899e-2, 3.232272574678064e-3,
|
SCALE(4.622544348239899e-2), SCALE(3.232272574678064e-3),
|
||||||
6.222130032256246e-4, 2.070316113531590e-2,
|
SCALE(6.222130032256246e-4), SCALE(2.070316113531590e-2),
|
||||||
1.235313042998314e-1, 2.918621897697448e-1,
|
SCALE(1.235313042998314e-1), SCALE(2.918621897697448e-1),
|
||||||
3.309969604015350e-1, 1.843813359737396e-1,
|
SCALE(3.309969604015350e-1), SCALE(1.843813359737396e-1),
|
||||||
4.486365616321564e-2, 3.050152910873294e-3,
|
SCALE(4.486365616321564e-2), SCALE(3.050152910873294e-3),
|
||||||
6.755515350960195e-4, 2.149021252989769e-2,
|
SCALE(6.755515350960195e-4), SCALE(2.149021252989769e-2),
|
||||||
1.259924471378326e-1, 2.940258979797364e-1,
|
SCALE(1.259924471378326e-1), SCALE(2.940258979797364e-1),
|
||||||
3.298164308071136e-1, 1.816052496433258e-1,
|
SCALE(3.298164308071136e-1), SCALE(1.816052496433258e-1),
|
||||||
4.352942481637001e-2, 2.876190468668938e-3,
|
SCALE(4.352942481637001e-2), SCALE(2.876190468668938e-3),
|
||||||
7.324148900806904e-4, 2.229913882911205e-2,
|
SCALE(7.324148900806904e-4), SCALE(2.229913882911205e-2),
|
||||||
1.284746825695038e-1, 2.961534857749939e-1,
|
SCALE(1.284746825695038e-1), SCALE(2.961534857749939e-1),
|
||||||
3.285838961601258e-1, 1.788355410099030e-1,
|
SCALE(3.285838961601258e-1), SCALE(1.788355410099030e-1),
|
||||||
4.222255200147629e-2, 2.710093278437853e-3,
|
SCALE(4.222255200147629e-2), SCALE(2.710093278437853e-3),
|
||||||
7.928516715764999e-4, 2.313023805618286e-2,
|
SCALE(7.928516715764999e-4), SCALE(2.313023805618286e-2),
|
||||||
1.309774816036224e-1, 2.982441186904907e-1,
|
SCALE(1.309774816036224e-1), SCALE(2.982441186904907e-1),
|
||||||
3.272998929023742e-1, 1.760730892419815e-1,
|
SCALE(3.272998929023742e-1), SCALE(1.760730892419815e-1),
|
||||||
4.094288870692253e-2, 2.551567042246461e-3,
|
SCALE(4.094288870692253e-2), SCALE(2.551567042246461e-3),
|
||||||
8.570110658183694e-4, 2.398385666310787e-2,
|
SCALE(8.570110658183694e-4), SCALE(2.398385666310787e-2),
|
||||||
1.335003077983856e-1, 3.002967536449432e-1,
|
SCALE(1.335003077983856e-1), SCALE(3.002967536449432e-1),
|
||||||
3.259649574756622e-1, 1.733186990022659e-1,
|
SCALE(3.259649574756622e-1), SCALE(1.733186990022659e-1),
|
||||||
3.969023004174232e-2, 2.400433411821723e-3,
|
SCALE(3.969023004174232e-2), SCALE(2.400433411821723e-3),
|
||||||
9.251192095689476e-4, 2.486028522253036e-2,
|
SCALE(9.251192095689476e-4), SCALE(2.486028522253036e-2),
|
||||||
1.360425949096680e-1, 3.023106753826142e-1,
|
SCALE(1.360425949096680e-1), SCALE(3.023106753826142e-1),
|
||||||
3.245797157287598e-1, 1.705732345581055e-1,
|
SCALE(3.245797157287598e-1), SCALE(1.705732345581055e-1),
|
||||||
3.846437484025955e-2, 2.256359672173858e-3,
|
SCALE(3.846437484025955e-2), SCALE(2.256359672173858e-3),
|
||||||
9.974770946428180e-4, 2.575986087322235e-2,
|
SCALE(9.974770946428180e-4), SCALE(2.575986087322235e-2),
|
||||||
1.386037617921829e-1, 3.042849004268646e-1,
|
SCALE(1.386037617921829e-1), SCALE(3.042849004268646e-1),
|
||||||
3.231448531150818e-1, 1.678375005722046e-1,
|
SCALE(3.231448531150818e-1), SCALE(1.678375005722046e-1),
|
||||||
3.726511076092720e-2, 2.119151875376701e-3,
|
SCALE(3.726511076092720e-2), SCALE(2.119151875376701e-3),
|
||||||
1.073930296115577e-3, 2.668286114931106e-2,
|
SCALE(1.073930296115577e-3), SCALE(2.668286114931106e-2),
|
||||||
1.411831974983215e-1, 3.062185347080230e-1,
|
SCALE(1.411831974983215e-1), SCALE(3.062185347080230e-1),
|
||||||
3.216609656810760e-1, 1.651122719049454e-1,
|
SCALE(3.216609656810760e-1), SCALE(1.651122719049454e-1),
|
||||||
3.609224036335945e-2, 1.988604199141264e-3,
|
SCALE(3.609224036335945e-2), SCALE(1.988604199141264e-3),
|
||||||
1.155023579485714e-3, 2.762960828840732e-2,
|
SCALE(1.155023579485714e-3), SCALE(2.762960828840732e-2),
|
||||||
1.437802612781525e-1, 3.081108033657074e-1,
|
SCALE(1.437802612781525e-1), SCALE(3.081108033657074e-1),
|
||||||
3.201287388801574e-1, 1.623983532190323e-1,
|
SCALE(3.201287388801574e-1), SCALE(1.623983532190323e-1),
|
||||||
3.494550660252571e-2, 1.864377525635064e-3,
|
SCALE(3.494550660252571e-2), SCALE(1.864377525635064e-3),
|
||||||
1.240676851011813e-3, 2.860039286315441e-2,
|
SCALE(1.240676851011813e-3), SCALE(2.860039286315441e-2),
|
||||||
1.463943719863892e-1, 3.099608123302460e-1,
|
SCALE(1.463943719863892e-1), SCALE(3.099608123302460e-1),
|
||||||
3.185488879680634e-1, 1.596965193748474e-1,
|
SCALE(3.185488879680634e-1), SCALE(1.596965193748474e-1),
|
||||||
3.382468968629837e-2, 1.746327499859035e-3,
|
SCALE(3.382468968629837e-2), SCALE(1.746327499859035e-3),
|
||||||
1.331258914433420e-3, 2.959549613296986e-2,
|
SCALE(1.331258914433420e-3), SCALE(2.959549613296986e-2),
|
||||||
1.490248143672943e-1, 3.117676973342896e-1,
|
SCALE(1.490248143672943e-1), SCALE(3.117676973342896e-1),
|
||||||
3.169221282005310e-1, 1.570075154304504e-1,
|
SCALE(3.169221282005310e-1), SCALE(1.570075154304504e-1),
|
||||||
3.272953629493714e-2, 1.634211512282491e-3,
|
SCALE(3.272953629493714e-2), SCALE(1.634211512282491e-3),
|
||||||
1.426893868483603e-3, 3.061520494520664e-2,
|
SCALE(1.426893868483603e-3), SCALE(3.061520494520664e-2),
|
||||||
1.516709625720978e-1, 3.135308027267456e-1,
|
SCALE(1.516709625720978e-1), SCALE(3.135308027267456e-1),
|
||||||
3.152491748332978e-1, 1.543320864439010e-1,
|
SCALE(3.152491748332978e-1), SCALE(1.543320864439010e-1),
|
||||||
3.165979683399200e-2, 1.527829794213176e-3,
|
SCALE(3.165979683399200e-2), SCALE(1.527829794213176e-3),
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] =
|
DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] =
|
||||||
{
|
{
|
||||||
0.00053168571, 0.15878495574, 0.68603444099, 0.15492856503,
|
SCALE(0.00053168571), SCALE(0.15878495574), SCALE(0.68603444099), SCALE(0.15492856503),
|
||||||
0.00016358691, 0.16269733012, 0.68591803312, 0.15112841129,
|
SCALE(0.00016358691), SCALE(0.16269733012), SCALE(0.68591803312), SCALE(0.15112841129),
|
||||||
0.00018878609, 0.16666537523, 0.68568539619, 0.14738474786,
|
SCALE(0.00018878609), SCALE(0.16666537523), SCALE(0.68568539619), SCALE(0.14738474786),
|
||||||
0.00021643363, 0.17068879306, 0.68533653021, 0.14369773865,
|
SCALE(0.00021643363), SCALE(0.17068879306), SCALE(0.68533653021), SCALE(0.14369773865),
|
||||||
0.00024667382, 0.17476719618, 0.68487155437, 0.14006754756,
|
SCALE(0.00024667382), SCALE(0.17476719618), SCALE(0.68487155437), SCALE(0.14006754756),
|
||||||
0.00027949660, 0.17890018225, 0.68429082632, 0.13649433851,
|
SCALE(0.00027949660), SCALE(0.17890018225), SCALE(0.68429082632), SCALE(0.13649433851),
|
||||||
0.00031519096, 0.18308731914, 0.68359452486, 0.13297818601,
|
SCALE(0.00031519096), SCALE(0.18308731914), SCALE(0.68359452486), SCALE(0.13297818601),
|
||||||
0.00035398375, 0.18732811511, 0.68278300762, 0.12951917946,
|
SCALE(0.00035398375), SCALE(0.18732811511), SCALE(0.68278300762), SCALE(0.12951917946),
|
||||||
0.00039634691, 0.19162209332, 0.68185669184, 0.12611730397,
|
SCALE(0.00039634691), SCALE(0.19162209332), SCALE(0.68185669184), SCALE(0.12611730397),
|
||||||
0.00044236859, 0.19596865773, 0.68081587553, 0.12277261168,
|
SCALE(0.00044236859), SCALE(0.19596865773), SCALE(0.68081587553), SCALE(0.12277261168),
|
||||||
0.00049204525, 0.20036731660, 0.67966115475, 0.11948505789,
|
SCALE(0.00049204525), SCALE(0.20036731660), SCALE(0.67966115475), SCALE(0.11948505789),
|
||||||
0.00054522208, 0.20481738448, 0.67839306593, 0.11625462025,
|
SCALE(0.00054522208), SCALE(0.20481738448), SCALE(0.67839306593), SCALE(0.11625462025),
|
||||||
0.00060277141, 0.20931822062, 0.67701220512, 0.11308115721,
|
SCALE(0.00060277141), SCALE(0.20931822062), SCALE(0.67701220512), SCALE(0.11308115721),
|
||||||
0.00066567765, 0.21386915445, 0.67551922798, 0.10996460915,
|
SCALE(0.00066567765), SCALE(0.21386915445), SCALE(0.67551922798), SCALE(0.10996460915),
|
||||||
0.00073179678, 0.21846942604, 0.67391467094, 0.10690483451,
|
SCALE(0.00073179678), SCALE(0.21846942604), SCALE(0.67391467094), SCALE(0.10690483451),
|
||||||
0.00080365466, 0.22311829031, 0.67219948769, 0.10390164703,
|
SCALE(0.00080365466), SCALE(0.22311829031), SCALE(0.67219948769), SCALE(0.10390164703),
|
||||||
0.00088037323, 0.22781492770, 0.67037439346, 0.10095486045,
|
SCALE(0.00088037323), SCALE(0.22781492770), SCALE(0.67037439346), SCALE(0.10095486045),
|
||||||
0.00096255314, 0.23255851865, 0.66844022274, 0.09806428105,
|
SCALE(0.00096255314), SCALE(0.23255851865), SCALE(0.66844022274), SCALE(0.09806428105),
|
||||||
0.00105048984, 0.23734821379, 0.66639786959, 0.09522963315,
|
SCALE(0.00105048984), SCALE(0.23734821379), SCALE(0.66639786959), SCALE(0.09522963315),
|
||||||
0.00114431616, 0.24218304455, 0.66424828768, 0.09245070815,
|
SCALE(0.00114431616), SCALE(0.24218304455), SCALE(0.66424828768), SCALE(0.09245070815),
|
||||||
0.00124442333, 0.24706205726, 0.66199249029, 0.08972713351,
|
SCALE(0.00124442333), SCALE(0.24706205726), SCALE(0.66199249029), SCALE(0.08972713351),
|
||||||
0.00135110028, 0.25198432803, 0.65963155031, 0.08705867827,
|
SCALE(0.00135110028), SCALE(0.25198432803), SCALE(0.65963155031), SCALE(0.08705867827),
|
||||||
0.00146482687, 0.25694879889, 0.65716648102, 0.08444493264,
|
SCALE(0.00146482687), SCALE(0.25694879889), SCALE(0.65716648102), SCALE(0.08444493264),
|
||||||
0.00158570008, 0.26195442677, 0.65459835529, 0.08188561350,
|
SCALE(0.00158570008), SCALE(0.26195442677), SCALE(0.65459835529), SCALE(0.08188561350),
|
||||||
0.00171401864, 0.26700007915, 0.65192854404, 0.07938029617,
|
SCALE(0.00171401864), SCALE(0.26700007915), SCALE(0.65192854404), SCALE(0.07938029617),
|
||||||
0.00185023469, 0.27208462358, 0.64915806055, 0.07692859322,
|
SCALE(0.00185023469), SCALE(0.27208462358), SCALE(0.64915806055), SCALE(0.07692859322),
|
||||||
0.00199495023, 0.27720692754, 0.64628833532, 0.07453006506,
|
SCALE(0.00199495023), SCALE(0.27720692754), SCALE(0.64628833532), SCALE(0.07453006506),
|
||||||
0.00214785640, 0.28236576915, 0.64332056046, 0.07218432426,
|
SCALE(0.00214785640), SCALE(0.28236576915), SCALE(0.64332056046), SCALE(0.07218432426),
|
||||||
0.00231004250, 0.28755992651, 0.64025616646, 0.06989086419,
|
SCALE(0.00231004250), SCALE(0.28755992651), SCALE(0.64025616646), SCALE(0.06989086419),
|
||||||
0.00248134881, 0.29278811812, 0.63709646463, 0.06764923781,
|
SCALE(0.00248134881), SCALE(0.29278811812), SCALE(0.63709646463), SCALE(0.06764923781),
|
||||||
0.00266251224, 0.29804900289, 0.63384294510, 0.06545893103,
|
SCALE(0.00266251224), SCALE(0.29804900289), SCALE(0.63384294510), SCALE(0.06545893103),
|
||||||
0.00285378192, 0.30334126949, 0.63049703836, 0.06331945211,
|
SCALE(0.00285378192), SCALE(0.30334126949), SCALE(0.63049703836), SCALE(0.06331945211),
|
||||||
0.00305565330, 0.30866351724, 0.62706029415, 0.06123027951,
|
SCALE(0.00305565330), SCALE(0.30866351724), SCALE(0.62706029415), SCALE(0.06123027951),
|
||||||
0.00326841651, 0.31401440501, 0.62353414297, 0.05919086933,
|
SCALE(0.00326841651), SCALE(0.31401440501), SCALE(0.62353414297), SCALE(0.05919086933),
|
||||||
0.00349264755, 0.31939238310, 0.61992025375, 0.05720067024,
|
SCALE(0.00349264755), SCALE(0.31939238310), SCALE(0.61992025375), SCALE(0.05720067024),
|
||||||
0.00372874714, 0.32479602098, 0.61622029543, 0.05525910854,
|
SCALE(0.00372874714), SCALE(0.32479602098), SCALE(0.61622029543), SCALE(0.05525910854),
|
||||||
0.00397720048, 0.33022382855, 0.61243581772, 0.05336561054,
|
SCALE(0.00397720048), SCALE(0.33022382855), SCALE(0.61243581772), SCALE(0.05336561054),
|
||||||
0.00423829490, 0.33567428589, 0.60856848955, 0.05151961371,
|
SCALE(0.00423829490), SCALE(0.33567428589), SCALE(0.60856848955), SCALE(0.05151961371),
|
||||||
0.00451271003, 0.34114575386, 0.60462015867, 0.04972046614,
|
SCALE(0.00451271003), SCALE(0.34114575386), SCALE(0.60462015867), SCALE(0.04972046614),
|
||||||
0.00480085658, 0.34663668275, 0.60059231520, 0.04796761274,
|
SCALE(0.00480085658), SCALE(0.34663668275), SCALE(0.60059231520), SCALE(0.04796761274),
|
||||||
0.00510312291, 0.35214546323, 0.59648692608, 0.04626038298,
|
SCALE(0.00510312291), SCALE(0.35214546323), SCALE(0.59648692608), SCALE(0.04626038298),
|
||||||
0.00542017492, 0.35767036676, 0.59230577946, 0.04459818453,
|
SCALE(0.00542017492), SCALE(0.35767036676), SCALE(0.59230577946), SCALE(0.04459818453),
|
||||||
0.00575236930, 0.36320972443, 0.58805054426, 0.04298033938,
|
SCALE(0.00575236930), SCALE(0.36320972443), SCALE(0.58805054426), SCALE(0.04298033938),
|
||||||
0.00610029325, 0.36876192689, 0.58372318745, 0.04140623659,
|
SCALE(0.00610029325), SCALE(0.36876192689), SCALE(0.58372318745), SCALE(0.04140623659),
|
||||||
0.00646453211, 0.37432509661, 0.57932555676, 0.03987516090,
|
SCALE(0.00646453211), SCALE(0.37432509661), SCALE(0.57932555676), SCALE(0.03987516090),
|
||||||
0.00684553990, 0.37989753485, 0.57485944033, 0.03838652745,
|
SCALE(0.00684553990), SCALE(0.37989753485), SCALE(0.57485944033), SCALE(0.03838652745),
|
||||||
0.00724391919, 0.38547745347, 0.57032698393, 0.03693958372,
|
SCALE(0.00724391919), SCALE(0.38547745347), SCALE(0.57032698393), SCALE(0.03693958372),
|
||||||
0.00766016589, 0.39106300473, 0.56572991610, 0.03553372994,
|
SCALE(0.00766016589), SCALE(0.39106300473), SCALE(0.56572991610), SCALE(0.03553372994),
|
||||||
0.00809498038, 0.39665243030, 0.56107026339, 0.03416819125,
|
SCALE(0.00809498038), SCALE(0.39665243030), SCALE(0.56107026339), SCALE(0.03416819125),
|
||||||
0.00854881573, 0.40224379301, 0.55634999275, 0.03284239396,
|
SCALE(0.00854881573), SCALE(0.40224379301), SCALE(0.55634999275), SCALE(0.03284239396),
|
||||||
0.00902230106, 0.40783521533, 0.55157101154, 0.03155555204,
|
SCALE(0.00902230106), SCALE(0.40783521533), SCALE(0.55157101154), SCALE(0.03155555204),
|
||||||
0.00951600447, 0.41342487931, 0.54673534632, 0.03030703776,
|
SCALE(0.00951600447), SCALE(0.41342487931), SCALE(0.54673534632), SCALE(0.03030703776),
|
||||||
0.01003060210, 0.41901078820, 0.54184508324, 0.02909611352,
|
SCALE(0.01003060210), SCALE(0.41901078820), SCALE(0.54184508324), SCALE(0.02909611352),
|
||||||
0.01056654565, 0.42459106445, 0.53690224886, 0.02792212367,
|
SCALE(0.01056654565), SCALE(0.42459106445), SCALE(0.53690224886), SCALE(0.02792212367),
|
||||||
0.01112466771, 0.43016362190, 0.53190881014, 0.02678431384,
|
SCALE(0.01112466771), SCALE(0.43016362190), SCALE(0.53190881014), SCALE(0.02678431384),
|
||||||
0.01170534454, 0.43572667241, 0.52686679363, 0.02568206564,
|
SCALE(0.01170534454), SCALE(0.43572667241), SCALE(0.52686679363), SCALE(0.02568206564),
|
||||||
0.01230939943, 0.44127810001, 0.52177828550, 0.02461459488,
|
SCALE(0.01230939943), SCALE(0.44127810001), SCALE(0.52177828550), SCALE(0.02461459488),
|
||||||
0.01293735672, 0.44681602716, 0.51664537191, 0.02358125709,
|
SCALE(0.01293735672), SCALE(0.44681602716), SCALE(0.51664537191), SCALE(0.02358125709),
|
||||||
0.01358995494, 0.45233830810, 0.51147013903, 0.02258131653,
|
SCALE(0.01358995494), SCALE(0.45233830810), SCALE(0.51147013903), SCALE(0.02258131653),
|
||||||
0.01426773332, 0.45784294605, 0.50625455379, 0.02161412500,
|
SCALE(0.01426773332), SCALE(0.45784294605), SCALE(0.50625455379), SCALE(0.02161412500),
|
||||||
0.01497144438, 0.46332800388, 0.50100076199, 0.02067894675,
|
SCALE(0.01497144438), SCALE(0.46332800388), SCALE(0.50100076199), SCALE(0.02067894675),
|
||||||
0.01570170000, 0.46879136562, 0.49571081996, 0.01977507770,
|
SCALE(0.01570170000), SCALE(0.46879136562), SCALE(0.49571081996), SCALE(0.01977507770),
|
||||||
0.01645922661, 0.47423094511, 0.49038675427, 0.01890186779,
|
SCALE(0.01645922661), SCALE(0.47423094511), SCALE(0.49038675427), SCALE(0.01890186779),
|
||||||
0.01724460535, 0.47964480519, 0.48503074050, 0.01805862412,
|
SCALE(0.01724460535), SCALE(0.47964480519), SCALE(0.48503074050), SCALE(0.01805862412),
|
||||||
};
|
};
|
||||||
|
#undef SCALE
|
||||||
|
|
||||||
/* 10^-(dB/20), with dB being a list of dB values ranging from 0 to -72 */
|
/*
|
||||||
/* do a 20*log10(dca_downmix_coeffs) to reconvert the values */
|
* D.11 Look-up Table for Downmix Scale Factors
|
||||||
|
*
|
||||||
static const float dca_downmix_coeffs[65] = {
|
* Note that the range of the entries in DmixTable[] is between -60 dB and 0 dB
|
||||||
1.000000000000000, 0.988553094656939, 0.971627951577106, 0.944060876285923, 0.917275935389780, 0.891250938133746,
|
* with addition of -inf (|DMixCoeff| = 0), which is coded with a DmixCode = 0.
|
||||||
0.865964323360065, 0.841395141645195, 0.817523037943650, 0.794328234724281, 0.771791515585012, 0.749894209332456,
|
* Furthermore, the range [-60 to 0] is subdivided into 3 regions, each with a
|
||||||
0.728618174513228, 0.707945784384138, 0.687859912308808, 0.668343917568615, 0.649381631576211, 0.630957344480193,
|
* different grid resolution:
|
||||||
0.613055792149821, 0.595662143529010, 0.578761988349121, 0.562341325190349, 0.546386549881854, 0.530884444230988,
|
*
|
||||||
0.515822165072306, 0.501187233627272, 0.446683592150963, 0.398107170553497, 0.354813389233575, 0.316227766016838,
|
* 1) [-60.000 to -30] with resolution of 0.500 dB
|
||||||
0.281838293126445, 0.251188643150958, 0.223872113856834, 0.199526231496888, 0.177827941003892, 0.158489319246111,
|
* 2) [-29.750 to -15] with resolution of 0.250 dB
|
||||||
0.141253754462275, 0.125892541179417, 0.112201845430196, 0.100000000000000, 0.089125093813374, 0.079432823472428,
|
* 3) [-14.875 to 0] with resolution of 0.125 dB
|
||||||
0.070794578438414, 0.063095734448019, 0.053088444423099, 0.044668359215096, 0.037583740428844, 0.031622776601684,
|
*/
|
||||||
0.026607250597988, 0.022387211385683, 0.018836490894898, 0.015848931924611, 0.013335214321633, 0.011220184543020,
|
static const float dca_dmixtable[241] = {
|
||||||
0.009440608762859, 0.007943282347243, 0.005623413251903, 0.003981071705535, 0.002818382931264, 0.001995262314969,
|
|
||||||
0.001412537544623, 0.001000000000000, 0.000501187233627, 0.000251188643151, 0.000000000000000,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const float dca_downmix_scale_factors[241] = {
|
|
||||||
0.001000, 0.001059, 0.001122, 0.001189, 0.001259, 0.001334, 0.001413, 0.001496,
|
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.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.002512, 0.002661, 0.002818, 0.002985, 0.003162, 0.003350, 0.003548, 0.003758,
|
||||||
|
@ -7553,20 +7551,20 @@ static const float dca_downmix_scale_factors[241] = {
|
||||||
0.707107, 0.718208, 0.728618, 0.739180, 0.749894, 0.760764, 0.771792, 0.782979,
|
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.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,
|
0.891251, 0.904170, 0.917276, 0.930572, 0.944061, 0.957745, 0.971628, 0.985712,
|
||||||
1.000000
|
1.000000,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t dca_default_coeffs[10][5][2] = {
|
static const float dca_default_coeffs[10][6][2] = {
|
||||||
{ { 13, 13 }, },
|
{ { 0.707107, 0.707107 }, { 0.000000, 0.000000 }, }, // A [LFE]
|
||||||
{ { 0, 64 }, { 64, 0 }, },
|
{ { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // A + B (dual mono) [LFE]
|
||||||
{ { 0, 64 }, { 64, 0 }, },
|
{ { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // L + R (stereo) [LFE]
|
||||||
{ { 0, 64 }, { 64, 0 }, },
|
{ { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // (L+R) + (L-R) (sum-difference) [LFE]
|
||||||
{ { 0, 64 }, { 64, 0 }, },
|
{ { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // LT + RT (left and right total) [LFE]
|
||||||
{ { 6, 6 }, { 0, 25 }, { 25, 0 }, },
|
{ { 0.501187, 0.501187 }, { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.000000, 0.000000 }, }, // C + L + R [LFE]
|
||||||
{ { 0, 25 }, { 25, 0 }, { 13, 13 }, },
|
{ { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.501187, 0.501187 }, { 0.000000, 0.000000 }, }, // L + R + S [LFE]
|
||||||
{ { 6, 6 }, { 0, 25 }, { 25, 0 }, { 13, 13 }, },
|
{ { 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, 25 }, { 25, 0 }, { 0, 13 }, { 13, 0 }, },
|
{ { 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]
|
||||||
{ { 6, 6 }, { 0, 25 }, { 25, 0 }, { 0, 13 }, { 13, 0 }, },
|
{ { 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
|
/* downmix coeffs
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
@ -52,7 +53,6 @@
|
||||||
//#define TRACE
|
//#define TRACE
|
||||||
|
|
||||||
#define DCA_PRIM_CHANNELS_MAX (7)
|
#define DCA_PRIM_CHANNELS_MAX (7)
|
||||||
#define DCA_SUBBANDS (64)
|
|
||||||
#define DCA_ABITS_MAX (32) /* Should be 28 */
|
#define DCA_ABITS_MAX (32) /* Should be 28 */
|
||||||
#define DCA_SUBSUBFRAMES_MAX (4)
|
#define DCA_SUBSUBFRAMES_MAX (4)
|
||||||
#define DCA_SUBFRAMES_MAX (16)
|
#define DCA_SUBFRAMES_MAX (16)
|
||||||
|
@ -325,6 +325,8 @@ static const int8_t dca_channel_reorder_nolfe_xch[][9] = {
|
||||||
|
|
||||||
#define DCA_BUFFER_PADDING_SIZE 1024
|
#define DCA_BUFFER_PADDING_SIZE 1024
|
||||||
|
|
||||||
|
#define DCA_NSYNCAUX 0x9A1105A0
|
||||||
|
|
||||||
/** Bit allocation */
|
/** Bit allocation */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int offset; ///< code values offset
|
int offset; ///< code values offset
|
||||||
|
@ -346,6 +348,7 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
const AVClass *class; ///< class for AVOptions
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
/* Frame header */
|
/* Frame header */
|
||||||
int frame_type; ///< type of the current frame
|
int frame_type; ///< type of the current frame
|
||||||
|
@ -358,7 +361,6 @@ typedef struct {
|
||||||
int bit_rate; ///< transmission bit rate
|
int bit_rate; ///< transmission bit rate
|
||||||
int bit_rate_index; ///< transmission bit rate index
|
int bit_rate_index; ///< transmission bit rate index
|
||||||
|
|
||||||
int downmix; ///< embedded downmix enabled
|
|
||||||
int dynrange; ///< embedded dynamic range flag
|
int dynrange; ///< embedded dynamic range flag
|
||||||
int timestamp; ///< embedded time stamp flag
|
int timestamp; ///< embedded time stamp flag
|
||||||
int aux_data; ///< auxiliary data flag
|
int aux_data; ///< auxiliary data flag
|
||||||
|
@ -397,13 +399,20 @@ typedef struct {
|
||||||
int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction VQ coefs
|
int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction VQ coefs
|
||||||
int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< bit allocation index
|
int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< bit allocation index
|
||||||
int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< transition mode (transients)
|
int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< transition mode (transients)
|
||||||
int scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2]; ///< scale factors (2 if transient)
|
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_huff[DCA_PRIM_CHANNELS_MAX]; ///< joint subband scale factors codebook
|
||||||
int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors
|
int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors
|
||||||
int downmix_coef[DCA_PRIM_CHANNELS_MAX][2]; ///< stereo downmix coefficients
|
float downmix_coef[DCA_PRIM_CHANNELS_MAX + 1][2]; ///< stereo downmix coefficients
|
||||||
int dynrange_coef; ///< dynamic range coefficient
|
int dynrange_coef; ///< dynamic range coefficient
|
||||||
|
|
||||||
int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded high frequency subbands
|
/* 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
|
float lfe_data[2 * DCA_LFE_MAX * (DCA_BLOCKS_MAX + 4)]; ///< Low frequency effect data
|
||||||
int lfe_scale_factor;
|
int lfe_scale_factor;
|
||||||
|
@ -437,6 +446,7 @@ typedef struct {
|
||||||
/* XCh extension information */
|
/* XCh extension information */
|
||||||
int xch_present; ///< XCh extension present and valid
|
int xch_present; ///< XCh extension present and valid
|
||||||
int xch_base_channel; ///< index of first (only) channel containing XCH data
|
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 */
|
/* XXCH extension information */
|
||||||
int xxch_chset;
|
int xxch_chset;
|
||||||
|
@ -589,7 +599,7 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel,
|
||||||
if (get_bits1(&s->gb)) {
|
if (get_bits1(&s->gb)) {
|
||||||
embedded_downmix = get_bits1(&s->gb);
|
embedded_downmix = get_bits1(&s->gb);
|
||||||
scale_factor =
|
scale_factor =
|
||||||
1.0f / dca_downmix_scale_factors[(get_bits(&s->gb, 6) - 1) << 2];
|
1.0f / dca_dmixtable[(get_bits(&s->gb, 6) - 1) << 2];
|
||||||
|
|
||||||
s->xxch_dmix_sf[s->xxch_chset] = scale_factor;
|
s->xxch_dmix_sf[s->xxch_chset] = scale_factor;
|
||||||
|
|
||||||
|
@ -610,7 +620,7 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel,
|
||||||
|
|
||||||
coeff = get_bits(&s->gb, 7);
|
coeff = get_bits(&s->gb, 7);
|
||||||
sign = (coeff & 64) ? 1.0 : -1.0;
|
sign = (coeff & 64) ? 1.0 : -1.0;
|
||||||
mag = dca_downmix_scale_factors[((coeff & 63) - 1) << 2];
|
mag = dca_dmixtable[((coeff & 63) - 1) << 2];
|
||||||
ichan = dca_xxch2index(s, 1 << i);
|
ichan = dca_xxch2index(s, 1 << i);
|
||||||
s->xxch_dmix_coeff[j][ichan] = sign * mag;
|
s->xxch_dmix_coeff[j][ichan] = sign * mag;
|
||||||
}
|
}
|
||||||
|
@ -724,7 +734,7 @@ static int dca_parse_frame_header(DCAContext *s)
|
||||||
if (!s->bit_rate)
|
if (!s->bit_rate)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
s->downmix = get_bits(&s->gb, 1); /* note: this is FixedBit == 0 */
|
skip_bits1(&s->gb); // always 0 (reserved, cf. ETSI TS 102 114 V1.4.1)
|
||||||
s->dynrange = get_bits(&s->gb, 1);
|
s->dynrange = get_bits(&s->gb, 1);
|
||||||
s->timestamp = get_bits(&s->gb, 1);
|
s->timestamp = get_bits(&s->gb, 1);
|
||||||
s->aux_data = get_bits(&s->gb, 1);
|
s->aux_data = get_bits(&s->gb, 1);
|
||||||
|
@ -771,7 +781,6 @@ static int dca_parse_frame_header(DCAContext *s)
|
||||||
s->sample_rate);
|
s->sample_rate);
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
|
av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
|
||||||
s->bit_rate);
|
s->bit_rate);
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix);
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);
|
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, "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, "aux_data: %i\n", s->aux_data);
|
||||||
|
@ -954,33 +963,6 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stereo downmix coefficients */
|
|
||||||
if (!base_channel && s->prim_channels > 2) {
|
|
||||||
if (s->downmix) {
|
|
||||||
for (j = base_channel; j < s->prim_channels; j++) {
|
|
||||||
s->downmix_coef[j][0] = get_bits(&s->gb, 7);
|
|
||||||
s->downmix_coef[j][1] = get_bits(&s->gb, 7);
|
|
||||||
}
|
|
||||||
} 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 > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {
|
|
||||||
avpriv_request_sample(s->avctx, "Downmixing %d channels",
|
|
||||||
s->prim_channels);
|
|
||||||
return AVERROR_PATCHWELCOME;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = base_channel; j < s->prim_channels; j++) {
|
|
||||||
s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
|
|
||||||
s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Dynamic range coefficient */
|
/* Dynamic range coefficient */
|
||||||
if (!base_channel && s->dynrange)
|
if (!base_channel && s->dynrange)
|
||||||
s->dynrange_coef = get_bits(&s->gb, 8);
|
s->dynrange_coef = get_bits(&s->gb, 8);
|
||||||
|
@ -1080,16 +1062,6 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!base_channel && s->prim_channels > 2 && s->downmix) {
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");
|
|
||||||
for (j = 0; j < s->prim_channels; j++) {
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j,
|
|
||||||
dca_downmix_coeffs[s->downmix_coef[j][0]]);
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j,
|
|
||||||
dca_downmix_coeffs[s->downmix_coef[j][1]]);
|
|
||||||
}
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
|
||||||
}
|
|
||||||
for (j = base_channel; j < s->prim_channels; j++)
|
for (j = base_channel; j < s->prim_channels; j++)
|
||||||
for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
|
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]);
|
av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]);
|
||||||
|
@ -1132,7 +1104,7 @@ static void qmf_32_subbands(DCAContext *s, int chans,
|
||||||
|
|
||||||
static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
|
static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
|
||||||
int num_deci_sample, float *samples_in,
|
int num_deci_sample, float *samples_in,
|
||||||
float *samples_out, float scale)
|
float *samples_out)
|
||||||
{
|
{
|
||||||
/* samples_in: An array holding decimated samples.
|
/* samples_in: An array holding decimated samples.
|
||||||
* Samples in current subframe starts from samples_in[0],
|
* Samples in current subframe starts from samples_in[0],
|
||||||
|
@ -1142,23 +1114,23 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
|
||||||
* samples_out: An array holding interpolated samples
|
* samples_out: An array holding interpolated samples
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int decifactor;
|
int idx;
|
||||||
const float *prCoeff;
|
const float *prCoeff;
|
||||||
int deciindex;
|
int deciindex;
|
||||||
|
|
||||||
/* Select decimation filter */
|
/* Select decimation filter */
|
||||||
if (decimation_select == 1) {
|
if (decimation_select == 1) {
|
||||||
decifactor = 64;
|
idx = 1;
|
||||||
prCoeff = lfe_fir_128;
|
prCoeff = lfe_fir_128;
|
||||||
} else {
|
} else {
|
||||||
decifactor = 32;
|
idx = 0;
|
||||||
prCoeff = lfe_fir_64;
|
prCoeff = lfe_fir_64;
|
||||||
}
|
}
|
||||||
/* Interpolation */
|
/* Interpolation */
|
||||||
for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
|
for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
|
||||||
s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, scale);
|
s->dcadsp.lfe_fir[idx](samples_out, samples_in, prCoeff);
|
||||||
samples_in++;
|
samples_in++;
|
||||||
samples_out += 2 * decifactor;
|
samples_out += 2 * 32 * (1 + idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,29 +1156,23 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
|
||||||
op2 \
|
op2 \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dca_downmix(float **samples, int srcfmt,
|
static void dca_downmix(float **samples, int srcfmt, int lfe_present,
|
||||||
int downmix_coef[DCA_PRIM_CHANNELS_MAX][2],
|
float coef[DCA_PRIM_CHANNELS_MAX + 1][2],
|
||||||
const int8_t *channel_mapping)
|
const int8_t *channel_mapping)
|
||||||
{
|
{
|
||||||
int c, l, r, sl, sr, s;
|
int c, l, r, sl, sr, s;
|
||||||
int i;
|
int i;
|
||||||
float t, u, v;
|
float t, u, v;
|
||||||
float coef[DCA_PRIM_CHANNELS_MAX][2];
|
|
||||||
|
|
||||||
for (i = 0; i < DCA_PRIM_CHANNELS_MAX; i++) {
|
|
||||||
coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]];
|
|
||||||
coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]];
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (srcfmt) {
|
switch (srcfmt) {
|
||||||
case DCA_MONO:
|
case DCA_MONO:
|
||||||
case DCA_CHANNEL:
|
|
||||||
case DCA_STEREO_TOTAL:
|
|
||||||
case DCA_STEREO_SUMDIFF:
|
|
||||||
case DCA_4F2R:
|
case DCA_4F2R:
|
||||||
av_log(NULL, AV_LOG_ERROR, "Not implemented!\n");
|
av_log(NULL, AV_LOG_ERROR, "Not implemented!\n");
|
||||||
break;
|
break;
|
||||||
|
case DCA_CHANNEL:
|
||||||
case DCA_STEREO:
|
case DCA_STEREO:
|
||||||
|
case DCA_STEREO_TOTAL:
|
||||||
|
case DCA_STEREO_SUMDIFF:
|
||||||
break;
|
break;
|
||||||
case DCA_3F:
|
case DCA_3F:
|
||||||
c = channel_mapping[0];
|
c = channel_mapping[0];
|
||||||
|
@ -1241,6 +1207,14 @@ static void dca_downmix(float **samples, int srcfmt,
|
||||||
MIX_REAR2(samples, sl, sr, 3, coef));
|
MIX_REAR2(samples, sl, sr, 3, coef));
|
||||||
break;
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1271,16 +1245,6 @@ static int decode_blockcodes(int code1, int code2, int levels, int32_t *values)
|
||||||
static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 };
|
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 const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
|
||||||
|
|
||||||
#ifndef int8x8_fmul_int32
|
|
||||||
static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
|
|
||||||
{
|
|
||||||
float fscale = scale / 16.0;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
dst[i] = src[i] * fscale;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||||
{
|
{
|
||||||
int k, l;
|
int k, l;
|
||||||
|
@ -1377,16 +1341,27 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||||
*/
|
*/
|
||||||
if (s->prediction_mode[k][l]) {
|
if (s->prediction_mode[k][l]) {
|
||||||
int n;
|
int n;
|
||||||
for (m = 0; m < 8; m++) {
|
if (s->predictor_history)
|
||||||
for (n = 1; n <= 4; n++)
|
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)
|
if (m >= n)
|
||||||
subband_samples[k][l][m] +=
|
sum += adpcm_vb[s->prediction_vq[k][l]][n - 1] *
|
||||||
(adpcm_vb[s->prediction_vq[k][l]][n - 1] *
|
subband_samples[k][l][m - n];
|
||||||
subband_samples[k][l][m - n] / 8192);
|
|
||||||
else if (s->predictor_history)
|
else if (s->predictor_history)
|
||||||
subband_samples[k][l][m] +=
|
sum += adpcm_vb[s->prediction_vq[k][l]][n - 1] *
|
||||||
(adpcm_vb[s->prediction_vq[k][l]][n - 1] *
|
s->subband_samples_hist[k][l][m - n + 4];
|
||||||
s->subband_samples_hist[k][l][m - n + 4] / 8192);
|
subband_samples[k][l][m] += sum * (1.0f / 8192);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1394,20 +1369,16 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||||
/*
|
/*
|
||||||
* Decode VQ encoded high frequencies
|
* Decode VQ encoded high frequencies
|
||||||
*/
|
*/
|
||||||
for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) {
|
if (s->subband_activity[k] > s->vq_start_subband[k]) {
|
||||||
/* 1 vector -> 32 samples but we only need the 8 samples
|
|
||||||
* for this subsubframe. */
|
|
||||||
int hfvq = s->high_freq_vq[k][l];
|
|
||||||
|
|
||||||
if (!s->debug_flag & 0x01) {
|
if (!s->debug_flag & 0x01) {
|
||||||
av_log(s->avctx, AV_LOG_DEBUG,
|
av_log(s->avctx, AV_LOG_DEBUG,
|
||||||
"Stream with high frequencies VQ coding\n");
|
"Stream with high frequencies VQ coding\n");
|
||||||
s->debug_flag |= 0x01;
|
s->debug_flag |= 0x01;
|
||||||
}
|
}
|
||||||
|
s->dcadsp.decode_hf(subband_samples[k], s->high_freq_vq[k],
|
||||||
int8x8_fmul_int32(subband_samples[k][l],
|
high_freq_vq, subsubframe * 8,
|
||||||
&high_freq_vq[hfvq][subsubframe * 8],
|
s->scale_factor[k], s->vq_start_subband[k],
|
||||||
s->scale_factor[k][l][0]);
|
s->subband_activity[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,9 +1397,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||||
/* Backup predictor history for adpcm */
|
/* Backup predictor history for adpcm */
|
||||||
for (k = base_channel; k < s->prim_channels; k++)
|
for (k = base_channel; k < s->prim_channels; k++)
|
||||||
for (l = 0; l < s->vq_start_subband[k]; l++)
|
for (l = 0; l < s->vq_start_subband[k]; l++)
|
||||||
memcpy(s->subband_samples_hist[k][l],
|
AV_COPY128(s->subband_samples_hist[k][l], &subband_samples[k][l][4]);
|
||||||
&subband_samples[k][l][4],
|
|
||||||
4 * sizeof(subband_samples[0][0][0]));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1449,28 +1418,29 @@ static int dca_filter_channels(DCAContext *s, int block_index)
|
||||||
M_SQRT1_2 / 32768.0 /* pcm_to_double[s->source_pcm_res] */);
|
M_SQRT1_2 / 32768.0 /* pcm_to_double[s->source_pcm_res] */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Down mixing */
|
|
||||||
AV_NOWARN_DEPRECATED( request_channels = s->avctx->request_channels; );
|
|
||||||
if (request_channels == 2 && s->prim_channels > 2) {
|
|
||||||
dca_downmix(s->samples_chanptr, s->amode, s->downmix_coef, s->channel_order_tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generate LFE samples for this subsubframe FIXME!!! */
|
/* Generate LFE samples for this subsubframe FIXME!!! */
|
||||||
if (s->output & DCA_LFE) {
|
if (s->lfe) {
|
||||||
lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
|
lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
|
||||||
s->lfe_data + 2 * s->lfe * (block_index + 4),
|
s->lfe_data + 2 * s->lfe * (block_index + 4),
|
||||||
s->samples_chanptr[s->lfe_index],
|
s->samples_chanptr[s->lfe_index]);
|
||||||
1.0 / (256.0 * 32768.0));
|
|
||||||
/* Outputs 20bits pcm samples */
|
/* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int dca_subframe_footer(DCAContext *s, int base_channel)
|
static int dca_subframe_footer(DCAContext *s, int base_channel)
|
||||||
{
|
{
|
||||||
int aux_data_count = 0, i;
|
int in, out, aux_data_count, aux_data_end, reserved;
|
||||||
|
uint32_t nsyncaux;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unpack optional information
|
* Unpack optional information
|
||||||
|
@ -1481,13 +1451,89 @@ static int dca_subframe_footer(DCAContext *s, int base_channel)
|
||||||
if (s->timestamp)
|
if (s->timestamp)
|
||||||
skip_bits_long(&s->gb, 32);
|
skip_bits_long(&s->gb, 32);
|
||||||
|
|
||||||
if (s->aux_data)
|
if (s->aux_data) {
|
||||||
aux_data_count = get_bits(&s->gb, 6);
|
aux_data_count = get_bits(&s->gb, 6);
|
||||||
|
|
||||||
for (i = 0; i < aux_data_count; i++)
|
// align (32-bit)
|
||||||
get_bits(&s->gb, 8);
|
skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
|
||||||
|
|
||||||
if (s->crc_present && (s->downmix || s->dynrange))
|
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);
|
get_bits(&s->gb, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2119,6 +2165,55 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
/* record number of core channels incase less than max channels are requested */
|
/* record number of core channels incase less than max channels are requested */
|
||||||
num_core_channels = s->prim_channels;
|
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)
|
if (s->ext_coding)
|
||||||
s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];
|
s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];
|
||||||
else
|
else
|
||||||
|
@ -2227,21 +2322,24 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
|
|
||||||
full_channels = channels = s->prim_channels + !!s->lfe;
|
full_channels = channels = s->prim_channels + !!s->lfe;
|
||||||
|
|
||||||
AV_NOWARN_DEPRECATED( request_channels = avctx->request_channels; );
|
|
||||||
|
|
||||||
/* If we have XXCH then the channel layout is managed differently */
|
/* If we have XXCH then the channel layout is managed differently */
|
||||||
/* note that XLL will also have another way to do things */
|
/* note that XLL will also have another way to do things */
|
||||||
if (!(s->core_ext_mask & DCA_EXT_XXCH)
|
if (!(s->core_ext_mask & DCA_EXT_XXCH)
|
||||||
|| (s->core_ext_mask & DCA_EXT_XXCH && request_channels > 0
|
|| (s->core_ext_mask & DCA_EXT_XXCH && avctx->request_channels > 0
|
||||||
&& request_channels
|
&& avctx->request_channels
|
||||||
< num_core_channels + !!s->lfe + s->xxch_chset_nch[0]))
|
< num_core_channels + !!s->lfe + s->xxch_chset_nch[0]))
|
||||||
{ /* xxx should also do MA extensions */
|
{ /* xxx should also do MA extensions */
|
||||||
if (s->amode < 16) {
|
if (s->amode < 16) {
|
||||||
avctx->channel_layout = dca_core_channel_layout[s->amode];
|
avctx->channel_layout = dca_core_channel_layout[s->amode];
|
||||||
|
#if FF_API_REQUEST_CHANNELS
|
||||||
if (s->xch_present && (!request_channels ||
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
request_channels
|
if (s->xch_present && !s->xch_disable &&
|
||||||
> num_core_channels + !!s->lfe)) {
|
(!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;
|
avctx->channel_layout |= AV_CH_BACK_CENTER;
|
||||||
if (s->lfe) {
|
if (s->lfe) {
|
||||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||||
|
@ -2270,9 +2368,10 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_channels == 2 && s->prim_channels > 2) {
|
if (s->prim_channels + !!s->lfe > 2 &&
|
||||||
|
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
||||||
channels = 2;
|
channels = 2;
|
||||||
s->output = DCA_STEREO;
|
s->output = s->prim_channels == 2 ? s->amode : DCA_STEREO;
|
||||||
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||||
}
|
}
|
||||||
else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) {
|
else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) {
|
||||||
|
@ -2318,7 +2417,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
* masks in some sense -- unfortunately some channels could overlap */
|
* masks in some sense -- unfortunately some channels could overlap */
|
||||||
if (av_popcount(channel_mask) != av_popcount(channel_layout)) {
|
if (av_popcount(channel_mask) != av_popcount(channel_layout)) {
|
||||||
av_log(avctx, AV_LOG_DEBUG,
|
av_log(avctx, AV_LOG_DEBUG,
|
||||||
"DTS-XXCH: Inconsistant avcodec/dts channel layouts\n");
|
"DTS-XXCH: Inconsistent avcodec/dts channel layouts\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2456,6 +2555,15 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
for (i = 0; i < 2 * s->lfe * 4; i++)
|
for (i = 0; i < 2 * s->lfe * 4; i++)
|
||||||
s->lfe_data[i] = s->lfe_data[i + lfe_samples];
|
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;
|
*got_frame_ptr = 1;
|
||||||
|
|
||||||
return buf_size;
|
return buf_size;
|
||||||
|
@ -2486,11 +2594,15 @@ static av_cold int dca_decode_init(AVCodecContext *avctx)
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||||
|
|
||||||
/* allow downmixing to stereo */
|
/* allow downmixing to stereo */
|
||||||
AV_NOWARN_DEPRECATED( request_channels = avctx->request_channels; );
|
#if FF_API_REQUEST_CHANNELS
|
||||||
if (avctx->channels > 0 && request_channels < avctx->channels &&
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
request_channels == 2) {
|
if (avctx->request_channels == 2)
|
||||||
avctx->channels = request_channels;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2512,6 +2624,19 @@ static const AVProfile profiles[] = {
|
||||||
{ FF_PROFILE_UNKNOWN },
|
{ 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 = {
|
AVCodec ff_dca_decoder = {
|
||||||
.name = "dca",
|
.name = "dca",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
|
.long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
|
||||||
|
@ -2525,4 +2650,5 @@ AVCodec ff_dca_decoder = {
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
.profiles = NULL_IF_CONFIG_SMALL(profiles),
|
.profiles = NULL_IF_CONFIG_SMALL(profiles),
|
||||||
|
.priv_class = &dca_decoder_class,
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,25 +24,42 @@
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "dcadsp.h"
|
#include "dcadsp.h"
|
||||||
|
|
||||||
static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
|
static void decode_hf_c(float dst[DCA_SUBBANDS][8],
|
||||||
int decifactor, float scale)
|
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)
|
||||||
{
|
{
|
||||||
float *out2 = out + decifactor;
|
int i, l;
|
||||||
const float *cf0 = coefs;
|
|
||||||
const float *cf1 = coefs + 256;
|
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;
|
int j, k;
|
||||||
|
|
||||||
/* One decimated sample generates 2*decifactor interpolated ones */
|
/* One decimated sample generates 2*decifactor interpolated ones */
|
||||||
for (k = 0; k < decifactor; k++) {
|
for (k = 0; k < decifactor; k++) {
|
||||||
float v0 = 0.0;
|
float v0 = 0.0;
|
||||||
float v1 = 0.0;
|
float v1 = 0.0;
|
||||||
for (j = 0; j < 256 / decifactor; j++) {
|
for (j = 0; j < num_coeffs; j++, coefs++) {
|
||||||
float s = in[-j];
|
v0 += in[-j] * *coefs;
|
||||||
v0 += s * *cf0++;
|
v1 += in[j + 1 - num_coeffs] * *coefs;
|
||||||
v1 += s * *--cf1;
|
|
||||||
}
|
}
|
||||||
*out++ = v0 * scale;
|
*out++ = v0;
|
||||||
*out2++ = v1 * scale;
|
*out2-- = v1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,9 +91,22 @@ static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
av_cold void ff_dcadsp_init(DCADSPContext *s)
|
||||||
{
|
{
|
||||||
s->lfe_fir = dca_lfe_fir_c;
|
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->qmf_32_subbands = dca_qmf_32_subbands;
|
||||||
|
s->decode_hf = decode_hf_c;
|
||||||
if (ARCH_ARM) ff_dcadsp_init_arm(s);
|
if (ARCH_ARM) ff_dcadsp_init_arm(s);
|
||||||
|
if (ARCH_X86) ff_dcadsp_init_x86(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,18 +22,25 @@
|
||||||
#include "avfft.h"
|
#include "avfft.h"
|
||||||
#include "synth_filter.h"
|
#include "synth_filter.h"
|
||||||
|
|
||||||
|
#define DCA_SUBBANDS 64
|
||||||
|
|
||||||
typedef struct DCADSPContext {
|
typedef struct DCADSPContext {
|
||||||
void (*lfe_fir)(float *out, const float *in, const float *coefs,
|
void (*lfe_fir[2])(float *out, const float *in, const float *coefs);
|
||||||
int decifactor, float scale);
|
|
||||||
void (*qmf_32_subbands)(float samples_in[32][8], int sb_act,
|
void (*qmf_32_subbands)(float samples_in[32][8], int sb_act,
|
||||||
SynthFilterContext *synth, FFTContext *imdct,
|
SynthFilterContext *synth, FFTContext *imdct,
|
||||||
float synth_buf_ptr[512],
|
float synth_buf_ptr[512],
|
||||||
int *synth_buf_offset, float synth_buf2[32],
|
int *synth_buf_offset, float synth_buf2[32],
|
||||||
const float window[512], float *samples_out,
|
const float window[512], float *samples_out,
|
||||||
float raXin[32], float scale);
|
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;
|
} DCADSPContext;
|
||||||
|
|
||||||
void ff_dcadsp_init(DCADSPContext *s);
|
void ff_dcadsp_init(DCADSPContext *s);
|
||||||
void ff_dcadsp_init_arm(DCADSPContext *s);
|
void ff_dcadsp_init_arm(DCADSPContext *s);
|
||||||
|
void ff_dcadsp_init_x86(DCADSPContext *s);
|
||||||
|
|
||||||
#endif /* AVCODEC_DCADSP_H */
|
#endif /* AVCODEC_DCADSP_H */
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "dirac.h"
|
#include "dirac.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "golomb.h"
|
#include "golomb.h"
|
||||||
|
#include "internal.h"
|
||||||
#include "mpeg12data.h"
|
#include "mpeg12data.h"
|
||||||
|
|
||||||
/* defaults for source parameters */
|
/* defaults for source parameters */
|
||||||
|
@ -317,11 +318,10 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
|
||||||
if ((ret = parse_source_parameters(avctx, gb, source)))
|
if ((ret = parse_source_parameters(avctx, gb, source)))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = av_image_check_size(source->width, source->height, 0, avctx)))
|
ret = ff_set_dimensions(avctx, source->width, source->height);
|
||||||
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
avcodec_set_dimensions(avctx, source->width, source->height);
|
|
||||||
|
|
||||||
/* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
|
/* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
|
||||||
* currently only used to signal field coding */
|
* currently only used to signal field coding */
|
||||||
picture_coding_mode = svq3_get_ue_golomb(gb);
|
picture_coding_mode = svq3_get_ue_golomb(gb);
|
||||||
|
|
|
@ -536,6 +536,7 @@ int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height
|
||||||
d->vertical_compose_l0 = (void*)vertical_compose_fidelityiL0;
|
d->vertical_compose_l0 = (void*)vertical_compose_fidelityiL0;
|
||||||
d->vertical_compose_h0 = (void*)vertical_compose_fidelityiH0;
|
d->vertical_compose_h0 = (void*)vertical_compose_fidelityiH0;
|
||||||
d->horizontal_compose = horizontal_compose_fidelityi;
|
d->horizontal_compose = horizontal_compose_fidelityi;
|
||||||
|
d->support = 0; // not really used
|
||||||
break;
|
break;
|
||||||
case DWT_DIRAC_DAUB9_7:
|
case DWT_DIRAC_DAUB9_7:
|
||||||
d->spatial_compose = spatial_compose_daub97i_dy;
|
d->spatial_compose = spatial_compose_daub97i_dy;
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
#define DIVRNDUP(a, b) (((a) + (b) - 1) / (b))
|
#define DIVRNDUP(a, b) (((a) + (b) - 1) / (b))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
AVFrame avframe;
|
AVFrame *avframe;
|
||||||
int interpolated[3]; /* 1 if hpel[] is valid */
|
int interpolated[3]; /* 1 if hpel[] is valid */
|
||||||
uint8_t *hpel[3][4];
|
uint8_t *hpel[3][4];
|
||||||
uint8_t *hpel_base[3][4];
|
uint8_t *hpel_base[3][4];
|
||||||
|
@ -291,7 +291,7 @@ static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum)
|
||||||
int i, remove_idx = -1;
|
int i, remove_idx = -1;
|
||||||
|
|
||||||
for (i = 0; framelist[i]; i++)
|
for (i = 0; framelist[i]; i++)
|
||||||
if (framelist[i]->avframe.display_picture_number == picnum) {
|
if (framelist[i]->avframe->display_picture_number == picnum) {
|
||||||
remove_pic = framelist[i];
|
remove_pic = framelist[i];
|
||||||
remove_idx = i;
|
remove_idx = i;
|
||||||
}
|
}
|
||||||
|
@ -364,8 +364,8 @@ static void free_sequence_buffers(DiracContext *s)
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
for (i = 0; i < MAX_FRAMES; i++) {
|
for (i = 0; i < MAX_FRAMES; i++) {
|
||||||
if (s->all_frames[i].avframe.data[0]) {
|
if (s->all_frames[i].avframe->data[0]) {
|
||||||
av_frame_unref(&s->all_frames[i].avframe);
|
av_frame_unref(s->all_frames[i].avframe);
|
||||||
memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated));
|
memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,17 +393,23 @@ static void free_sequence_buffers(DiracContext *s)
|
||||||
static av_cold int dirac_decode_init(AVCodecContext *avctx)
|
static av_cold int dirac_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
DiracContext *s = avctx->priv_data;
|
DiracContext *s = avctx->priv_data;
|
||||||
|
int i;
|
||||||
|
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
s->frame_number = -1;
|
s->frame_number = -1;
|
||||||
|
|
||||||
if (avctx->flags&CODEC_FLAG_EMU_EDGE) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Edge emulation not supported!\n");
|
|
||||||
return AVERROR_PATCHWELCOME;
|
|
||||||
}
|
|
||||||
|
|
||||||
ff_dsputil_init(&s->dsp, avctx);
|
ff_dsputil_init(&s->dsp, avctx);
|
||||||
ff_diracdsp_init(&s->diracdsp);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +423,13 @@ static void dirac_decode_flush(AVCodecContext *avctx)
|
||||||
|
|
||||||
static av_cold int dirac_decode_end(AVCodecContext *avctx)
|
static av_cold int dirac_decode_end(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
|
DiracContext *s = avctx->priv_data;
|
||||||
|
int i;
|
||||||
|
|
||||||
dirac_decode_flush(avctx);
|
dirac_decode_flush(avctx);
|
||||||
|
for (i = 0; i < MAX_FRAMES; i++)
|
||||||
|
av_frame_free(&s->all_frames[i].avframe);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,8 +1426,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
|
||||||
y + p->yblen > p->height+EDGE_WIDTH/2 ||
|
y + p->yblen > p->height+EDGE_WIDTH/2 ||
|
||||||
x < 0 || y < 0) {
|
x < 0 || y < 0) {
|
||||||
for (i = 0; i < nplanes; i++) {
|
for (i = 0; i < nplanes; i++) {
|
||||||
ff_emulated_edge_mc(s->edge_emu_buffer[i], p->stride,
|
ff_emulated_edge_mc(s->edge_emu_buffer[i], src[i],
|
||||||
src[i], p->stride,
|
p->stride, p->stride,
|
||||||
p->xblen, p->yblen, x, y,
|
p->xblen, p->yblen, x, y,
|
||||||
p->width+EDGE_WIDTH/2, p->height+EDGE_WIDTH/2);
|
p->width+EDGE_WIDTH/2, p->height+EDGE_WIDTH/2);
|
||||||
src[i] = s->edge_emu_buffer[i];
|
src[i] = s->edge_emu_buffer[i];
|
||||||
|
@ -1519,8 +1531,8 @@ static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, in
|
||||||
just use 8 for everything for the moment */
|
just use 8 for everything for the moment */
|
||||||
int i, edge = EDGE_WIDTH/2;
|
int i, edge = EDGE_WIDTH/2;
|
||||||
|
|
||||||
ref->hpel[plane][0] = ref->avframe.data[plane];
|
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 */
|
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 */
|
/* no need for hpel if we only have fpel vectors */
|
||||||
if (!s->mv_precision)
|
if (!s->mv_precision)
|
||||||
|
@ -1528,18 +1540,18 @@ static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, in
|
||||||
|
|
||||||
for (i = 1; i < 4; i++) {
|
for (i = 1; i < 4; i++) {
|
||||||
if (!ref->hpel_base[plane][i])
|
if (!ref->hpel_base[plane][i])
|
||||||
ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe.linesize[plane] + 32);
|
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 */
|
/* 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;
|
ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ref->interpolated[plane]) {
|
if (!ref->interpolated[plane]) {
|
||||||
s->diracdsp.dirac_hpel_filter(ref->hpel[plane][1], ref->hpel[plane][2],
|
s->diracdsp.dirac_hpel_filter(ref->hpel[plane][1], ref->hpel[plane][2],
|
||||||
ref->hpel[plane][3], ref->hpel[plane][0],
|
ref->hpel[plane][3], ref->hpel[plane][0],
|
||||||
ref->avframe.linesize[plane], width, height);
|
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][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][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);
|
s->dsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);
|
||||||
}
|
}
|
||||||
ref->interpolated[plane] = 1;
|
ref->interpolated[plane] = 1;
|
||||||
}
|
}
|
||||||
|
@ -1565,7 +1577,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||||
|
|
||||||
for (comp = 0; comp < 3; comp++) {
|
for (comp = 0; comp < 3; comp++) {
|
||||||
Plane *p = &s->plane[comp];
|
Plane *p = &s->plane[comp];
|
||||||
uint8_t *frame = s->current_picture->avframe.data[comp];
|
uint8_t *frame = s->current_picture->avframe->data[comp];
|
||||||
|
|
||||||
/* FIXME: small resolutions */
|
/* FIXME: small resolutions */
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
@ -1629,6 +1641,29 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||||
return 0;
|
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 ->
|
* Dirac Specification ->
|
||||||
* 11.1.1 Picture Header. picture_header()
|
* 11.1.1 Picture Header. picture_header()
|
||||||
|
@ -1640,7 +1675,7 @@ static int dirac_decode_picture_header(DiracContext *s)
|
||||||
GetBitContext *gb = &s->gb;
|
GetBitContext *gb = &s->gb;
|
||||||
|
|
||||||
/* [DIRAC_STD] 11.1.1 Picture Header. picture_header() PICTURE_NUM */
|
/* [DIRAC_STD] 11.1.1 Picture Header. picture_header() PICTURE_NUM */
|
||||||
picnum = s->current_picture->avframe.display_picture_number = get_bits_long(gb, 32);
|
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);
|
av_log(s->avctx,AV_LOG_DEBUG,"PICTURE_NUM: %d\n",picnum);
|
||||||
|
@ -1659,9 +1694,9 @@ static int dirac_decode_picture_header(DiracContext *s)
|
||||||
/* Jordi: this is needed if the referenced picture hasn't yet arrived */
|
/* Jordi: this is needed if the referenced picture hasn't yet arrived */
|
||||||
for (j = 0; j < MAX_REFERENCE_FRAMES && refdist; j++)
|
for (j = 0; j < MAX_REFERENCE_FRAMES && refdist; j++)
|
||||||
if (s->ref_frames[j]
|
if (s->ref_frames[j]
|
||||||
&& FFABS(s->ref_frames[j]->avframe.display_picture_number - refnum) < refdist) {
|
&& FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum) < refdist) {
|
||||||
s->ref_pics[i] = s->ref_frames[j];
|
s->ref_pics[i] = s->ref_frames[j];
|
||||||
refdist = FFABS(s->ref_frames[j]->avframe.display_picture_number - refnum);
|
refdist = FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->ref_pics[i] || refdist)
|
if (!s->ref_pics[i] || refdist)
|
||||||
|
@ -1670,22 +1705,21 @@ static int dirac_decode_picture_header(DiracContext *s)
|
||||||
/* if there were no references at all, allocate one */
|
/* if there were no references at all, allocate one */
|
||||||
if (!s->ref_pics[i])
|
if (!s->ref_pics[i])
|
||||||
for (j = 0; j < MAX_FRAMES; j++)
|
for (j = 0; j < MAX_FRAMES; j++)
|
||||||
if (!s->all_frames[j].avframe.data[0]) {
|
if (!s->all_frames[j].avframe->data[0]) {
|
||||||
s->ref_pics[i] = &s->all_frames[j];
|
s->ref_pics[i] = &s->all_frames[j];
|
||||||
ff_get_buffer(s->avctx, &s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retire the reference frames that are not used anymore */
|
/* retire the reference frames that are not used anymore */
|
||||||
AV_NOWARN_DEPRECATED(
|
if (s->current_picture->avframe->reference) {
|
||||||
if (s->current_picture->avframe.reference) {
|
|
||||||
retire = picnum + dirac_get_se_golomb(gb);
|
retire = picnum + dirac_get_se_golomb(gb);
|
||||||
if (retire != picnum) {
|
if (retire != picnum) {
|
||||||
DiracFrame *retire_pic = remove_frame(s->ref_frames, retire);
|
DiracFrame *retire_pic = remove_frame(s->ref_frames, retire);
|
||||||
|
|
||||||
if (retire_pic)
|
if (retire_pic)
|
||||||
retire_pic->avframe.reference &= DELAYED_PIC_REF;
|
retire_pic->avframe->reference &= DELAYED_PIC_REF;
|
||||||
else
|
else
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "Frame to retire not found\n");
|
av_log(s->avctx, AV_LOG_DEBUG, "Frame to retire not found\n");
|
||||||
}
|
}
|
||||||
|
@ -1693,10 +1727,9 @@ static int dirac_decode_picture_header(DiracContext *s)
|
||||||
/* if reference array is full, remove the oldest as per the spec */
|
/* if reference array is full, remove the oldest as per the spec */
|
||||||
while (add_frame(s->ref_frames, MAX_REFERENCE_FRAMES, s->current_picture)) {
|
while (add_frame(s->ref_frames, MAX_REFERENCE_FRAMES, s->current_picture)) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Reference frame overflow\n");
|
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;
|
remove_frame(s->ref_frames, s->ref_frames[0]->avframe->display_picture_number)->avframe->reference &= DELAYED_PIC_REF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
if (s->num_refs) {
|
if (s->num_refs) {
|
||||||
if (dirac_unpack_prediction_parameters(s)) /* [DIRAC_STD] 11.2 Picture Prediction Data. picture_prediction() */
|
if (dirac_unpack_prediction_parameters(s)) /* [DIRAC_STD] 11.2 Picture Prediction Data. picture_prediction() */
|
||||||
|
@ -1719,7 +1752,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
|
||||||
|
|
||||||
/* find frame with lowest picture number */
|
/* find frame with lowest picture number */
|
||||||
for (i = 1; s->delay_frames[i]; i++)
|
for (i = 1; s->delay_frames[i]; i++)
|
||||||
if (s->delay_frames[i]->avframe.display_picture_number < out->avframe.display_picture_number) {
|
if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {
|
||||||
out = s->delay_frames[i];
|
out = s->delay_frames[i];
|
||||||
out_idx = i;
|
out_idx = i;
|
||||||
}
|
}
|
||||||
|
@ -1728,9 +1761,9 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
|
||||||
s->delay_frames[i] = s->delay_frames[i+1];
|
s->delay_frames[i] = s->delay_frames[i+1];
|
||||||
|
|
||||||
if (out) {
|
if (out) {
|
||||||
AV_NOWARN_DEPRECATED( out->avframe.reference ^= DELAYED_PIC_REF; );
|
out->avframe->reference ^= DELAYED_PIC_REF;
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
if((ret = av_frame_ref(picture, &out->avframe)) < 0)
|
if((ret = av_frame_ref(picture, out->avframe)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1792,14 +1825,14 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
|
||||||
|
|
||||||
/* find an unused frame */
|
/* find an unused frame */
|
||||||
for (i = 0; i < MAX_FRAMES; i++)
|
for (i = 0; i < MAX_FRAMES; i++)
|
||||||
if (s->all_frames[i].avframe.data[0] == NULL)
|
if (s->all_frames[i].avframe->data[0] == NULL)
|
||||||
pic = &s->all_frames[i];
|
pic = &s->all_frames[i];
|
||||||
if (!pic) {
|
if (!pic) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "framelist full\n");
|
av_log(avctx, AV_LOG_ERROR, "framelist full\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
avcodec_get_frame_defaults(&pic->avframe);
|
av_frame_unref(pic->avframe);
|
||||||
|
|
||||||
/* [DIRAC_STD] Defined in 9.6.1 ... */
|
/* [DIRAC_STD] Defined in 9.6.1 ... */
|
||||||
tmp = parse_code & 0x03; /* [DIRAC_STD] num_refs() */
|
tmp = parse_code & 0x03; /* [DIRAC_STD] num_refs() */
|
||||||
|
@ -1810,16 +1843,16 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
|
||||||
s->num_refs = tmp;
|
s->num_refs = tmp;
|
||||||
s->is_arith = (parse_code & 0x48) == 0x08; /* [DIRAC_STD] using_ac() */
|
s->is_arith = (parse_code & 0x48) == 0x08; /* [DIRAC_STD] using_ac() */
|
||||||
s->low_delay = (parse_code & 0x88) == 0x88; /* [DIRAC_STD] is_low_delay() */
|
s->low_delay = (parse_code & 0x88) == 0x88; /* [DIRAC_STD] is_low_delay() */
|
||||||
AV_NOWARN_DEPRECATED( pic->avframe.reference = (parse_code & 0x0C) == 0x0C; ); /* [DIRAC_STD] is_reference() */
|
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->key_frame = s->num_refs == 0; /* [DIRAC_STD] is_intra() */
|
||||||
pic->avframe.pict_type = s->num_refs + 1; /* Definition of AVPictureType in avutil.h */
|
pic->avframe->pict_type = s->num_refs + 1; /* Definition of AVPictureType in avutil.h */
|
||||||
|
|
||||||
if ((ret = ff_get_buffer(avctx, &pic->avframe, (parse_code & 0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
|
if ((ret = get_buffer_with_edge(avctx, pic->avframe, (parse_code & 0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
s->current_picture = pic;
|
s->current_picture = pic;
|
||||||
s->plane[0].stride = pic->avframe.linesize[0];
|
s->plane[0].stride = pic->avframe->linesize[0];
|
||||||
s->plane[1].stride = pic->avframe.linesize[1];
|
s->plane[1].stride = pic->avframe->linesize[1];
|
||||||
s->plane[2].stride = pic->avframe.linesize[2];
|
s->plane[2].stride = pic->avframe->linesize[2];
|
||||||
|
|
||||||
/* [DIRAC_STD] 11.1 Picture parse. picture_parse() */
|
/* [DIRAC_STD] 11.1 Picture parse. picture_parse() */
|
||||||
if (dirac_decode_picture_header(s))
|
if (dirac_decode_picture_header(s))
|
||||||
|
@ -1835,7 +1868,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
|
||||||
static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
|
static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
DiracContext *s = avctx->priv_data;
|
DiracContext *s = avctx->priv_data;
|
||||||
DiracFrame *picture = data;
|
AVFrame *picture = data;
|
||||||
uint8_t *buf = pkt->data;
|
uint8_t *buf = pkt->data;
|
||||||
int buf_size = pkt->size;
|
int buf_size = pkt->size;
|
||||||
int i, data_unit_size, buf_idx = 0;
|
int i, data_unit_size, buf_idx = 0;
|
||||||
|
@ -1843,12 +1876,10 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
|
|
||||||
/* release unused frames */
|
/* release unused frames */
|
||||||
for (i = 0; i < MAX_FRAMES; i++)
|
for (i = 0; i < MAX_FRAMES; i++)
|
||||||
AV_NOWARN_DEPRECATED(
|
if (s->all_frames[i].avframe->data[0] && !s->all_frames[i].avframe->reference) {
|
||||||
if (s->all_frames[i].avframe.data[0] && !s->all_frames[i].avframe.reference) {
|
av_frame_unref(s->all_frames[i].avframe);
|
||||||
av_frame_unref(&s->all_frames[i].avframe);
|
|
||||||
memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated));
|
memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated));
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
s->current_picture = NULL;
|
s->current_picture = NULL;
|
||||||
*got_frame = 0;
|
*got_frame = 0;
|
||||||
|
@ -1891,40 +1922,40 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
if (!s->current_picture)
|
if (!s->current_picture)
|
||||||
return buf_size;
|
return buf_size;
|
||||||
|
|
||||||
if (s->current_picture->avframe.display_picture_number > s->frame_number) {
|
if (s->current_picture->avframe->display_picture_number > s->frame_number) {
|
||||||
DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number);
|
DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number);
|
||||||
|
|
||||||
AV_NOWARN_DEPRECATED( s->current_picture->avframe.reference |= DELAYED_PIC_REF; );
|
s->current_picture->avframe->reference |= DELAYED_PIC_REF;
|
||||||
|
|
||||||
if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) {
|
if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) {
|
||||||
int min_num = s->delay_frames[0]->avframe.display_picture_number;
|
int min_num = s->delay_frames[0]->avframe->display_picture_number;
|
||||||
/* Too many delayed frames, so we display the frame with the lowest pts */
|
/* Too many delayed frames, so we display the frame with the lowest pts */
|
||||||
av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n");
|
av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n");
|
||||||
delayed_frame = s->delay_frames[0];
|
delayed_frame = s->delay_frames[0];
|
||||||
|
|
||||||
for (i = 1; s->delay_frames[i]; i++)
|
for (i = 1; s->delay_frames[i]; i++)
|
||||||
if (s->delay_frames[i]->avframe.display_picture_number < min_num)
|
if (s->delay_frames[i]->avframe->display_picture_number < min_num)
|
||||||
min_num = s->delay_frames[i]->avframe.display_picture_number;
|
min_num = s->delay_frames[i]->avframe->display_picture_number;
|
||||||
|
|
||||||
delayed_frame = remove_frame(s->delay_frames, min_num);
|
delayed_frame = remove_frame(s->delay_frames, min_num);
|
||||||
add_frame(s->delay_frames, MAX_DELAY, s->current_picture);
|
add_frame(s->delay_frames, MAX_DELAY, s->current_picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delayed_frame) {
|
if (delayed_frame) {
|
||||||
AV_NOWARN_DEPRECATED( delayed_frame->avframe.reference ^= DELAYED_PIC_REF; );
|
delayed_frame->avframe->reference ^= DELAYED_PIC_REF;
|
||||||
if((ret=av_frame_ref(data, &delayed_frame->avframe)) < 0)
|
if((ret=av_frame_ref(data, delayed_frame->avframe)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
}
|
}
|
||||||
} else if (s->current_picture->avframe.display_picture_number == s->frame_number) {
|
} else if (s->current_picture->avframe->display_picture_number == s->frame_number) {
|
||||||
/* The right frame at the right time :-) */
|
/* The right frame at the right time :-) */
|
||||||
if((ret=av_frame_ref(data, &s->current_picture->avframe)) < 0)
|
if((ret=av_frame_ref(data, s->current_picture->avframe)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*got_frame)
|
if (*got_frame)
|
||||||
s->frame_number = picture->avframe.display_picture_number + 1;
|
s->frame_number = picture->display_picture_number + 1;
|
||||||
|
|
||||||
return buf_idx;
|
return buf_idx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,23 +346,22 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
|
||||||
if (get_bits1(gbc)) {
|
if (get_bits1(gbc)) {
|
||||||
/* center and surround mix levels */
|
/* center and surround mix levels */
|
||||||
if (s->channel_mode > AC3_CHMODE_STEREO) {
|
if (s->channel_mode > AC3_CHMODE_STEREO) {
|
||||||
skip_bits(gbc, 2); // skip preferred stereo downmix mode
|
s->preferred_downmix = get_bits(gbc, 2);
|
||||||
if (s->channel_mode & 1) {
|
if (s->channel_mode & 1) {
|
||||||
/* if three front channels exist */
|
/* if three front channels exist */
|
||||||
skip_bits(gbc, 3); //skip Lt/Rt center mix level
|
s->center_mix_level_ltrt = get_bits(gbc, 3);
|
||||||
s->center_mix_level = get_bits(gbc, 3);
|
s->center_mix_level = get_bits(gbc, 3);
|
||||||
}
|
}
|
||||||
if (s->channel_mode & 4) {
|
if (s->channel_mode & 4) {
|
||||||
/* if a surround channel exists */
|
/* if a surround channel exists */
|
||||||
skip_bits(gbc, 3); //skip Lt/Rt surround mix level
|
s->surround_mix_level_ltrt = av_clip(get_bits(gbc, 3), 3, 7);
|
||||||
s->surround_mix_level = get_bits(gbc, 3);
|
s->surround_mix_level = av_clip(get_bits(gbc, 3), 3, 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lfe mix level */
|
/* lfe mix level */
|
||||||
if (s->lfe_on && get_bits1(gbc)) {
|
if (s->lfe_on && (s->lfe_mix_level_exists = get_bits1(gbc))) {
|
||||||
// TODO: use LFE mix level
|
s->lfe_mix_level = get_bits(gbc, 5);
|
||||||
skip_bits(gbc, 5); // skip LFE mix level code
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* info for mixing with other streams and substreams */
|
/* info for mixing with other streams and substreams */
|
||||||
|
@ -414,10 +413,11 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
|
||||||
s->bitstream_mode = get_bits(gbc, 3);
|
s->bitstream_mode = get_bits(gbc, 3);
|
||||||
skip_bits(gbc, 2); // skip copyright bit and original bitstream bit
|
skip_bits(gbc, 2); // skip copyright bit and original bitstream bit
|
||||||
if (s->channel_mode == AC3_CHMODE_STEREO) {
|
if (s->channel_mode == AC3_CHMODE_STEREO) {
|
||||||
skip_bits(gbc, 4); // skip Dolby surround and headphone mode
|
s->dolby_surround_mode = get_bits(gbc, 2);
|
||||||
|
s->dolby_headphone_mode = get_bits(gbc, 2);
|
||||||
}
|
}
|
||||||
if (s->channel_mode >= AC3_CHMODE_2F2R) {
|
if (s->channel_mode >= AC3_CHMODE_2F2R) {
|
||||||
skip_bits(gbc, 2); // skip Dolby surround EX mode
|
s->dolby_surround_ex_mode = get_bits(gbc, 2);
|
||||||
}
|
}
|
||||||
for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
|
for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
|
||||||
if (get_bits1(gbc)) {
|
if (get_bits1(gbc)) {
|
||||||
|
|
|
@ -27,11 +27,13 @@
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "libavutil/internal.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "error_resilience.h"
|
#include "error_resilience.h"
|
||||||
#include "mpegvideo.h"
|
#include "mpegvideo.h"
|
||||||
#include "rectangle.h"
|
#include "rectangle.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param stride the number of MVs to get to the next row
|
* @param stride the number of MVs to get to the next row
|
||||||
|
@ -698,8 +700,8 @@ static int is_intra_more_likely(ERContext *s)
|
||||||
return 0; // almost all MBs damaged -> use temporal prediction
|
return 0; // almost all MBs damaged -> use temporal prediction
|
||||||
|
|
||||||
// prevent dsp.sad() check, that requires access to the image
|
// prevent dsp.sad() check, that requires access to the image
|
||||||
if (CONFIG_MPEG_XVMC_DECODER &&
|
if (CONFIG_XVMC &&
|
||||||
s->avctx->xvmc_acceleration &&
|
s->avctx->hwaccel && s->avctx->hwaccel->decode_mb &&
|
||||||
s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I)
|
s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -753,7 +755,7 @@ static int is_intra_more_likely(ERContext *s)
|
||||||
|
|
||||||
void ff_er_frame_start(ERContext *s)
|
void ff_er_frame_start(ERContext *s)
|
||||||
{
|
{
|
||||||
if (!s->avctx->err_recognition)
|
if (!s->avctx->error_concealment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(s->error_status_table, ER_MB_ERROR | VP_START | ER_MB_END,
|
memset(s->error_status_table, ER_MB_ERROR | VP_START | ER_MB_END,
|
||||||
|
@ -762,6 +764,17 @@ void ff_er_frame_start(ERContext *s)
|
||||||
s->error_occurred = 0;
|
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.
|
* Add a slice.
|
||||||
* @param endx x component of the last macroblock, can be -1
|
* @param endx x component of the last macroblock, can be -1
|
||||||
|
@ -778,7 +791,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
|
||||||
const int end_xy = s->mb_index2xy[end_i];
|
const int end_xy = s->mb_index2xy[end_i];
|
||||||
int mask = -1;
|
int mask = -1;
|
||||||
|
|
||||||
if (s->avctx->hwaccel)
|
if (s->avctx->hwaccel && s->avctx->hwaccel->decode_slice)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (start_i > end_i || start_xy > end_xy) {
|
if (start_i > end_i || start_xy > end_xy) {
|
||||||
|
@ -787,7 +800,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->avctx->err_recognition)
|
if (!s->avctx->error_concealment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mask &= ~VP_START;
|
mask &= ~VP_START;
|
||||||
|
@ -828,7 +841,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
|
||||||
s->error_status_table[start_xy] |= VP_START;
|
s->error_status_table[start_xy] |= VP_START;
|
||||||
|
|
||||||
if (start_xy > 0 && !(s->avctx->active_thread_type & FF_THREAD_SLICE) &&
|
if (start_xy > 0 && !(s->avctx->active_thread_type & FF_THREAD_SLICE) &&
|
||||||
s->avctx->skip_top * s->mb_width < start_i) {
|
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]];
|
int prev_status = s->error_status_table[s->mb_index2xy[start_i - 1]];
|
||||||
|
|
||||||
prev_status &= ~ VP_START;
|
prev_status &= ~ VP_START;
|
||||||
|
@ -851,11 +864,9 @@ void ff_er_frame_end(ERContext *s)
|
||||||
|
|
||||||
/* We do not support ER of field pictures yet,
|
/* We do not support ER of field pictures yet,
|
||||||
* though it should not crash if enabled. */
|
* though it should not crash if enabled. */
|
||||||
if (!s->avctx->err_recognition || s->error_count == 0 ||
|
if (!s->avctx->error_concealment || s->error_count == 0 ||
|
||||||
s->avctx->lowres ||
|
s->avctx->lowres ||
|
||||||
s->avctx->hwaccel ||
|
!er_supported(s) ||
|
||||||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
|
|
||||||
!s->cur_pic || s->cur_pic->field_picture ||
|
|
||||||
s->error_count == 3 * s->mb_width *
|
s->error_count == 3 * s->mb_width *
|
||||||
(s->avctx->skip_top + s->avctx->skip_bottom)) {
|
(s->avctx->skip_top + s->avctx->skip_bottom)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1173,8 +1184,8 @@ void ff_er_frame_end(ERContext *s)
|
||||||
} else
|
} else
|
||||||
guess_mv(s);
|
guess_mv(s);
|
||||||
|
|
||||||
/* the filters below are not XvMC compatible, skip them */
|
/* the filters below manipulate raw image, skip them */
|
||||||
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
|
if (CONFIG_XVMC && s->avctx->hwaccel && s->avctx->hwaccel->decode_mb)
|
||||||
goto ec_clean;
|
goto ec_clean;
|
||||||
/* fill DC for inter blocks */
|
/* fill DC for inter blocks */
|
||||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||||
|
|
|
@ -126,6 +126,31 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){
|
||||||
|| !(avctx->codec->capabilities & CODEC_CAP_INTRA_ONLY))
|
|| !(avctx->codec->capabilities & CODEC_CAP_INTRA_ONLY))
|
||||||
return 0;
|
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) {
|
if(!avctx->thread_count) {
|
||||||
avctx->thread_count = av_cpu_count();
|
avctx->thread_count = av_cpu_count();
|
||||||
avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS);
|
avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS);
|
||||||
|
|
|
@ -97,6 +97,7 @@ typedef struct G726Context {
|
||||||
int sez; /**< estimated second order prediction */
|
int sez; /**< estimated second order prediction */
|
||||||
int y; /**< quantizer scaling factor for the next iteration */
|
int y; /**< quantizer scaling factor for the next iteration */
|
||||||
int code_size;
|
int code_size;
|
||||||
|
int little_endian; /**< little-endian bitstream as used in aiff and Sun AU */
|
||||||
} G726Context;
|
} G726Context;
|
||||||
|
|
||||||
static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */
|
static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */
|
||||||
|
@ -397,7 +398,7 @@ AVCodec ff_adpcm_g726_encoder = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_ADPCM_G726_DECODER
|
#if CONFIG_ADPCM_G726_DECODER || CONFIG_ADPCM_G726LE_DECODER
|
||||||
static av_cold int g726_decode_init(AVCodecContext *avctx)
|
static av_cold int g726_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
G726Context* c = avctx->priv_data;
|
G726Context* c = avctx->priv_data;
|
||||||
|
@ -409,6 +410,8 @@ static av_cold int g726_decode_init(AVCodecContext *avctx)
|
||||||
avctx->channels = 1;
|
avctx->channels = 1;
|
||||||
avctx->channel_layout = AV_CH_LAYOUT_MONO;
|
avctx->channel_layout = AV_CH_LAYOUT_MONO;
|
||||||
|
|
||||||
|
c->little_endian = !strcmp(avctx->codec->name, "g726le");
|
||||||
|
|
||||||
c->code_size = avctx->bits_per_coded_sample;
|
c->code_size = avctx->bits_per_coded_sample;
|
||||||
if (c->code_size < 2 || c->code_size > 5) {
|
if (c->code_size < 2 || c->code_size > 5) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size);
|
av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size);
|
||||||
|
@ -443,7 +446,9 @@ static int g726_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
init_get_bits(&gb, buf, buf_size * 8);
|
init_get_bits(&gb, buf, buf_size * 8);
|
||||||
|
|
||||||
while (out_samples--)
|
while (out_samples--)
|
||||||
*samples++ = g726_decode(c, get_bits(&gb, c->code_size));
|
*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)
|
if (get_bits_left(&gb) > 0)
|
||||||
av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");
|
av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");
|
||||||
|
@ -458,7 +463,9 @@ static void g726_decode_flush(AVCodecContext *avctx)
|
||||||
G726Context *c = avctx->priv_data;
|
G726Context *c = avctx->priv_data;
|
||||||
g726_reset(c);
|
g726_reset(c);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ADPCM_G726_DECODER
|
||||||
AVCodec ff_adpcm_g726_decoder = {
|
AVCodec ff_adpcm_g726_decoder = {
|
||||||
.name = "g726",
|
.name = "g726",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
|
.long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
|
||||||
|
@ -471,3 +478,17 @@ AVCodec ff_adpcm_g726_decoder = {
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
#endif
|
#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
|
||||||
|
|
|
@ -22,10 +22,24 @@
|
||||||
#define AVCODEC_GSM_H
|
#define AVCODEC_GSM_H
|
||||||
|
|
||||||
/* bytes per block */
|
/* bytes per block */
|
||||||
#define GSM_BLOCK_SIZE 33
|
#define GSM_BLOCK_SIZE 33
|
||||||
#define GSM_MS_BLOCK_SIZE 65
|
#define GSM_MS_BLOCK_SIZE 65
|
||||||
|
#define MSN_MIN_BLOCK_SIZE 41
|
||||||
|
|
||||||
/* samples per block */
|
/* samples per block */
|
||||||
#define GSM_FRAME_SIZE 160
|
#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 */
|
#endif /* AVCODEC_GSM_H */
|
||||||
|
|
|
@ -50,7 +50,8 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
|
||||||
s->duration = GSM_FRAME_SIZE;
|
s->duration = GSM_FRAME_SIZE;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_GSM_MS:
|
case AV_CODEC_ID_GSM_MS:
|
||||||
s->block_size = GSM_MS_BLOCK_SIZE;
|
s->block_size = avctx->block_align ? avctx->block_align
|
||||||
|
: GSM_MS_BLOCK_SIZE;
|
||||||
s->duration = GSM_FRAME_SIZE * 2;
|
s->duration = GSM_FRAME_SIZE * 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -34,14 +34,6 @@
|
||||||
|
|
||||||
static av_cold int gsm_init(AVCodecContext *avctx)
|
static av_cold int gsm_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
if (avctx->codec_tag == 0x0032 &&
|
|
||||||
avctx->bit_rate != 13000 &&
|
|
||||||
avctx->bit_rate != 17912 &&
|
|
||||||
avctx->bit_rate != 35824 &&
|
|
||||||
avctx->bit_rate != 71656) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unsupported audio mode\n");
|
|
||||||
return AVERROR_PATCHWELCOME;
|
|
||||||
}
|
|
||||||
avctx->channels = 1;
|
avctx->channels = 1;
|
||||||
avctx->channel_layout = AV_CH_LAYOUT_MONO;
|
avctx->channel_layout = AV_CH_LAYOUT_MONO;
|
||||||
if (!avctx->sample_rate)
|
if (!avctx->sample_rate)
|
||||||
|
@ -55,8 +47,16 @@ static av_cold int gsm_init(AVCodecContext *avctx)
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_GSM_MS:
|
case AV_CODEC_ID_GSM_MS:
|
||||||
avctx->frame_size = 2 * GSM_FRAME_SIZE;
|
avctx->frame_size = 2 * GSM_FRAME_SIZE;
|
||||||
avctx->block_align = GSM_MS_BLOCK_SIZE;
|
if (!avctx->block_align)
|
||||||
default: break;
|
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;
|
return 0;
|
||||||
|
@ -88,12 +88,13 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
init_get_bits(&gb, buf, buf_size * 8);
|
init_get_bits(&gb, buf, buf_size * 8);
|
||||||
if (get_bits(&gb, 4) != 0xd)
|
if (get_bits(&gb, 4) != 0xd)
|
||||||
av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n");
|
av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n");
|
||||||
res = gsm_decode_block(avctx, samples, &gb);
|
res = gsm_decode_block(avctx, samples, &gb, GSM_13000);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_GSM_MS:
|
case AV_CODEC_ID_GSM_MS:
|
||||||
res = ff_msgsm_decode_block(avctx, samples, buf);
|
res = ff_msgsm_decode_block(avctx, samples, buf,
|
||||||
|
(GSM_MS_BLOCK_SIZE - avctx->block_align) / 3);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
@ -92,3 +92,29 @@ const int16_t ff_gsm_dequant_tab[64][8] = {
|
||||||
{-26879, -19199, -11520, -3840, 3840, 11520, 19199, 26879},
|
{-26879, -19199, -11520, -3840, 3840, 11520, 19199, 26879},
|
||||||
{-28671, -20479, -12288, -4096, 4096, 12288, 20479, 28671}
|
{-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
|
||||||
|
};
|
||||||
|
|
|
@ -40,4 +40,6 @@ typedef struct GSMContext {
|
||||||
extern const uint16_t ff_gsm_long_term_gain_tab[4];
|
extern const uint16_t ff_gsm_long_term_gain_tab[4];
|
||||||
extern const int16_t ff_gsm_dequant_tab[64][8];
|
extern const int16_t ff_gsm_dequant_tab[64][8];
|
||||||
|
|
||||||
|
extern const int* const ff_gsm_apcm_bits[][4];
|
||||||
|
|
||||||
#endif /* AVCODEC_GSMDEC_DATA_H */
|
#endif /* AVCODEC_GSMDEC_DATA_H */
|
||||||
|
|
|
@ -28,13 +28,22 @@
|
||||||
#include "gsm.h"
|
#include "gsm.h"
|
||||||
#include "gsmdec_data.h"
|
#include "gsmdec_data.h"
|
||||||
|
|
||||||
static void apcm_dequant_add(GetBitContext *gb, int16_t *dst)
|
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;
|
int i, val;
|
||||||
int maxidx = get_bits(gb, 6);
|
int maxidx = get_bits(gb, 6);
|
||||||
const int16_t *tab = ff_gsm_dequant_tab[maxidx];
|
const int16_t *tab = ff_gsm_dequant_tab[maxidx];
|
||||||
for (i = 0; i < 13; i++)
|
for (i = 0; i < 13; i++) {
|
||||||
dst[3*i] += tab[get_bits(gb, 3)];
|
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)
|
static inline int gsm_mult(int a, int b)
|
||||||
|
@ -118,7 +127,7 @@ static int postprocess(int16_t *data, int msr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
||||||
GetBitContext *gb)
|
GetBitContext *gb, int mode)
|
||||||
{
|
{
|
||||||
GSMContext *ctx = avctx->priv_data;
|
GSMContext *ctx = avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -139,7 +148,7 @@ static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
||||||
int offset = get_bits(gb, 2);
|
int offset = get_bits(gb, 2);
|
||||||
lag = av_clip(lag, 40, 120);
|
lag = av_clip(lag, 40, 120);
|
||||||
long_term_synth(ref_dst, lag, gain_idx);
|
long_term_synth(ref_dst, lag, gain_idx);
|
||||||
apcm_dequant_add(gb, ref_dst + offset);
|
apcm_dequant_add(gb, ref_dst + offset, ff_gsm_apcm_bits[mode][i]);
|
||||||
ref_dst += 40;
|
ref_dst += 40;
|
||||||
}
|
}
|
||||||
memcpy(ctx->ref_buf, ctx->ref_buf + 160, 120 * sizeof(*ctx->ref_buf));
|
memcpy(ctx->ref_buf, ctx->ref_buf + 160, 120 * sizeof(*ctx->ref_buf));
|
||||||
|
|
|
@ -56,6 +56,8 @@ av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
|
||||||
hpel_funcs(avg, [3], 2);
|
hpel_funcs(avg, [3], 2);
|
||||||
hpel_funcs(avg_no_rnd,, 16);
|
hpel_funcs(avg_no_rnd,, 16);
|
||||||
|
|
||||||
|
if (ARCH_AARCH64)
|
||||||
|
ff_hpeldsp_init_aarch64(c, flags);
|
||||||
if (ARCH_ALPHA)
|
if (ARCH_ALPHA)
|
||||||
ff_hpeldsp_init_alpha(c, flags);
|
ff_hpeldsp_init_alpha(c, flags);
|
||||||
if (ARCH_ARM)
|
if (ARCH_ARM)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "libavutil/buffer.h"
|
#include "libavutil/buffer.h"
|
||||||
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/pixfmt.h"
|
#include "libavutil/pixfmt.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
@ -91,10 +92,18 @@ typedef struct AVCodecInternal {
|
||||||
*/
|
*/
|
||||||
int last_audio_frame;
|
int last_audio_frame;
|
||||||
|
|
||||||
AVFrame to_free;
|
AVFrame *to_free;
|
||||||
|
|
||||||
FramePool *pool;
|
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
|
* temporary buffer used for encoders to store their bitstream
|
||||||
*/
|
*/
|
||||||
|
@ -118,11 +127,10 @@ struct AVCodecDefault {
|
||||||
* Return the hardware accelerated codec for codec codec_id and
|
* Return the hardware accelerated codec for codec codec_id and
|
||||||
* pixel format pix_fmt.
|
* pixel format pix_fmt.
|
||||||
*
|
*
|
||||||
* @param codec_id the codec to match
|
* @param avctx The codec context containing the codec_id and pixel format.
|
||||||
* @param pix_fmt the pixel format to match
|
|
||||||
* @return the hardware accelerated codec, or NULL if none was found.
|
* @return the hardware accelerated codec, or NULL if none was found.
|
||||||
*/
|
*/
|
||||||
AVHWAccel *ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt);
|
AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
|
* Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
|
||||||
|
@ -225,4 +233,16 @@ const uint8_t *avpriv_find_start_code(const uint8_t *p,
|
||||||
const uint8_t *end,
|
const uint8_t *end,
|
||||||
uint32_t *state);
|
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 */
|
#endif /* AVCODEC_INTERNAL_H */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/lls.h"
|
#include "libavutil/lls2.h"
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
|
|
||||||
#define LPC_USE_DOUBLE
|
#define LPC_USE_DOUBLE
|
||||||
|
@ -209,7 +209,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
|
if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
|
||||||
LLSModel m[2];
|
LLSModel2 m[2];
|
||||||
LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
|
LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
|
||||||
double av_uninit(weight);
|
double av_uninit(weight);
|
||||||
memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
|
memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
|
||||||
|
@ -218,7 +218,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||||
m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
|
m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
|
||||||
|
|
||||||
for(; pass<lpc_passes; pass++){
|
for(; pass<lpc_passes; pass++){
|
||||||
avpriv_init_lls(&m[pass&1], max_order);
|
avpriv_init_lls2(&m[pass&1], max_order);
|
||||||
|
|
||||||
weight=0;
|
weight=0;
|
||||||
for(i=max_order; i<blocksize; i++){
|
for(i=max_order; i<blocksize; i++){
|
||||||
|
@ -239,7 +239,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||||
|
|
||||||
m[pass&1].update_lls(&m[pass&1], var);
|
m[pass&1].update_lls(&m[pass&1], var);
|
||||||
}
|
}
|
||||||
avpriv_solve_lls(&m[pass&1], 0.001, 0);
|
avpriv_solve_lls2(&m[pass&1], 0.001, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<max_order; i++){
|
for(i=0; i<max_order; i++){
|
||||||
|
|
|
@ -1,788 +0,0 @@
|
||||||
/*
|
|
||||||
* The simplest mpeg audio layer 2 encoder
|
|
||||||
* 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
|
|
||||||
* The simplest mpeg audio layer 2 encoder.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "libavutil/channel_layout.h"
|
|
||||||
|
|
||||||
#include "avcodec.h"
|
|
||||||
#include "internal.h"
|
|
||||||
#include "put_bits.h"
|
|
||||||
|
|
||||||
#define FRAC_BITS 15 /* fractional bits for sb_samples and dct */
|
|
||||||
#define WFRAC_BITS 14 /* fractional bits for window */
|
|
||||||
|
|
||||||
#include "mpegaudio.h"
|
|
||||||
#include "mpegaudiodsp.h"
|
|
||||||
|
|
||||||
/* currently, cannot change these constants (need to modify
|
|
||||||
quantization stage) */
|
|
||||||
#define MUL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
|
|
||||||
|
|
||||||
#define SAMPLES_BUF_SIZE 4096
|
|
||||||
|
|
||||||
typedef struct MpegAudioContext {
|
|
||||||
PutBitContext pb;
|
|
||||||
int nb_channels;
|
|
||||||
int lsf; /* 1 if mpeg2 low bitrate selected */
|
|
||||||
int bitrate_index; /* bit rate */
|
|
||||||
int freq_index;
|
|
||||||
int frame_size; /* frame size, in bits, without padding */
|
|
||||||
/* padding computation */
|
|
||||||
int frame_frac, frame_frac_incr, do_padding;
|
|
||||||
short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */
|
|
||||||
int samples_offset[MPA_MAX_CHANNELS]; /* offset in samples_buf */
|
|
||||||
int sb_samples[MPA_MAX_CHANNELS][3][12][SBLIMIT];
|
|
||||||
unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3]; /* scale factors */
|
|
||||||
/* code to group 3 scale factors */
|
|
||||||
unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT];
|
|
||||||
int sblimit; /* number of used subbands */
|
|
||||||
const unsigned char *alloc_table;
|
|
||||||
} MpegAudioContext;
|
|
||||||
|
|
||||||
/* define it to use floats in quantization (I don't like floats !) */
|
|
||||||
#define USE_FLOATS
|
|
||||||
|
|
||||||
#include "mpegaudiodata.h"
|
|
||||||
#include "mpegaudiotab.h"
|
|
||||||
|
|
||||||
static av_cold int MPA_encode_init(AVCodecContext *avctx)
|
|
||||||
{
|
|
||||||
MpegAudioContext *s = avctx->priv_data;
|
|
||||||
int freq = avctx->sample_rate;
|
|
||||||
int bitrate = avctx->bit_rate;
|
|
||||||
int channels = avctx->channels;
|
|
||||||
int i, v, table;
|
|
||||||
float a;
|
|
||||||
|
|
||||||
if (channels <= 0 || channels > 2){
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed in mp2\n", channels);
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
bitrate = bitrate / 1000;
|
|
||||||
s->nb_channels = channels;
|
|
||||||
avctx->frame_size = MPA_FRAME_SIZE;
|
|
||||||
avctx->delay = 512 - 32 + 1;
|
|
||||||
|
|
||||||
/* encoding freq */
|
|
||||||
s->lsf = 0;
|
|
||||||
for(i=0;i<3;i++) {
|
|
||||||
if (avpriv_mpa_freq_tab[i] == freq)
|
|
||||||
break;
|
|
||||||
if ((avpriv_mpa_freq_tab[i] / 2) == freq) {
|
|
||||||
s->lsf = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i == 3){
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Sampling rate %d is not allowed in mp2\n", freq);
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
s->freq_index = i;
|
|
||||||
|
|
||||||
/* encoding bitrate & frequency */
|
|
||||||
for(i=0;i<15;i++) {
|
|
||||||
if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == 15){
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate);
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
s->bitrate_index = i;
|
|
||||||
|
|
||||||
/* compute total header size & pad bit */
|
|
||||||
|
|
||||||
a = (float)(bitrate * 1000 * MPA_FRAME_SIZE) / (freq * 8.0);
|
|
||||||
s->frame_size = ((int)a) * 8;
|
|
||||||
|
|
||||||
/* frame fractional size to compute padding */
|
|
||||||
s->frame_frac = 0;
|
|
||||||
s->frame_frac_incr = (int)((a - floor(a)) * 65536.0);
|
|
||||||
|
|
||||||
/* select the right allocation table */
|
|
||||||
table = ff_mpa_l2_select_table(bitrate, s->nb_channels, freq, s->lsf);
|
|
||||||
|
|
||||||
/* number of used subbands */
|
|
||||||
s->sblimit = ff_mpa_sblimit_table[table];
|
|
||||||
s->alloc_table = ff_mpa_alloc_tables[table];
|
|
||||||
|
|
||||||
av_dlog(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
|
|
||||||
bitrate, freq, s->frame_size, table, s->frame_frac_incr);
|
|
||||||
|
|
||||||
for(i=0;i<s->nb_channels;i++)
|
|
||||||
s->samples_offset[i] = 0;
|
|
||||||
|
|
||||||
for(i=0;i<257;i++) {
|
|
||||||
int v;
|
|
||||||
v = ff_mpa_enwindow[i];
|
|
||||||
#if WFRAC_BITS != 16
|
|
||||||
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
|
|
||||||
#endif
|
|
||||||
filter_bank[i] = v;
|
|
||||||
if ((i & 63) != 0)
|
|
||||||
v = -v;
|
|
||||||
if (i != 0)
|
|
||||||
filter_bank[512 - i] = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=0;i<64;i++) {
|
|
||||||
v = (int)(exp2((3 - i) / 3.0) * (1 << 20));
|
|
||||||
if (v <= 0)
|
|
||||||
v = 1;
|
|
||||||
scale_factor_table[i] = v;
|
|
||||||
#ifdef USE_FLOATS
|
|
||||||
scale_factor_inv_table[i] = exp2(-(3 - i) / 3.0) / (float)(1 << 20);
|
|
||||||
#else
|
|
||||||
#define P 15
|
|
||||||
scale_factor_shift[i] = 21 - P - (i / 3);
|
|
||||||
scale_factor_mult[i] = (1 << P) * exp2((i % 3) / 3.0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
for(i=0;i<128;i++) {
|
|
||||||
v = i - 64;
|
|
||||||
if (v <= -3)
|
|
||||||
v = 0;
|
|
||||||
else if (v < 0)
|
|
||||||
v = 1;
|
|
||||||
else if (v == 0)
|
|
||||||
v = 2;
|
|
||||||
else if (v < 3)
|
|
||||||
v = 3;
|
|
||||||
else
|
|
||||||
v = 4;
|
|
||||||
scale_diff_table[i] = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=0;i<17;i++) {
|
|
||||||
v = ff_mpa_quant_bits[i];
|
|
||||||
if (v < 0)
|
|
||||||
v = -v;
|
|
||||||
else
|
|
||||||
v = v * 3;
|
|
||||||
total_quant_bits[i] = 12 * v;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 32 point floating point IDCT without 1/sqrt(2) coef zero scaling */
|
|
||||||
static void idct32(int *out, int *tab)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
int *t, *t1, xr;
|
|
||||||
const int *xp = costab32;
|
|
||||||
|
|
||||||
for(j=31;j>=3;j-=2) tab[j] += tab[j - 2];
|
|
||||||
|
|
||||||
t = tab + 30;
|
|
||||||
t1 = tab + 2;
|
|
||||||
do {
|
|
||||||
t[0] += t[-4];
|
|
||||||
t[1] += t[1 - 4];
|
|
||||||
t -= 4;
|
|
||||||
} while (t != t1);
|
|
||||||
|
|
||||||
t = tab + 28;
|
|
||||||
t1 = tab + 4;
|
|
||||||
do {
|
|
||||||
t[0] += t[-8];
|
|
||||||
t[1] += t[1-8];
|
|
||||||
t[2] += t[2-8];
|
|
||||||
t[3] += t[3-8];
|
|
||||||
t -= 8;
|
|
||||||
} while (t != t1);
|
|
||||||
|
|
||||||
t = tab;
|
|
||||||
t1 = tab + 32;
|
|
||||||
do {
|
|
||||||
t[ 3] = -t[ 3];
|
|
||||||
t[ 6] = -t[ 6];
|
|
||||||
|
|
||||||
t[11] = -t[11];
|
|
||||||
t[12] = -t[12];
|
|
||||||
t[13] = -t[13];
|
|
||||||
t[15] = -t[15];
|
|
||||||
t += 16;
|
|
||||||
} while (t != t1);
|
|
||||||
|
|
||||||
|
|
||||||
t = tab;
|
|
||||||
t1 = tab + 8;
|
|
||||||
do {
|
|
||||||
int x1, x2, x3, x4;
|
|
||||||
|
|
||||||
x3 = MUL(t[16], FIX(SQRT2*0.5));
|
|
||||||
x4 = t[0] - x3;
|
|
||||||
x3 = t[0] + x3;
|
|
||||||
|
|
||||||
x2 = MUL(-(t[24] + t[8]), FIX(SQRT2*0.5));
|
|
||||||
x1 = MUL((t[8] - x2), xp[0]);
|
|
||||||
x2 = MUL((t[8] + x2), xp[1]);
|
|
||||||
|
|
||||||
t[ 0] = x3 + x1;
|
|
||||||
t[ 8] = x4 - x2;
|
|
||||||
t[16] = x4 + x2;
|
|
||||||
t[24] = x3 - x1;
|
|
||||||
t++;
|
|
||||||
} while (t != t1);
|
|
||||||
|
|
||||||
xp += 2;
|
|
||||||
t = tab;
|
|
||||||
t1 = tab + 4;
|
|
||||||
do {
|
|
||||||
xr = MUL(t[28],xp[0]);
|
|
||||||
t[28] = (t[0] - xr);
|
|
||||||
t[0] = (t[0] + xr);
|
|
||||||
|
|
||||||
xr = MUL(t[4],xp[1]);
|
|
||||||
t[ 4] = (t[24] - xr);
|
|
||||||
t[24] = (t[24] + xr);
|
|
||||||
|
|
||||||
xr = MUL(t[20],xp[2]);
|
|
||||||
t[20] = (t[8] - xr);
|
|
||||||
t[ 8] = (t[8] + xr);
|
|
||||||
|
|
||||||
xr = MUL(t[12],xp[3]);
|
|
||||||
t[12] = (t[16] - xr);
|
|
||||||
t[16] = (t[16] + xr);
|
|
||||||
t++;
|
|
||||||
} while (t != t1);
|
|
||||||
xp += 4;
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
|
||||||
xr = MUL(tab[30-i*4],xp[0]);
|
|
||||||
tab[30-i*4] = (tab[i*4] - xr);
|
|
||||||
tab[ i*4] = (tab[i*4] + xr);
|
|
||||||
|
|
||||||
xr = MUL(tab[ 2+i*4],xp[1]);
|
|
||||||
tab[ 2+i*4] = (tab[28-i*4] - xr);
|
|
||||||
tab[28-i*4] = (tab[28-i*4] + xr);
|
|
||||||
|
|
||||||
xr = MUL(tab[31-i*4],xp[0]);
|
|
||||||
tab[31-i*4] = (tab[1+i*4] - xr);
|
|
||||||
tab[ 1+i*4] = (tab[1+i*4] + xr);
|
|
||||||
|
|
||||||
xr = MUL(tab[ 3+i*4],xp[1]);
|
|
||||||
tab[ 3+i*4] = (tab[29-i*4] - xr);
|
|
||||||
tab[29-i*4] = (tab[29-i*4] + xr);
|
|
||||||
|
|
||||||
xp += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
t = tab + 30;
|
|
||||||
t1 = tab + 1;
|
|
||||||
do {
|
|
||||||
xr = MUL(t1[0], *xp);
|
|
||||||
t1[0] = (t[0] - xr);
|
|
||||||
t[0] = (t[0] + xr);
|
|
||||||
t -= 2;
|
|
||||||
t1 += 2;
|
|
||||||
xp++;
|
|
||||||
} while (t >= tab);
|
|
||||||
|
|
||||||
for(i=0;i<32;i++) {
|
|
||||||
out[i] = tab[bitinv32[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WSHIFT (WFRAC_BITS + 15 - FRAC_BITS)
|
|
||||||
|
|
||||||
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
|
|
||||||
{
|
|
||||||
short *p, *q;
|
|
||||||
int sum, offset, i, j;
|
|
||||||
int tmp[64];
|
|
||||||
int tmp1[32];
|
|
||||||
int *out;
|
|
||||||
|
|
||||||
offset = s->samples_offset[ch];
|
|
||||||
out = &s->sb_samples[ch][0][0][0];
|
|
||||||
for(j=0;j<36;j++) {
|
|
||||||
/* 32 samples at once */
|
|
||||||
for(i=0;i<32;i++) {
|
|
||||||
s->samples_buf[ch][offset + (31 - i)] = samples[0];
|
|
||||||
samples += incr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* filter */
|
|
||||||
p = s->samples_buf[ch] + offset;
|
|
||||||
q = filter_bank;
|
|
||||||
/* maxsum = 23169 */
|
|
||||||
for(i=0;i<64;i++) {
|
|
||||||
sum = p[0*64] * q[0*64];
|
|
||||||
sum += p[1*64] * q[1*64];
|
|
||||||
sum += p[2*64] * q[2*64];
|
|
||||||
sum += p[3*64] * q[3*64];
|
|
||||||
sum += p[4*64] * q[4*64];
|
|
||||||
sum += p[5*64] * q[5*64];
|
|
||||||
sum += p[6*64] * q[6*64];
|
|
||||||
sum += p[7*64] * q[7*64];
|
|
||||||
tmp[i] = sum;
|
|
||||||
p++;
|
|
||||||
q++;
|
|
||||||
}
|
|
||||||
tmp1[0] = tmp[16] >> WSHIFT;
|
|
||||||
for( i=1; i<=16; i++ ) tmp1[i] = (tmp[i+16]+tmp[16-i]) >> WSHIFT;
|
|
||||||
for( i=17; i<=31; i++ ) tmp1[i] = (tmp[i+16]-tmp[80-i]) >> WSHIFT;
|
|
||||||
|
|
||||||
idct32(out, tmp1);
|
|
||||||
|
|
||||||
/* advance of 32 samples */
|
|
||||||
offset -= 32;
|
|
||||||
out += 32;
|
|
||||||
/* handle the wrap around */
|
|
||||||
if (offset < 0) {
|
|
||||||
memmove(s->samples_buf[ch] + SAMPLES_BUF_SIZE - (512 - 32),
|
|
||||||
s->samples_buf[ch], (512 - 32) * 2);
|
|
||||||
offset = SAMPLES_BUF_SIZE - 512;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s->samples_offset[ch] = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void compute_scale_factors(unsigned char scale_code[SBLIMIT],
|
|
||||||
unsigned char scale_factors[SBLIMIT][3],
|
|
||||||
int sb_samples[3][12][SBLIMIT],
|
|
||||||
int sblimit)
|
|
||||||
{
|
|
||||||
int *p, vmax, v, n, i, j, k, code;
|
|
||||||
int index, d1, d2;
|
|
||||||
unsigned char *sf = &scale_factors[0][0];
|
|
||||||
|
|
||||||
for(j=0;j<sblimit;j++) {
|
|
||||||
for(i=0;i<3;i++) {
|
|
||||||
/* find the max absolute value */
|
|
||||||
p = &sb_samples[i][0][j];
|
|
||||||
vmax = abs(*p);
|
|
||||||
for(k=1;k<12;k++) {
|
|
||||||
p += SBLIMIT;
|
|
||||||
v = abs(*p);
|
|
||||||
if (v > vmax)
|
|
||||||
vmax = v;
|
|
||||||
}
|
|
||||||
/* compute the scale factor index using log 2 computations */
|
|
||||||
if (vmax > 1) {
|
|
||||||
n = av_log2(vmax);
|
|
||||||
/* n is the position of the MSB of vmax. now
|
|
||||||
use at most 2 compares to find the index */
|
|
||||||
index = (21 - n) * 3 - 3;
|
|
||||||
if (index >= 0) {
|
|
||||||
while (vmax <= scale_factor_table[index+1])
|
|
||||||
index++;
|
|
||||||
} else {
|
|
||||||
index = 0; /* very unlikely case of overflow */
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
index = 62; /* value 63 is not allowed */
|
|
||||||
}
|
|
||||||
|
|
||||||
av_dlog(NULL, "%2d:%d in=%x %x %d\n",
|
|
||||||
j, i, vmax, scale_factor_table[index], index);
|
|
||||||
/* store the scale factor */
|
|
||||||
av_assert2(index >=0 && index <= 63);
|
|
||||||
sf[i] = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compute the transmission factor : look if the scale factors
|
|
||||||
are close enough to each other */
|
|
||||||
d1 = scale_diff_table[sf[0] - sf[1] + 64];
|
|
||||||
d2 = scale_diff_table[sf[1] - sf[2] + 64];
|
|
||||||
|
|
||||||
/* handle the 25 cases */
|
|
||||||
switch(d1 * 5 + d2) {
|
|
||||||
case 0*5+0:
|
|
||||||
case 0*5+4:
|
|
||||||
case 3*5+4:
|
|
||||||
case 4*5+0:
|
|
||||||
case 4*5+4:
|
|
||||||
code = 0;
|
|
||||||
break;
|
|
||||||
case 0*5+1:
|
|
||||||
case 0*5+2:
|
|
||||||
case 4*5+1:
|
|
||||||
case 4*5+2:
|
|
||||||
code = 3;
|
|
||||||
sf[2] = sf[1];
|
|
||||||
break;
|
|
||||||
case 0*5+3:
|
|
||||||
case 4*5+3:
|
|
||||||
code = 3;
|
|
||||||
sf[1] = sf[2];
|
|
||||||
break;
|
|
||||||
case 1*5+0:
|
|
||||||
case 1*5+4:
|
|
||||||
case 2*5+4:
|
|
||||||
code = 1;
|
|
||||||
sf[1] = sf[0];
|
|
||||||
break;
|
|
||||||
case 1*5+1:
|
|
||||||
case 1*5+2:
|
|
||||||
case 2*5+0:
|
|
||||||
case 2*5+1:
|
|
||||||
case 2*5+2:
|
|
||||||
code = 2;
|
|
||||||
sf[1] = sf[2] = sf[0];
|
|
||||||
break;
|
|
||||||
case 2*5+3:
|
|
||||||
case 3*5+3:
|
|
||||||
code = 2;
|
|
||||||
sf[0] = sf[1] = sf[2];
|
|
||||||
break;
|
|
||||||
case 3*5+0:
|
|
||||||
case 3*5+1:
|
|
||||||
case 3*5+2:
|
|
||||||
code = 2;
|
|
||||||
sf[0] = sf[2] = sf[1];
|
|
||||||
break;
|
|
||||||
case 1*5+3:
|
|
||||||
code = 2;
|
|
||||||
if (sf[0] > sf[2])
|
|
||||||
sf[0] = sf[2];
|
|
||||||
sf[1] = sf[2] = sf[0];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
av_assert2(0); //cannot happen
|
|
||||||
code = 0; /* kill warning */
|
|
||||||
}
|
|
||||||
|
|
||||||
av_dlog(NULL, "%d: %2d %2d %2d %d %d -> %d\n", j,
|
|
||||||
sf[0], sf[1], sf[2], d1, d2, code);
|
|
||||||
scale_code[j] = code;
|
|
||||||
sf += 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The most important function : psycho acoustic module. In this
|
|
||||||
encoder there is basically none, so this is the worst you can do,
|
|
||||||
but also this is the simpler. */
|
|
||||||
static void psycho_acoustic_model(MpegAudioContext *s, short smr[SBLIMIT])
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
smr[i] = (int)(fixed_smr[i] * 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define SB_NOTALLOCATED 0
|
|
||||||
#define SB_ALLOCATED 1
|
|
||||||
#define SB_NOMORE 2
|
|
||||||
|
|
||||||
/* Try to maximize the smr while using a number of bits inferior to
|
|
||||||
the frame size. I tried to make the code simpler, faster and
|
|
||||||
smaller than other encoders :-) */
|
|
||||||
static void compute_bit_allocation(MpegAudioContext *s,
|
|
||||||
short smr1[MPA_MAX_CHANNELS][SBLIMIT],
|
|
||||||
unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT],
|
|
||||||
int *padding)
|
|
||||||
{
|
|
||||||
int i, ch, b, max_smr, max_ch, max_sb, current_frame_size, max_frame_size;
|
|
||||||
int incr;
|
|
||||||
short smr[MPA_MAX_CHANNELS][SBLIMIT];
|
|
||||||
unsigned char subband_status[MPA_MAX_CHANNELS][SBLIMIT];
|
|
||||||
const unsigned char *alloc;
|
|
||||||
|
|
||||||
memcpy(smr, smr1, s->nb_channels * sizeof(short) * SBLIMIT);
|
|
||||||
memset(subband_status, SB_NOTALLOCATED, s->nb_channels * SBLIMIT);
|
|
||||||
memset(bit_alloc, 0, s->nb_channels * SBLIMIT);
|
|
||||||
|
|
||||||
/* compute frame size and padding */
|
|
||||||
max_frame_size = s->frame_size;
|
|
||||||
s->frame_frac += s->frame_frac_incr;
|
|
||||||
if (s->frame_frac >= 65536) {
|
|
||||||
s->frame_frac -= 65536;
|
|
||||||
s->do_padding = 1;
|
|
||||||
max_frame_size += 8;
|
|
||||||
} else {
|
|
||||||
s->do_padding = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compute the header + bit alloc size */
|
|
||||||
current_frame_size = 32;
|
|
||||||
alloc = s->alloc_table;
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
incr = alloc[0];
|
|
||||||
current_frame_size += incr * s->nb_channels;
|
|
||||||
alloc += 1 << incr;
|
|
||||||
}
|
|
||||||
for(;;) {
|
|
||||||
/* look for the subband with the largest signal to mask ratio */
|
|
||||||
max_sb = -1;
|
|
||||||
max_ch = -1;
|
|
||||||
max_smr = INT_MIN;
|
|
||||||
for(ch=0;ch<s->nb_channels;ch++) {
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
if (smr[ch][i] > max_smr && subband_status[ch][i] != SB_NOMORE) {
|
|
||||||
max_smr = smr[ch][i];
|
|
||||||
max_sb = i;
|
|
||||||
max_ch = ch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (max_sb < 0)
|
|
||||||
break;
|
|
||||||
av_dlog(NULL, "current=%d max=%d max_sb=%d max_ch=%d alloc=%d\n",
|
|
||||||
current_frame_size, max_frame_size, max_sb, max_ch,
|
|
||||||
bit_alloc[max_ch][max_sb]);
|
|
||||||
|
|
||||||
/* find alloc table entry (XXX: not optimal, should use
|
|
||||||
pointer table) */
|
|
||||||
alloc = s->alloc_table;
|
|
||||||
for(i=0;i<max_sb;i++) {
|
|
||||||
alloc += 1 << alloc[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subband_status[max_ch][max_sb] == SB_NOTALLOCATED) {
|
|
||||||
/* nothing was coded for this band: add the necessary bits */
|
|
||||||
incr = 2 + nb_scale_factors[s->scale_code[max_ch][max_sb]] * 6;
|
|
||||||
incr += total_quant_bits[alloc[1]];
|
|
||||||
} else {
|
|
||||||
/* increments bit allocation */
|
|
||||||
b = bit_alloc[max_ch][max_sb];
|
|
||||||
incr = total_quant_bits[alloc[b + 1]] -
|
|
||||||
total_quant_bits[alloc[b]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_frame_size + incr <= max_frame_size) {
|
|
||||||
/* can increase size */
|
|
||||||
b = ++bit_alloc[max_ch][max_sb];
|
|
||||||
current_frame_size += incr;
|
|
||||||
/* decrease smr by the resolution we added */
|
|
||||||
smr[max_ch][max_sb] = smr1[max_ch][max_sb] - quant_snr[alloc[b]];
|
|
||||||
/* max allocation size reached ? */
|
|
||||||
if (b == ((1 << alloc[0]) - 1))
|
|
||||||
subband_status[max_ch][max_sb] = SB_NOMORE;
|
|
||||||
else
|
|
||||||
subband_status[max_ch][max_sb] = SB_ALLOCATED;
|
|
||||||
} else {
|
|
||||||
/* cannot increase the size of this subband */
|
|
||||||
subband_status[max_ch][max_sb] = SB_NOMORE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*padding = max_frame_size - current_frame_size;
|
|
||||||
av_assert0(*padding >= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Output the mpeg audio layer 2 frame. Note how the code is small
|
|
||||||
* compared to other encoders :-)
|
|
||||||
*/
|
|
||||||
static void encode_frame(MpegAudioContext *s,
|
|
||||||
unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT],
|
|
||||||
int padding)
|
|
||||||
{
|
|
||||||
int i, j, k, l, bit_alloc_bits, b, ch;
|
|
||||||
unsigned char *sf;
|
|
||||||
int q[3];
|
|
||||||
PutBitContext *p = &s->pb;
|
|
||||||
|
|
||||||
/* header */
|
|
||||||
|
|
||||||
put_bits(p, 12, 0xfff);
|
|
||||||
put_bits(p, 1, 1 - s->lsf); /* 1 = mpeg1 ID, 0 = mpeg2 lsf ID */
|
|
||||||
put_bits(p, 2, 4-2); /* layer 2 */
|
|
||||||
put_bits(p, 1, 1); /* no error protection */
|
|
||||||
put_bits(p, 4, s->bitrate_index);
|
|
||||||
put_bits(p, 2, s->freq_index);
|
|
||||||
put_bits(p, 1, s->do_padding); /* use padding */
|
|
||||||
put_bits(p, 1, 0); /* private_bit */
|
|
||||||
put_bits(p, 2, s->nb_channels == 2 ? MPA_STEREO : MPA_MONO);
|
|
||||||
put_bits(p, 2, 0); /* mode_ext */
|
|
||||||
put_bits(p, 1, 0); /* no copyright */
|
|
||||||
put_bits(p, 1, 1); /* original */
|
|
||||||
put_bits(p, 2, 0); /* no emphasis */
|
|
||||||
|
|
||||||
/* bit allocation */
|
|
||||||
j = 0;
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
bit_alloc_bits = s->alloc_table[j];
|
|
||||||
for(ch=0;ch<s->nb_channels;ch++) {
|
|
||||||
put_bits(p, bit_alloc_bits, bit_alloc[ch][i]);
|
|
||||||
}
|
|
||||||
j += 1 << bit_alloc_bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* scale codes */
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
for(ch=0;ch<s->nb_channels;ch++) {
|
|
||||||
if (bit_alloc[ch][i])
|
|
||||||
put_bits(p, 2, s->scale_code[ch][i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* scale factors */
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
for(ch=0;ch<s->nb_channels;ch++) {
|
|
||||||
if (bit_alloc[ch][i]) {
|
|
||||||
sf = &s->scale_factors[ch][i][0];
|
|
||||||
switch(s->scale_code[ch][i]) {
|
|
||||||
case 0:
|
|
||||||
put_bits(p, 6, sf[0]);
|
|
||||||
put_bits(p, 6, sf[1]);
|
|
||||||
put_bits(p, 6, sf[2]);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
case 1:
|
|
||||||
put_bits(p, 6, sf[0]);
|
|
||||||
put_bits(p, 6, sf[2]);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
put_bits(p, 6, sf[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* quantization & write sub band samples */
|
|
||||||
|
|
||||||
for(k=0;k<3;k++) {
|
|
||||||
for(l=0;l<12;l+=3) {
|
|
||||||
j = 0;
|
|
||||||
for(i=0;i<s->sblimit;i++) {
|
|
||||||
bit_alloc_bits = s->alloc_table[j];
|
|
||||||
for(ch=0;ch<s->nb_channels;ch++) {
|
|
||||||
b = bit_alloc[ch][i];
|
|
||||||
if (b) {
|
|
||||||
int qindex, steps, m, sample, bits;
|
|
||||||
/* we encode 3 sub band samples of the same sub band at a time */
|
|
||||||
qindex = s->alloc_table[j+b];
|
|
||||||
steps = ff_mpa_quant_steps[qindex];
|
|
||||||
for(m=0;m<3;m++) {
|
|
||||||
sample = s->sb_samples[ch][k][l + m][i];
|
|
||||||
/* divide by scale factor */
|
|
||||||
#ifdef USE_FLOATS
|
|
||||||
{
|
|
||||||
float a;
|
|
||||||
a = (float)sample * scale_factor_inv_table[s->scale_factors[ch][i][k]];
|
|
||||||
q[m] = (int)((a + 1.0) * steps * 0.5);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
int q1, e, shift, mult;
|
|
||||||
e = s->scale_factors[ch][i][k];
|
|
||||||
shift = scale_factor_shift[e];
|
|
||||||
mult = scale_factor_mult[e];
|
|
||||||
|
|
||||||
/* normalize to P bits */
|
|
||||||
if (shift < 0)
|
|
||||||
q1 = sample << (-shift);
|
|
||||||
else
|
|
||||||
q1 = sample >> shift;
|
|
||||||
q1 = (q1 * mult) >> P;
|
|
||||||
q[m] = ((q1 + (1 << P)) * steps) >> (P + 1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (q[m] >= steps)
|
|
||||||
q[m] = steps - 1;
|
|
||||||
av_assert2(q[m] >= 0 && q[m] < steps);
|
|
||||||
}
|
|
||||||
bits = ff_mpa_quant_bits[qindex];
|
|
||||||
if (bits < 0) {
|
|
||||||
/* group the 3 values to save bits */
|
|
||||||
put_bits(p, -bits,
|
|
||||||
q[0] + steps * (q[1] + steps * q[2]));
|
|
||||||
} else {
|
|
||||||
put_bits(p, bits, q[0]);
|
|
||||||
put_bits(p, bits, q[1]);
|
|
||||||
put_bits(p, bits, q[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* next subband in alloc table */
|
|
||||||
j += 1 << bit_alloc_bits;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* padding */
|
|
||||||
for(i=0;i<padding;i++)
|
|
||||||
put_bits(p, 1, 0);
|
|
||||||
|
|
||||||
/* flush */
|
|
||||||
flush_put_bits(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|
||||||
const AVFrame *frame, int *got_packet_ptr)
|
|
||||||
{
|
|
||||||
MpegAudioContext *s = avctx->priv_data;
|
|
||||||
const int16_t *samples = (const int16_t *)frame->data[0];
|
|
||||||
short smr[MPA_MAX_CHANNELS][SBLIMIT];
|
|
||||||
unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];
|
|
||||||
int padding, i, ret;
|
|
||||||
|
|
||||||
for(i=0;i<s->nb_channels;i++) {
|
|
||||||
filter(s, i, samples + i, s->nb_channels);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=0;i<s->nb_channels;i++) {
|
|
||||||
compute_scale_factors(s->scale_code[i], s->scale_factors[i],
|
|
||||||
s->sb_samples[i], s->sblimit);
|
|
||||||
}
|
|
||||||
for(i=0;i<s->nb_channels;i++) {
|
|
||||||
psycho_acoustic_model(s, smr[i]);
|
|
||||||
}
|
|
||||||
compute_bit_allocation(s, smr, bit_alloc, &padding);
|
|
||||||
|
|
||||||
if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE)) < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
init_put_bits(&s->pb, avpkt->data, avpkt->size);
|
|
||||||
|
|
||||||
encode_frame(s, bit_alloc, padding);
|
|
||||||
|
|
||||||
if (frame->pts != AV_NOPTS_VALUE)
|
|
||||||
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
|
|
||||||
|
|
||||||
avpkt->size = put_bits_count(&s->pb) / 8;
|
|
||||||
*got_packet_ptr = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const AVCodecDefault mp2_defaults[] = {
|
|
||||||
{ (const uint8_t *) "b", (const uint8_t *) "128k" },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
AVCodec ff_mp2_encoder = {
|
|
||||||
.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(MpegAudioContext),
|
|
||||||
.init = MPA_encode_init,
|
|
||||||
.encode2 = MPA_encode_frame,
|
|
||||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
|
|
||||||
AV_SAMPLE_FMT_NONE },
|
|
||||||
.supported_samplerates = (const int[]){
|
|
||||||
44100, 48000, 32000, 22050, 24000, 16000, 0
|
|
||||||
},
|
|
||||||
.channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO,
|
|
||||||
AV_CH_LAYOUT_STEREO,
|
|
||||||
0 },
|
|
||||||
.defaults = mp2_defaults,
|
|
||||||
};
|
|
|
@ -26,13 +26,13 @@
|
||||||
#include "gsmdec_template.c"
|
#include "gsmdec_template.c"
|
||||||
|
|
||||||
int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
||||||
const uint8_t *buf)
|
const uint8_t *buf, int mode)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
init_get_bits(&gb, buf, GSM_MS_BLOCK_SIZE * 8);
|
init_get_bits(&gb, buf, GSM_MS_BLOCK_SIZE * 8);
|
||||||
res = gsm_decode_block(avctx, samples, &gb);
|
res = gsm_decode_block(avctx, samples, &gb, mode);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
return gsm_decode_block(avctx, samples + GSM_FRAME_SIZE, &gb);
|
return gsm_decode_block(avctx, samples + GSM_FRAME_SIZE, &gb, mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,6 @@
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
|
||||||
int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples,
|
||||||
const uint8_t *buf);
|
const uint8_t *buf, int mode);
|
||||||
|
|
||||||
#endif /* AVCODEC_MSGSMDEC_H */
|
#endif /* AVCODEC_MSGSMDEC_H */
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
/* video codecs */
|
/* video codecs */
|
||||||
CODEC_ID_MPEG1VIDEO,
|
CODEC_ID_MPEG1VIDEO,
|
||||||
CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
||||||
|
#if FF_API_XVMC
|
||||||
CODEC_ID_MPEG2VIDEO_XVMC,
|
CODEC_ID_MPEG2VIDEO_XVMC,
|
||||||
|
#endif
|
||||||
CODEC_ID_H261,
|
CODEC_ID_H261,
|
||||||
CODEC_ID_H263,
|
CODEC_ID_H263,
|
||||||
CODEC_ID_RV10,
|
CODEC_ID_RV10,
|
||||||
|
|
|
@ -53,7 +53,7 @@ static void *codec_child_next(void *obj, void *prev)
|
||||||
|
|
||||||
static const AVClass *codec_child_class_next(const AVClass *prev)
|
static const AVClass *codec_child_class_next(const AVClass *prev)
|
||||||
{
|
{
|
||||||
const AVCodec *c = NULL;
|
AVCodec *c = NULL;
|
||||||
|
|
||||||
/* find the codec that corresponds to prev */
|
/* find the codec that corresponds to prev */
|
||||||
while (prev && (c = av_codec_next(c)))
|
while (prev && (c = av_codec_next(c)))
|
||||||
|
@ -61,7 +61,7 @@ static const AVClass *codec_child_class_next(const AVClass *prev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* find next codec with priv options */
|
/* find next codec with priv options */
|
||||||
while ((c = av_codec_next(c)))
|
while (c = av_codec_next(c))
|
||||||
if (c->priv_class)
|
if (c->priv_class)
|
||||||
return c->priv_class;
|
return c->priv_class;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -86,14 +86,6 @@ static const AVClass av_codec_context_class = {
|
||||||
.get_category = get_category,
|
.get_category = get_category,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if FF_API_ALLOC_CONTEXT
|
|
||||||
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
|
|
||||||
AVCodec c= {0};
|
|
||||||
c.type= codec_type;
|
|
||||||
avcodec_get_context_defaults3(s, &c);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
||||||
{
|
{
|
||||||
int flags=0;
|
int flags=0;
|
||||||
|
@ -111,9 +103,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
||||||
flags= AV_OPT_FLAG_VIDEO_PARAM;
|
flags= AV_OPT_FLAG_VIDEO_PARAM;
|
||||||
else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
|
else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
|
||||||
flags= AV_OPT_FLAG_SUBTITLE_PARAM;
|
flags= AV_OPT_FLAG_SUBTITLE_PARAM;
|
||||||
AV_NOWARN_DEPRECATED(
|
|
||||||
av_opt_set_defaults2(s, flags, flags);
|
av_opt_set_defaults2(s, flags, flags);
|
||||||
);
|
|
||||||
|
|
||||||
s->time_base = (AVRational){0,1};
|
s->time_base = (AVRational){0,1};
|
||||||
s->get_buffer2 = avcodec_default_get_buffer2;
|
s->get_buffer2 = avcodec_default_get_buffer2;
|
||||||
|
@ -142,7 +132,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
||||||
int ret;
|
int ret;
|
||||||
const AVCodecDefault *d = codec->defaults;
|
const AVCodecDefault *d = codec->defaults;
|
||||||
while (d->key) {
|
while (d->key) {
|
||||||
ret = av_opt_set(s, (const char *) d->key, (const char *) d->value, 0);
|
ret = av_opt_set(s, d->key, d->value, 0);
|
||||||
av_assert0(ret >= 0);
|
av_assert0(ret >= 0);
|
||||||
d++;
|
d++;
|
||||||
}
|
}
|
||||||
|
@ -164,26 +154,6 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
|
||||||
return avctx;
|
return avctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_API_ALLOC_CONTEXT
|
|
||||||
AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
|
|
||||||
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
|
|
||||||
|
|
||||||
if(avctx==NULL) return NULL;
|
|
||||||
|
|
||||||
avcodec_get_context_defaults2(avctx, codec_type);
|
|
||||||
|
|
||||||
return avctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
void avcodec_get_context_defaults(AVCodecContext *s){
|
|
||||||
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
AVCodecContext *avcodec_alloc_context(void){
|
|
||||||
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
|
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
|
||||||
{
|
{
|
||||||
if (avcodec_is_open(dest)) { // check that the dest context is uninitialized
|
if (avcodec_is_open(dest)) { // check that the dest context is uninitialized
|
||||||
|
@ -203,7 +173,6 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
|
||||||
dest->codec = NULL;
|
dest->codec = NULL;
|
||||||
dest->slice_offset = NULL;
|
dest->slice_offset = NULL;
|
||||||
dest->hwaccel = NULL;
|
dest->hwaccel = NULL;
|
||||||
dest->thread_opaque = NULL;
|
|
||||||
dest->internal = NULL;
|
dest->internal = NULL;
|
||||||
|
|
||||||
/* reallocate values that should be allocated separately */
|
/* reallocate values that should be allocated separately */
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
#include "internal.h"
|
||||||
#include "raw.h"
|
#include "raw.h"
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include "libavutil/buffer.h"
|
#include "libavutil/buffer.h"
|
||||||
|
@ -40,6 +41,7 @@ typedef struct RawVideoContext {
|
||||||
int flip;
|
int flip;
|
||||||
int is_2_4_bpp; // 2 or 4 bpp raw in avi/mov
|
int is_2_4_bpp; // 2 or 4 bpp raw in avi/mov
|
||||||
int is_yuv2;
|
int is_yuv2;
|
||||||
|
int is_lt_16bpp; // 16bpp pixfmt and bits_per_coded_sample < 16
|
||||||
int tff;
|
int tff;
|
||||||
} RawVideoContext;
|
} RawVideoContext;
|
||||||
|
|
||||||
|
@ -107,7 +109,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
|
||||||
if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|
if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|
||||||
|| avctx->codec_tag == MKTAG('N','O','1','6'))
|
|| avctx->codec_tag == MKTAG('N','O','1','6'))
|
||||||
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov,
|
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov,
|
||||||
avctx->bits_per_coded_sample);
|
avctx->bits_per_coded_sample & 0x1f);
|
||||||
else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
|
else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
|
||||||
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
|
avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi,
|
||||||
avctx->bits_per_coded_sample);
|
avctx->bits_per_coded_sample);
|
||||||
|
@ -133,7 +135,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
|
||||||
memset(context->palette->data, 0, AVPALETTE_SIZE);
|
memset(context->palette->data, 0, AVPALETTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
|
if (((avctx->bits_per_coded_sample & 0x1f) == 4 || (avctx->bits_per_coded_sample & 0x1f) == 2) &&
|
||||||
avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
|
avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
|
||||||
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
|
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
|
||||||
context->is_2_4_bpp = 1;
|
context->is_2_4_bpp = 1;
|
||||||
|
@ -141,6 +143,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
|
||||||
FFALIGN(avctx->width, 16),
|
FFALIGN(avctx->width, 16),
|
||||||
avctx->height);
|
avctx->height);
|
||||||
} else {
|
} 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,
|
context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
|
||||||
avctx->height);
|
avctx->height);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +177,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
int linesize_align = 4;
|
int linesize_align = 4;
|
||||||
int res, len;
|
int res, len;
|
||||||
int need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2;
|
int need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp;
|
||||||
|
|
||||||
AVFrame *frame = data;
|
AVFrame *frame = data;
|
||||||
AVPicture *picture = data;
|
AVPicture *picture = data;
|
||||||
|
@ -182,9 +185,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||||
frame->key_frame = 1;
|
frame->key_frame = 1;
|
||||||
frame->reordered_opaque = avctx->reordered_opaque;
|
frame->reordered_opaque = avctx->reordered_opaque;
|
||||||
frame->pkt_pts = avctx->pkt->pts;
|
frame->pkt_pts = avctx->internal->pkt->pts;
|
||||||
av_frame_set_pkt_pos (frame, avctx->pkt->pos);
|
av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos);
|
||||||
av_frame_set_pkt_duration(frame, avctx->pkt->duration);
|
av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration);
|
||||||
|
|
||||||
if (context->tff >= 0) {
|
if (context->tff >= 0) {
|
||||||
frame->interlaced_frame = 1;
|
frame->interlaced_frame = 1;
|
||||||
|
@ -206,14 +209,14 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
int i;
|
int i;
|
||||||
uint8_t *dst = frame->buf[0]->data;
|
uint8_t *dst = frame->buf[0]->data;
|
||||||
buf_size = context->frame_size - AVPALETTE_SIZE;
|
buf_size = context->frame_size - AVPALETTE_SIZE;
|
||||||
if (avctx->bits_per_coded_sample == 4) {
|
if ((avctx->bits_per_coded_sample & 0x1f) == 4) {
|
||||||
for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) {
|
for (i = 0; 2 * i + 1 < buf_size && i<avpkt->size; i++) {
|
||||||
dst[2 * i + 0] = buf[i] >> 4;
|
dst[2 * i + 0] = buf[i] >> 4;
|
||||||
dst[2 * i + 1] = buf[i] & 15;
|
dst[2 * i + 1] = buf[i] & 15;
|
||||||
}
|
}
|
||||||
linesize_align = 8;
|
linesize_align = 8;
|
||||||
} else {
|
} else {
|
||||||
av_assert0(avctx->bits_per_coded_sample == 2);
|
av_assert0((avctx->bits_per_coded_sample & 0x1f) == 2);
|
||||||
for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) {
|
for (i = 0; 4 * i + 3 < buf_size && i<avpkt->size; i++) {
|
||||||
dst[4 * i + 0] = buf[i] >> 6;
|
dst[4 * i + 0] = buf[i] >> 6;
|
||||||
dst[4 * i + 1] = buf[i] >> 4 & 3;
|
dst[4 * i + 1] = buf[i] >> 4 & 3;
|
||||||
|
@ -223,6 +226,17 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||||
linesize_align = 16;
|
linesize_align = 16;
|
||||||
}
|
}
|
||||||
buf = dst;
|
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) {
|
} else if (need_copy) {
|
||||||
memcpy(frame->buf[0]->data, buf, buf_size);
|
memcpy(frame->buf[0]->data, buf, buf_size);
|
||||||
buf = frame->buf[0]->data;
|
buf = frame->buf[0]->data;
|
||||||
|
|
|
@ -97,7 +97,7 @@ static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||||
}
|
}
|
||||||
found:
|
found:
|
||||||
|
|
||||||
if ((consumed && !buf_size && next == END_NOT_FOUND) ||
|
if (consumed && !buf_size && next == END_NOT_FOUND ||
|
||||||
ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
|
ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
|
||||||
*poutbuf = NULL;
|
*poutbuf = NULL;
|
||||||
*poutbuf_size = 0;
|
*poutbuf_size = 0;
|
||||||
|
|
|
@ -163,8 +163,8 @@ static void set_sample_rate_params(AVCodecContext *avctx)
|
||||||
TAKDecContext *s = avctx->priv_data;
|
TAKDecContext *s = avctx->priv_data;
|
||||||
int shift = 3 - (avctx->sample_rate / 11025);
|
int shift = 3 - (avctx->sample_rate / 11025);
|
||||||
shift = FFMAX(0, shift);
|
shift = FFMAX(0, shift);
|
||||||
s->uval = FFALIGN((avctx->sample_rate + 511) >> 9, 4) << shift;
|
s->uval = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << shift;
|
||||||
s->subframe_scale = FFALIGN((avctx->sample_rate + 511) >> 9, 4) << 1;
|
s->subframe_scale = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int tak_decode_init(AVCodecContext *avctx)
|
static av_cold int tak_decode_init(AVCodecContext *avctx)
|
||||||
|
@ -190,7 +190,7 @@ static void decode_lpc(int32_t *coeffs, int mode, int length)
|
||||||
|
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
int a1 = *coeffs++;
|
int a1 = *coeffs++;
|
||||||
for (i = 0; i < (length - 1) >> 1; i++) {
|
for (i = 0; i < length - 1 >> 1; i++) {
|
||||||
*coeffs += a1;
|
*coeffs += a1;
|
||||||
coeffs[1] += *coeffs;
|
coeffs[1] += *coeffs;
|
||||||
a1 = coeffs[1];
|
a1 = coeffs[1];
|
||||||
|
@ -204,7 +204,7 @@ static void decode_lpc(int32_t *coeffs, int mode, int length)
|
||||||
coeffs[1] = a2;
|
coeffs[1] = a2;
|
||||||
if (length > 2) {
|
if (length > 2) {
|
||||||
coeffs += 2;
|
coeffs += 2;
|
||||||
for (i = 0; i < (length - 2) >> 1; i++) {
|
for (i = 0; i < length - 2 >> 1; i++) {
|
||||||
int a3 = *coeffs + a1;
|
int a3 = *coeffs + a1;
|
||||||
int a4 = a3 + a2;
|
int a4 = a3 + a2;
|
||||||
*coeffs = a4;
|
*coeffs = a4;
|
||||||
|
@ -436,8 +436,8 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
|
||||||
int32_t *p2 = &tfilter[i - 1];
|
int32_t *p2 = &tfilter[i - 1];
|
||||||
|
|
||||||
for (j = 0; j < (i + 1) / 2; j++) {
|
for (j = 0; j < (i + 1) / 2; j++) {
|
||||||
x = *p1 + ((s->predictors[i] * *p2 + 256) >> 9);
|
x = *p1 + (s->predictors[i] * *p2 + 256 >> 9);
|
||||||
*p2 += (s->predictors[i] * *p1 + 256) >> 9;
|
*p2 += s->predictors[i] * *p1 + 256 >> 9;
|
||||||
*p1++ = x;
|
*p1++ = x;
|
||||||
p2--;
|
p2--;
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,7 @@ static int decorrelate(TAKDecContext *s, int c1, int c2, int length)
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
int32_t a = p1[i];
|
int32_t a = p1[i];
|
||||||
int32_t b = p2[i];
|
int32_t b = p2[i];
|
||||||
b = (dfactor * (b >> dshift) + 128) >> 8 << dshift;
|
b = dfactor * (b >> dshift) + 128 >> 8 << dshift;
|
||||||
p1[i] = b - a;
|
p1[i] = b - a;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -686,11 +686,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0)
|
if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (avctx->err_recognition & AV_EF_CRCCHECK) {
|
if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_COMPLIANT)) {
|
||||||
hsize = get_bits_count(gb) / 8;
|
hsize = get_bits_count(gb) / 8;
|
||||||
if (ff_tak_check_crc(pkt->data, hsize)) {
|
if (ff_tak_check_crc(pkt->data, hsize)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "CRC error\n");
|
av_log(avctx, AV_LOG_ERROR, "CRC error\n");
|
||||||
return AVERROR_INVALIDDATA;
|
if (avctx->err_recognition & AV_EF_EXPLODE)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,11 +721,9 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->ti.bps != avctx->bits_per_raw_sample) {
|
avctx->bits_per_raw_sample = s->ti.bps;
|
||||||
avctx->bits_per_raw_sample = s->ti.bps;
|
if ((ret = set_bps_params(avctx)) < 0)
|
||||||
if ((ret = set_bps_params(avctx)) < 0)
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (s->ti.sample_rate != avctx->sample_rate) {
|
if (s->ti.sample_rate != avctx->sample_rate) {
|
||||||
avctx->sample_rate = s->ti.sample_rate;
|
avctx->sample_rate = s->ti.sample_rate;
|
||||||
set_sample_rate_params(avctx);
|
set_sample_rate_params(avctx);
|
||||||
|
@ -767,7 +766,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
} else {
|
} else {
|
||||||
if (s->ti.codec == TAK_CODEC_MONO_STEREO) {
|
if (s->ti.codec == TAK_CODEC_MONO_STEREO) {
|
||||||
for (chan = 0; chan < avctx->channels; chan++)
|
for (chan = 0; chan < avctx->channels; chan++)
|
||||||
if ((ret = decode_channel(s, chan)))
|
if (ret = decode_channel(s, chan))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (avctx->channels == 2) {
|
if (avctx->channels == 2) {
|
||||||
|
@ -777,7 +776,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
s->dmode = get_bits(gb, 3);
|
s->dmode = get_bits(gb, 3);
|
||||||
if ((ret = decorrelate(s, 0, 1, s->nb_samples - 1)))
|
if (ret = decorrelate(s, 0, 1, s->nb_samples - 1))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
} else if (s->ti.codec == TAK_CODEC_MULTICHANNEL) {
|
} else if (s->ti.codec == TAK_CODEC_MULTICHANNEL) {
|
||||||
|
@ -825,18 +824,18 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
|
|
||||||
for (i = 0; i < chan; i++) {
|
for (i = 0; i < chan; i++) {
|
||||||
if (s->mcdparams[i].present && s->mcdparams[i].index == 1)
|
if (s->mcdparams[i].present && s->mcdparams[i].index == 1)
|
||||||
if ((ret = decode_channel(s, s->mcdparams[i].chan2)))
|
if (ret = decode_channel(s, s->mcdparams[i].chan2))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = decode_channel(s, s->mcdparams[i].chan1)))
|
if (ret = decode_channel(s, s->mcdparams[i].chan1))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (s->mcdparams[i].present) {
|
if (s->mcdparams[i].present) {
|
||||||
s->dmode = mc_dmodes[s->mcdparams[i].index];
|
s->dmode = mc_dmodes[s->mcdparams[i].index];
|
||||||
if ((ret = decorrelate(s,
|
if (ret = decorrelate(s,
|
||||||
s->mcdparams[i].chan2,
|
s->mcdparams[i].chan2,
|
||||||
s->mcdparams[i].chan1,
|
s->mcdparams[i].chan1,
|
||||||
s->nb_samples - 1)))
|
s->nb_samples - 1))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -861,11 +860,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
else if (get_bits_left(gb) > 0)
|
else if (get_bits_left(gb) > 0)
|
||||||
av_log(avctx, AV_LOG_DEBUG, "underread\n");
|
av_log(avctx, AV_LOG_DEBUG, "underread\n");
|
||||||
|
|
||||||
if (avctx->err_recognition & AV_EF_CRCCHECK) {
|
if (avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_COMPLIANT)) {
|
||||||
if (ff_tak_check_crc(pkt->data + hsize,
|
if (ff_tak_check_crc(pkt->data + hsize,
|
||||||
get_bits_count(gb) / 8 - hsize)) {
|
get_bits_count(gb) / 8 - hsize)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "CRC error\n");
|
av_log(avctx, AV_LOG_ERROR, "CRC error\n");
|
||||||
return AVERROR_INVALIDDATA;
|
if (avctx->err_recognition & AV_EF_EXPLODE)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,7 +894,6 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
samples[i] <<= 8;
|
samples[i] <<= 8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*got_frame_ptr = 1;
|
*got_frame_ptr = 1;
|
||||||
|
@ -932,6 +931,7 @@ static av_cold int tak_decode_close(AVCodecContext *avctx)
|
||||||
|
|
||||||
AVCodec ff_tak_decoder = {
|
AVCodec ff_tak_decoder = {
|
||||||
.name = "tak",
|
.name = "tak",
|
||||||
|
.long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.id = AV_CODEC_ID_TAK,
|
.id = AV_CODEC_ID_TAK,
|
||||||
.priv_data_size = sizeof(TAKDecContext),
|
.priv_data_size = sizeof(TAKDecContext),
|
||||||
|
@ -941,7 +941,6 @@ AVCodec ff_tak_decoder = {
|
||||||
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
||||||
.update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context),
|
.update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context),
|
||||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
|
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
|
||||||
AV_SAMPLE_FMT_S16P,
|
AV_SAMPLE_FMT_S16P,
|
||||||
AV_SAMPLE_FMT_S32P,
|
AV_SAMPLE_FMT_S32P,
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include "libavutil/channel_layout.h"
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/internal.h"
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
#define BITSTREAM_READER_LE
|
#define BITSTREAM_READER_LE
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "config.h"
|
|
||||||
#include "ttadata.h"
|
#include "ttadata.h"
|
||||||
|
#include "ttadsp.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "libavutil/crc.h"
|
#include "libavutil/crc.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/internal.h"
|
|
||||||
|
|
||||||
#define FORMAT_SIMPLE 1
|
#define FORMAT_SIMPLE 1
|
||||||
#define FORMAT_ENCRYPTED 2
|
#define FORMAT_ENCRYPTED 2
|
||||||
|
@ -58,39 +57,9 @@ typedef struct TTAContext {
|
||||||
uint8_t crc_pass[8];
|
uint8_t crc_pass[8];
|
||||||
uint8_t *pass;
|
uint8_t *pass;
|
||||||
TTAChannel *ch_ctx;
|
TTAChannel *ch_ctx;
|
||||||
|
TTADSPContext dsp;
|
||||||
} TTAContext;
|
} TTAContext;
|
||||||
|
|
||||||
static inline void ttafilter_process(TTAFilter *c, int32_t *in)
|
|
||||||
{
|
|
||||||
register int32_t *dl = c->dl, *qm = c->qm, *dx = c->dx, sum = c->round;
|
|
||||||
|
|
||||||
if (c->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 (c->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];
|
|
||||||
}
|
|
||||||
|
|
||||||
sum += 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;
|
|
||||||
|
|
||||||
c->error = *in;
|
|
||||||
*in += (sum >> c->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];
|
|
||||||
}
|
|
||||||
|
|
||||||
static const int64_t tta_channel_layouts[7] = {
|
static const int64_t tta_channel_layouts[7] = {
|
||||||
AV_CH_LAYOUT_STEREO,
|
AV_CH_LAYOUT_STEREO,
|
||||||
AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY,
|
AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY,
|
||||||
|
@ -118,7 +87,7 @@ static int tta_check_crc(TTAContext *s, const uint8_t *buf, int buf_size)
|
||||||
static uint64_t tta_check_crc64(uint8_t *pass)
|
static uint64_t tta_check_crc64(uint8_t *pass)
|
||||||
{
|
{
|
||||||
uint64_t crc = UINT64_MAX, poly = 0x42F0E1EBA9EA3693U;
|
uint64_t crc = UINT64_MAX, poly = 0x42F0E1EBA9EA3693U;
|
||||||
uint8_t *end = pass + strlen((const char *) pass);
|
uint8_t *end = pass + strlen((const char *)pass);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (pass < end) {
|
while (pass < end) {
|
||||||
|
@ -236,6 +205,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ff_ttadsp_init(&s->dsp);
|
||||||
|
|
||||||
return allocate_buffers(avctx);
|
return allocate_buffers(avctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +224,8 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
int32_t *p;
|
int32_t *p;
|
||||||
|
|
||||||
if (avctx->err_recognition & AV_EF_CRCCHECK) {
|
if (avctx->err_recognition & AV_EF_CRCCHECK) {
|
||||||
if (buf_size < 4 || tta_check_crc(s, buf, buf_size - 4))
|
if (buf_size < 4 ||
|
||||||
|
(tta_check_crc(s, buf, buf_size - 4) && avctx->err_recognition & AV_EF_EXPLODE))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +308,8 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
*p = 1 + ((value >> 1) ^ ((value & 1) - 1));
|
*p = 1 + ((value >> 1) ^ ((value & 1) - 1));
|
||||||
|
|
||||||
// run hybrid filter
|
// run hybrid filter
|
||||||
ttafilter_process(filter, p);
|
s->dsp.ttafilter_process_dec(filter->qm, filter->dx, filter->dl, &filter->error, p,
|
||||||
|
filter->shift, filter->round);
|
||||||
|
|
||||||
// fixed order prediction
|
// fixed order prediction
|
||||||
#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k)
|
#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k)
|
||||||
|
@ -451,7 +424,6 @@ AVCodec ff_tta_decoder = {
|
||||||
.init = tta_decode_init,
|
.init = tta_decode_init,
|
||||||
.close = tta_decode_close,
|
.close = tta_decode_close,
|
||||||
.decode = tta_decode_frame,
|
.decode = tta_decode_frame,
|
||||||
.init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
|
|
||||||
.priv_class = &tta_decoder_class,
|
.priv_class = &tta_decoder_class,
|
||||||
};
|
};
|
||||||
|
|
57
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.c
Normal file
57
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.c
Normal file
|
@ -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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
34
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.h
Normal file
34
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General 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 <stdint.h>
|
||||||
|
#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 */
|
|
@ -216,7 +216,7 @@ static void dec_gain(TwinVQContext *tctx,
|
||||||
enum TwinVQFrameType ftype, float *out)
|
enum TwinVQFrameType ftype, float *out)
|
||||||
{
|
{
|
||||||
const TwinVQModeTab *mtab = tctx->mtab;
|
const TwinVQModeTab *mtab = tctx->mtab;
|
||||||
const TwinVQFrameData *bits = &tctx->bits;
|
const TwinVQFrameData *bits = &tctx->bits[tctx->cur_frame];
|
||||||
int i, j;
|
int i, j;
|
||||||
int sub = mtab->fmode[ftype].sub;
|
int sub = mtab->fmode[ftype].sub;
|
||||||
float step = TWINVQ_AMP_MAX / ((1 << TWINVQ_GAIN_BITS) - 1);
|
float step = TWINVQ_AMP_MAX / ((1 << TWINVQ_GAIN_BITS) - 1);
|
||||||
|
@ -377,11 +377,12 @@ static void imdct_and_window(TwinVQContext *tctx, enum TwinVQFrameType ftype,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imdct_output(TwinVQContext *tctx, enum TwinVQFrameType ftype,
|
static void imdct_output(TwinVQContext *tctx, enum TwinVQFrameType ftype,
|
||||||
int wtype, float **out)
|
int wtype, float **out, int offset)
|
||||||
{
|
{
|
||||||
const TwinVQModeTab *mtab = tctx->mtab;
|
const TwinVQModeTab *mtab = tctx->mtab;
|
||||||
float *prev_buf = tctx->prev_frame + tctx->last_block_pos[0];
|
float *prev_buf = tctx->prev_frame + tctx->last_block_pos[0];
|
||||||
int size1, size2, i;
|
int size1, size2, i;
|
||||||
|
float *out1, *out2;
|
||||||
|
|
||||||
for (i = 0; i < tctx->avctx->channels; i++)
|
for (i = 0; i < tctx->avctx->channels; i++)
|
||||||
imdct_and_window(tctx, ftype, wtype,
|
imdct_and_window(tctx, ftype, wtype,
|
||||||
|
@ -395,15 +396,17 @@ static void imdct_output(TwinVQContext *tctx, enum TwinVQFrameType ftype,
|
||||||
size2 = tctx->last_block_pos[0];
|
size2 = tctx->last_block_pos[0];
|
||||||
size1 = mtab->size - size2;
|
size1 = mtab->size - size2;
|
||||||
|
|
||||||
memcpy(&out[0][0], prev_buf, size1 * sizeof(out[0][0]));
|
out1 = &out[0][0] + offset;
|
||||||
memcpy(&out[0][size1], tctx->curr_frame, size2 * sizeof(out[0][0]));
|
memcpy(out1, prev_buf, size1 * sizeof(*out1));
|
||||||
|
memcpy(out1 + size1, tctx->curr_frame, size2 * sizeof(*out1));
|
||||||
|
|
||||||
if (tctx->avctx->channels == 2) {
|
if (tctx->avctx->channels == 2) {
|
||||||
memcpy(&out[1][0], &prev_buf[2 * mtab->size],
|
out2 = &out[1][0] + offset;
|
||||||
size1 * sizeof(out[1][0]));
|
memcpy(out2, &prev_buf[2 * mtab->size],
|
||||||
memcpy(&out[1][size1], &tctx->curr_frame[2 * mtab->size],
|
size1 * sizeof(*out2));
|
||||||
size2 * sizeof(out[1][0]));
|
memcpy(out2 + size1, &tctx->curr_frame[2 * mtab->size],
|
||||||
tctx->fdsp.butterflies_float(out[0], out[1], mtab->size);
|
size2 * sizeof(*out2));
|
||||||
|
tctx->fdsp.butterflies_float(out1, out2, mtab->size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +414,7 @@ static void read_and_decode_spectrum(TwinVQContext *tctx, float *out,
|
||||||
enum TwinVQFrameType ftype)
|
enum TwinVQFrameType ftype)
|
||||||
{
|
{
|
||||||
const TwinVQModeTab *mtab = tctx->mtab;
|
const TwinVQModeTab *mtab = tctx->mtab;
|
||||||
TwinVQFrameData *bits = &tctx->bits;
|
TwinVQFrameData *bits = &tctx->bits[tctx->cur_frame];
|
||||||
int channels = tctx->avctx->channels;
|
int channels = tctx->avctx->channels;
|
||||||
int sub = mtab->fmode[ftype].sub;
|
int sub = mtab->fmode[ftype].sub;
|
||||||
int block_size = mtab->size / sub;
|
int block_size = mtab->size / sub;
|
||||||
|
@ -484,7 +487,7 @@ int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
|
|
||||||
/* get output buffer */
|
/* get output buffer */
|
||||||
if (tctx->discarded_packets >= 2) {
|
if (tctx->discarded_packets >= 2) {
|
||||||
frame->nb_samples = mtab->size;
|
frame->nb_samples = mtab->size * tctx->frames_per_packet;
|
||||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
out = (float **)frame->extended_data;
|
out = (float **)frame->extended_data;
|
||||||
|
@ -499,11 +502,17 @@ int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0)
|
if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
read_and_decode_spectrum(tctx, tctx->spectrum, tctx->bits.ftype);
|
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.ftype, tctx->bits.window_type, out);
|
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);
|
FFSWAP(float *, tctx->curr_frame, tctx->prev_frame);
|
||||||
|
}
|
||||||
|
|
||||||
if (tctx->discarded_packets < 2) {
|
if (tctx->discarded_packets < 2) {
|
||||||
tctx->discarded_packets++;
|
tctx->discarded_packets++;
|
||||||
|
@ -513,6 +522,9 @@ int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
|
|
||||||
*got_frame_ptr = 1;
|
*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;
|
return avctx->block_align;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +705,7 @@ static av_cold void init_bitstream_params(TwinVQContext *tctx)
|
||||||
TWINVQ_WINDOW_TYPE_BITS +
|
TWINVQ_WINDOW_TYPE_BITS +
|
||||||
mtab->fmode[i].sub * (bse_bits[i] + n_ch * TWINVQ_SUB_GAIN_BITS);
|
mtab->fmode[i].sub * (bse_bits[i] + n_ch * TWINVQ_SUB_GAIN_BITS);
|
||||||
|
|
||||||
if (tctx->codec == TWINVQ_CODEC_METASOUND) {
|
if (tctx->codec == TWINVQ_CODEC_METASOUND && !tctx->is_6kbps) {
|
||||||
bsize_no_main_cb[1] += 2;
|
bsize_no_main_cb[1] += 2;
|
||||||
bsize_no_main_cb[2] += 2;
|
bsize_no_main_cb[2] += 2;
|
||||||
}
|
}
|
||||||
|
@ -763,6 +775,20 @@ av_cold int ff_twinvq_decode_init(AVCodecContext *avctx)
|
||||||
tctx->avctx = avctx;
|
tctx->avctx = avctx;
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
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);
|
avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
|
||||||
if ((ret = init_mdct_win(tctx))) {
|
if ((ret = init_mdct_win(tctx))) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
|
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
|
||||||
|
|
|
@ -58,6 +58,8 @@ enum TwinVQFrameType {
|
||||||
#define TWINVQ_SUBBLOCKS_MAX 16
|
#define TWINVQ_SUBBLOCKS_MAX 16
|
||||||
#define TWINVQ_BARK_N_COEF_MAX 4
|
#define TWINVQ_BARK_N_COEF_MAX 4
|
||||||
|
|
||||||
|
#define TWINVQ_MAX_FRAMES_PER_PACKET 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameters and tables that are different for each frame type
|
* Parameters and tables that are different for each frame type
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +141,8 @@ typedef struct TwinVQContext {
|
||||||
|
|
||||||
const TwinVQModeTab *mtab;
|
const TwinVQModeTab *mtab;
|
||||||
|
|
||||||
|
int is_6kbps;
|
||||||
|
|
||||||
// history
|
// history
|
||||||
float lsp_hist[2][20]; ///< LSP coefficients of the last frame
|
float lsp_hist[2][20]; ///< LSP coefficients of the last frame
|
||||||
float bark_hist[3][2][40]; ///< BSE coefficients of last frame
|
float bark_hist[3][2][40]; ///< BSE coefficients of last frame
|
||||||
|
@ -162,7 +166,8 @@ typedef struct TwinVQContext {
|
||||||
// scratch buffers
|
// scratch buffers
|
||||||
float *tmp_buf;
|
float *tmp_buf;
|
||||||
|
|
||||||
TwinVQFrameData bits;
|
int frame_size, frames_per_packet, cur_frame;
|
||||||
|
TwinVQFrameData bits[TWINVQ_MAX_FRAMES_PER_PACKET];
|
||||||
|
|
||||||
enum TwinVQCodec codec;
|
enum TwinVQCodec codec;
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ static void read_cb_data(TwinVQContext *tctx, GetBitContext *gb,
|
||||||
static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
|
static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
|
||||||
const uint8_t *buf, int buf_size)
|
const uint8_t *buf, int buf_size)
|
||||||
{
|
{
|
||||||
TwinVQFrameData *bits = &tctx->bits;
|
TwinVQFrameData *bits = &tctx->bits[0];
|
||||||
const TwinVQModeTab *mtab = tctx->mtab;
|
const TwinVQModeTab *mtab = tctx->mtab;
|
||||||
int channels = tctx->avctx->channels;
|
int channels = tctx->avctx->channels;
|
||||||
int sub;
|
int sub;
|
||||||
|
@ -268,7 +268,7 @@ static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
bits->ftype = ff_twinvq_wtype_to_ftype_table[tctx->bits.window_type];
|
bits->ftype = ff_twinvq_wtype_to_ftype_table[tctx->bits[0].window_type];
|
||||||
|
|
||||||
sub = mtab->fmode[bits->ftype].sub;
|
sub = mtab->fmode[bits->ftype].sub;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return (get_bits_count(&gb) + 7) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int twinvq_decode_init(AVCodecContext *avctx)
|
static av_cold int twinvq_decode_init(AVCodecContext *avctx)
|
||||||
|
@ -396,13 +396,18 @@ static av_cold int twinvq_decode_init(AVCodecContext *avctx)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->block_align = (avctx->bit_rate * tctx->mtab->size
|
|
||||||
/ avctx->sample_rate + 15) / 8;
|
|
||||||
|
|
||||||
tctx->codec = TWINVQ_CODEC_VQF;
|
tctx->codec = TWINVQ_CODEC_VQF;
|
||||||
tctx->read_bitstream = twinvq_read_bitstream;
|
tctx->read_bitstream = twinvq_read_bitstream;
|
||||||
tctx->dec_bark_env = dec_bark_env;
|
tctx->dec_bark_env = dec_bark_env;
|
||||||
tctx->decode_ppc = decode_ppc;
|
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);
|
return ff_twinvq_decode_init(avctx);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,14 +27,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __FRAMEWORK__
|
#ifdef __FRAMEWORK__
|
||||||
#include "avutil.h"
|
#include "version.h"
|
||||||
#else
|
#else
|
||||||
#include "libavutil/avutil.h"
|
#include "libavutil/version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 55
|
#define LIBAVCODEC_VERSION_MAJOR 55
|
||||||
#define LIBAVCODEC_VERSION_MINOR 33
|
#define LIBAVCODEC_VERSION_MINOR 52
|
||||||
#define LIBAVCODEC_VERSION_MICRO 101
|
#define LIBAVCODEC_VERSION_MICRO 102
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
LIBAVCODEC_VERSION_MINOR, \
|
LIBAVCODEC_VERSION_MINOR, \
|
||||||
|
@ -55,19 +55,9 @@
|
||||||
#ifndef FF_API_REQUEST_CHANNELS
|
#ifndef FF_API_REQUEST_CHANNELS
|
||||||
#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FF_API_ALLOC_CONTEXT
|
|
||||||
#define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 55)
|
|
||||||
#endif
|
|
||||||
#ifndef FF_API_AVCODEC_OPEN
|
|
||||||
#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 55)
|
|
||||||
#endif
|
|
||||||
#ifndef FF_API_OLD_DECODE_AUDIO
|
#ifndef FF_API_OLD_DECODE_AUDIO
|
||||||
#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FF_API_OLD_TIMECODE
|
|
||||||
#define FF_API_OLD_TIMECODE (LIBAVCODEC_VERSION_MAJOR < 55)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FF_API_OLD_ENCODE_AUDIO
|
#ifndef FF_API_OLD_ENCODE_AUDIO
|
||||||
#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,8 +67,11 @@
|
||||||
#ifndef FF_API_CODEC_ID
|
#ifndef FF_API_CODEC_ID
|
||||||
#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_AUDIO_CONVERT
|
||||||
|
#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
|
#endif
|
||||||
#ifndef FF_API_AVCODEC_RESAMPLE
|
#ifndef FF_API_AVCODEC_RESAMPLE
|
||||||
#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT
|
||||||
#endif
|
#endif
|
||||||
#ifndef FF_API_DEINTERLACE
|
#ifndef FF_API_DEINTERLACE
|
||||||
#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
|
@ -104,5 +97,53 @@
|
||||||
#ifndef FF_API_VOXWARE
|
#ifndef FF_API_VOXWARE
|
||||||
#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56)
|
#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56)
|
||||||
#endif
|
#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 */
|
#endif /* AVCODEC_VERSION_H */
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define EMULATED_EDGE(depth) \
|
#define EMULATED_EDGE(depth) \
|
||||||
void ff_emulated_edge_mc_ ## depth(uint8_t *dst, ptrdiff_t dst_stride, \
|
void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \
|
||||||
const uint8_t *src, ptrdiff_t src_stride, \
|
ptrdiff_t dst_stride, ptrdiff_t src_stride, \
|
||||||
int block_w, int block_h,\
|
int block_w, int block_h,\
|
||||||
int src_x, int src_y, int w, int h);
|
int src_x, int src_y, int w, int h);
|
||||||
|
|
||||||
|
@ -47,8 +47,10 @@ typedef struct VideoDSPContext {
|
||||||
* @param dst_stride number of bytes between 2 vertically adjacent samples
|
* @param dst_stride number of bytes between 2 vertically adjacent samples
|
||||||
* in destination buffer
|
* in destination buffer
|
||||||
* @param src source buffer
|
* @param src source buffer
|
||||||
* @param src_stride number of bytes between 2 vertically adjacent samples
|
* @param dst_linesize number of bytes between 2 vertically adjacent
|
||||||
* in source buffer
|
* 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_w width of block
|
||||||
* @param block_h height of block
|
* @param block_h height of block
|
||||||
* @param src_x x coordinate of the top left sample of the block in the
|
* @param src_x x coordinate of the top left sample of the block in the
|
||||||
|
@ -58,8 +60,9 @@ typedef struct VideoDSPContext {
|
||||||
* @param w width of the source buffer
|
* @param w width of the source buffer
|
||||||
* @param h height of the source buffer
|
* @param h height of the source buffer
|
||||||
*/
|
*/
|
||||||
void (*emulated_edge_mc)(uint8_t *dst, ptrdiff_t dst_stride,
|
void (*emulated_edge_mc)(uint8_t *dst, const uint8_t *src,
|
||||||
const uint8_t *src, ptrdiff_t src_stride,
|
ptrdiff_t dst_linesize,
|
||||||
|
ptrdiff_t src_linesize,
|
||||||
int block_w, int block_h,
|
int block_w, int block_h,
|
||||||
int src_x, int src_y, int w, int h);
|
int src_x, int src_y, int w, int h);
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bit_depth_template.c"
|
#include "bit_depth_template.c"
|
||||||
void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride,
|
void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
|
||||||
const uint8_t *src, ptrdiff_t src_stride,
|
ptrdiff_t buf_linesize,
|
||||||
|
ptrdiff_t src_linesize,
|
||||||
int block_w, int block_h,
|
int block_w, int block_h,
|
||||||
int src_x, int src_y, int w, int h)
|
int src_x, int src_y, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -32,12 +33,12 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (src_y >= h) {
|
if (src_y >= h) {
|
||||||
src -= src_y * src_stride;
|
src -= src_y * src_linesize;
|
||||||
src += (h - 1) * src_stride;
|
src += (h - 1) * src_linesize;
|
||||||
src_y = h - 1;
|
src_y = h - 1;
|
||||||
} else if (src_y <= -block_h) {
|
} else if (src_y <= -block_h) {
|
||||||
src -= src_y * src_stride;
|
src -= src_y * src_linesize;
|
||||||
src += (1 - block_h) * src_stride;
|
src += (1 - block_h) * src_linesize;
|
||||||
src_y = 1 - block_h;
|
src_y = 1 - block_h;
|
||||||
}
|
}
|
||||||
if (src_x >= w) {
|
if (src_x >= w) {
|
||||||
|
@ -56,30 +57,30 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride,
|
||||||
av_assert2(start_x < end_x && block_w);
|
av_assert2(start_x < end_x && block_w);
|
||||||
|
|
||||||
w = end_x - start_x;
|
w = end_x - start_x;
|
||||||
src += start_y * src_stride + start_x * sizeof(pixel);
|
src += start_y * src_linesize + start_x * sizeof(pixel);
|
||||||
buf += start_x * sizeof(pixel);
|
buf += start_x * sizeof(pixel);
|
||||||
|
|
||||||
// top
|
// top
|
||||||
for (y = 0; y < start_y; y++) {
|
for (y = 0; y < start_y; y++) {
|
||||||
memcpy(buf, src, w * sizeof(pixel));
|
memcpy(buf, src, w * sizeof(pixel));
|
||||||
buf += buf_stride;
|
buf += buf_linesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy existing part
|
// copy existing part
|
||||||
for (; y < end_y; y++) {
|
for (; y < end_y; y++) {
|
||||||
memcpy(buf, src, w * sizeof(pixel));
|
memcpy(buf, src, w * sizeof(pixel));
|
||||||
src += src_stride;
|
src += src_linesize;
|
||||||
buf += buf_stride;
|
buf += buf_linesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bottom
|
// bottom
|
||||||
src -= src_stride;
|
src -= src_linesize;
|
||||||
for (; y < block_h; y++) {
|
for (; y < block_h; y++) {
|
||||||
memcpy(buf, src, w * sizeof(pixel));
|
memcpy(buf, src, w * sizeof(pixel));
|
||||||
buf += buf_stride;
|
buf += buf_linesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf -= block_h * buf_stride + start_x * sizeof(pixel);
|
buf -= block_h * buf_linesize + start_x * sizeof(pixel);
|
||||||
while (block_h--) {
|
while (block_h--) {
|
||||||
pixel *bufp = (pixel *) buf;
|
pixel *bufp = (pixel *) buf;
|
||||||
|
|
||||||
|
@ -92,6 +93,6 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, ptrdiff_t buf_stride,
|
||||||
for (x = end_x; x < block_w; x++) {
|
for (x = end_x; x < block_w; x++) {
|
||||||
bufp[x] = bufp[end_x - 1];
|
bufp[x] = bufp[end_x - 1];
|
||||||
}
|
}
|
||||||
buf += buf_stride;
|
buf += buf_linesize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,9 @@ static av_cold int wma_decode_init(AVCodecContext * avctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i=0; i<MAX_CHANNELS; i++)
|
||||||
|
s->max_exponent[i] = 1.0;
|
||||||
|
|
||||||
if(ff_wma_init(avctx, flags2)<0)
|
if(ff_wma_init(avctx, flags2)<0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -948,6 +951,7 @@ static av_cold void flush(AVCodecContext *avctx)
|
||||||
#if CONFIG_WMAV1_DECODER
|
#if CONFIG_WMAV1_DECODER
|
||||||
AVCodec ff_wmav1_decoder = {
|
AVCodec ff_wmav1_decoder = {
|
||||||
.name = "wmav1",
|
.name = "wmav1",
|
||||||
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.id = AV_CODEC_ID_WMAV1,
|
.id = AV_CODEC_ID_WMAV1,
|
||||||
.priv_data_size = sizeof(WMACodecContext),
|
.priv_data_size = sizeof(WMACodecContext),
|
||||||
|
@ -956,7 +960,6 @@ AVCodec ff_wmav1_decoder = {
|
||||||
.decode = wma_decode_superframe,
|
.decode = wma_decode_superframe,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
|
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
};
|
};
|
||||||
|
@ -964,6 +967,7 @@ AVCodec ff_wmav1_decoder = {
|
||||||
#if CONFIG_WMAV2_DECODER
|
#if CONFIG_WMAV2_DECODER
|
||||||
AVCodec ff_wmav2_decoder = {
|
AVCodec ff_wmav2_decoder = {
|
||||||
.name = "wmav2",
|
.name = "wmav2",
|
||||||
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.id = AV_CODEC_ID_WMAV2,
|
.id = AV_CODEC_ID_WMAV2,
|
||||||
.priv_data_size = sizeof(WMACodecContext),
|
.priv_data_size = sizeof(WMACodecContext),
|
||||||
|
@ -972,7 +976,6 @@ AVCodec ff_wmav2_decoder = {
|
||||||
.decode = wma_decode_superframe,
|
.decode = wma_decode_superframe,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
|
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include "libavutil/internal.h"
|
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
@ -128,8 +127,8 @@ typedef struct WmallDecodeCtx {
|
||||||
|
|
||||||
int8_t mclms_order;
|
int8_t mclms_order;
|
||||||
int8_t mclms_scaling;
|
int8_t mclms_scaling;
|
||||||
int16_t mclms_coeffs[128];
|
int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32];
|
||||||
int16_t mclms_coeffs_cur[4];
|
int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS];
|
||||||
int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32];
|
int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32];
|
||||||
int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32];
|
int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32];
|
||||||
int mclms_recent;
|
int mclms_recent;
|
||||||
|
@ -349,11 +348,11 @@ static int decode_tilehdr(WmallDecodeCtx *s)
|
||||||
if (num_samples[c] == min_channel_len) {
|
if (num_samples[c] == min_channel_len) {
|
||||||
if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
|
if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
|
||||||
(min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) {
|
(min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) {
|
||||||
contains_subframe[c] = in_use = 1;
|
contains_subframe[c] = 1;
|
||||||
} else {
|
} else {
|
||||||
if (get_bits1(&s->gb))
|
contains_subframe[c] = get_bits1(&s->gb);
|
||||||
contains_subframe[c] = in_use = 1;
|
|
||||||
}
|
}
|
||||||
|
in_use |= contains_subframe[c];
|
||||||
} else
|
} else
|
||||||
contains_subframe[c] = 0;
|
contains_subframe[c] = 0;
|
||||||
}
|
}
|
||||||
|
@ -653,10 +652,10 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int *pred)
|
||||||
if (s->mclms_recent == 0) {
|
if (s->mclms_recent == 0) {
|
||||||
memcpy(&s->mclms_prevvalues[order * num_channels],
|
memcpy(&s->mclms_prevvalues[order * num_channels],
|
||||||
s->mclms_prevvalues,
|
s->mclms_prevvalues,
|
||||||
2 * order * num_channels);
|
sizeof(int16_t) * order * num_channels);
|
||||||
memcpy(&s->mclms_updates[order * num_channels],
|
memcpy(&s->mclms_updates[order * num_channels],
|
||||||
s->mclms_updates,
|
s->mclms_updates,
|
||||||
2 * order * num_channels);
|
sizeof(int16_t) * order * num_channels);
|
||||||
s->mclms_recent = num_channels * order;
|
s->mclms_recent = num_channels * order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -677,7 +676,7 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred)
|
||||||
for (i = 0; i < ich; i++)
|
for (i = 0; i < ich; i++)
|
||||||
pred[ich] += s->channel_residues[i][icoef] *
|
pred[ich] += s->channel_residues[i][icoef] *
|
||||||
s->mclms_coeffs_cur[i + num_channels * ich];
|
s->mclms_coeffs_cur[i + num_channels * ich];
|
||||||
pred[ich] += 1 << (s->mclms_scaling - 1);
|
pred[ich] += 1 << s->mclms_scaling - 1;
|
||||||
pred[ich] >>= s->mclms_scaling;
|
pred[ich] >>= s->mclms_scaling;
|
||||||
s->channel_residues[ich][icoef] += pred[ich];
|
s->channel_residues[ich][icoef] += pred[ich];
|
||||||
}
|
}
|
||||||
|
@ -709,7 +708,7 @@ static void lms_update(WmallDecodeCtx *s, int ich, int ilms,
|
||||||
{
|
{
|
||||||
int icoef;
|
int icoef;
|
||||||
int recent = s->cdlms[ich][ilms].recent;
|
int recent = s->cdlms[ich][ilms].recent;
|
||||||
int range = 1 << (s->bits_per_sample - 1);
|
int range = 1 << s->bits_per_sample - 1;
|
||||||
|
|
||||||
if (residue < 0) {
|
if (residue < 0) {
|
||||||
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
|
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
|
||||||
|
@ -1039,9 +1038,10 @@ static int decode_frame(WmallDecodeCtx *s)
|
||||||
len = get_bits(gb, s->log2_frame_size);
|
len = get_bits(gb, s->log2_frame_size);
|
||||||
|
|
||||||
/* decode tile information */
|
/* decode tile information */
|
||||||
if (decode_tilehdr(s)) {
|
if ((ret = decode_tilehdr(s))) {
|
||||||
s->packet_loss = 1;
|
s->packet_loss = 1;
|
||||||
return 0;
|
av_frame_unref(s->frame);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read drc info */
|
/* read drc info */
|
||||||
|
@ -1076,8 +1076,11 @@ static int decode_frame(WmallDecodeCtx *s)
|
||||||
|
|
||||||
/* decode all subframes */
|
/* decode all subframes */
|
||||||
while (!s->parsed_all_subframes) {
|
while (!s->parsed_all_subframes) {
|
||||||
|
int decoded_samples = s->channel[0].decoded_samples;
|
||||||
if (decode_subframe(s) < 0) {
|
if (decode_subframe(s) < 0) {
|
||||||
s->packet_loss = 1;
|
s->packet_loss = 1;
|
||||||
|
if (s->frame->nb_samples)
|
||||||
|
s->frame->nb_samples = decoded_samples;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1183,6 +1186,8 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
|
||||||
if (s->packet_done || s->packet_loss) {
|
if (s->packet_done || s->packet_loss) {
|
||||||
s->packet_done = 0;
|
s->packet_done = 0;
|
||||||
|
|
||||||
|
if (!buf_size)
|
||||||
|
return 0;
|
||||||
/* sanity check for the buffer length */
|
/* sanity check for the buffer length */
|
||||||
if (buf_size < avctx->block_align) {
|
if (buf_size < avctx->block_align) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "buf size %d invalid\n", buf_size);
|
av_log(avctx, AV_LOG_ERROR, "buf size %d invalid\n", buf_size);
|
||||||
|
@ -1305,6 +1310,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||||
|
|
||||||
AVCodec ff_wmalossless_decoder = {
|
AVCodec ff_wmalossless_decoder = {
|
||||||
.name = "wmalossless",
|
.name = "wmalossless",
|
||||||
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.id = AV_CODEC_ID_WMALOSSLESS,
|
.id = AV_CODEC_ID_WMALOSSLESS,
|
||||||
.priv_data_size = sizeof(WmallDecodeCtx),
|
.priv_data_size = sizeof(WmallDecodeCtx),
|
||||||
|
@ -1313,7 +1319,6 @@ AVCodec ff_wmalossless_decoder = {
|
||||||
.decode = decode_packet,
|
.decode = decode_packet,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
|
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
|
||||||
AV_SAMPLE_FMT_S32P,
|
AV_SAMPLE_FMT_S32P,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
|
|
|
@ -89,7 +89,6 @@
|
||||||
#include "libavutil/float_dsp.h"
|
#include "libavutil/float_dsp.h"
|
||||||
#include "libavutil/intfloat.h"
|
#include "libavutil/intfloat.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/internal.h"
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
@ -682,7 +681,7 @@ static void decode_decorrelation_matrix(WMAProDecodeCtx *s,
|
||||||
/**
|
/**
|
||||||
*@brief Decode channel transformation parameters
|
*@brief Decode channel transformation parameters
|
||||||
*@param s codec context
|
*@param s codec context
|
||||||
*@return 0 in case of success, < 0 in case of bitstream errors
|
*@return >= 0 in case of success, < 0 in case of bitstream errors
|
||||||
*/
|
*/
|
||||||
static int decode_channel_transform(WMAProDecodeCtx* s)
|
static int decode_channel_transform(WMAProDecodeCtx* s)
|
||||||
{
|
{
|
||||||
|
@ -1649,6 +1648,7 @@ static void flush(AVCodecContext *avctx)
|
||||||
*/
|
*/
|
||||||
AVCodec ff_wmapro_decoder = {
|
AVCodec ff_wmapro_decoder = {
|
||||||
.name = "wmapro",
|
.name = "wmapro",
|
||||||
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.id = AV_CODEC_ID_WMAPRO,
|
.id = AV_CODEC_ID_WMAPRO,
|
||||||
.priv_data_size = sizeof(WMAProDecodeCtx),
|
.priv_data_size = sizeof(WMAProDecodeCtx),
|
||||||
|
@ -1657,7 +1657,6 @@ AVCodec ff_wmapro_decoder = {
|
||||||
.decode = decode_packet,
|
.decode = decode_packet,
|
||||||
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
|
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "libavutil/channel_layout.h"
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/float_dsp.h"
|
#include "libavutil/float_dsp.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "libavutil/internal.h"
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
@ -2063,6 +2062,7 @@ static av_cold void wmavoice_flush(AVCodecContext *ctx)
|
||||||
|
|
||||||
AVCodec ff_wmavoice_decoder = {
|
AVCodec ff_wmavoice_decoder = {
|
||||||
.name = "wmavoice",
|
.name = "wmavoice",
|
||||||
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.id = AV_CODEC_ID_WMAVOICE,
|
.id = AV_CODEC_ID_WMAVOICE,
|
||||||
.priv_data_size = sizeof(WMAVoiceContext),
|
.priv_data_size = sizeof(WMAVoiceContext),
|
||||||
|
@ -2072,5 +2072,4 @@ AVCodec ff_wmavoice_decoder = {
|
||||||
.decode = wmavoice_decode_packet,
|
.decode = wmavoice_decode_packet,
|
||||||
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
|
||||||
.flush = wmavoice_flush,
|
.flush = wmavoice_flush,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
|
|
||||||
};
|
};
|
||||||
|
|
108
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dcadsp_init.c
Normal file
108
Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dcadsp_init.c
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012-2014 Christophe Gisquet <christophe.gisquet@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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
}
|
|
@ -22,7 +22,7 @@
|
||||||
* MMX optimization by Nick Kurshev <nickols_k@mail.ru>
|
* MMX optimization by Nick Kurshev <nickols_k@mail.ru>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/cpu.h"
|
#include "libavutil/cpu.h"
|
||||||
#include "libavutil/x86/asm.h"
|
#include "libavutil/x86/asm.h"
|
||||||
#include "libavutil/x86/cpu.h"
|
#include "libavutil/x86/cpu.h"
|
||||||
|
@ -252,19 +252,19 @@ static void hpeldsp_init_sse2(HpelDSPContext *c, int flags, int cpu_flags)
|
||||||
#endif /* HAVE_SSE2_EXTERNAL */
|
#endif /* HAVE_SSE2_EXTERNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
|
av_cold void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
|
||||||
{
|
{
|
||||||
int cpu_flags = av_get_cpu_flags();
|
int cpu_flags = av_get_cpu_flags();
|
||||||
|
|
||||||
if (INLINE_MMX(cpu_flags))
|
if (INLINE_MMX(cpu_flags))
|
||||||
hpeldsp_init_mmx(c, flags, cpu_flags);
|
hpeldsp_init_mmx(c, flags, cpu_flags);
|
||||||
|
|
||||||
if (EXTERNAL_MMXEXT(cpu_flags))
|
|
||||||
hpeldsp_init_mmxext(c, flags, cpu_flags);
|
|
||||||
|
|
||||||
if (EXTERNAL_AMD3DNOW(cpu_flags))
|
if (EXTERNAL_AMD3DNOW(cpu_flags))
|
||||||
hpeldsp_init_3dnow(c, flags, 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))
|
if (EXTERNAL_SSE2(cpu_flags))
|
||||||
hpeldsp_init_sse2(c, flags, cpu_flags);
|
hpeldsp_init_sse2(c, flags, cpu_flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
static void imdct36_blocks_ ## CPU(float *out, float *buf, float *in, int count, int switch_point, int block_type);\
|
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);
|
void ff_imdct36_float_ ## CPU(float *out, float *buf, float *in, float *win);
|
||||||
|
|
||||||
|
#if ARCH_X86_32
|
||||||
DECL(sse)
|
DECL(sse)
|
||||||
|
#endif
|
||||||
DECL(sse2)
|
DECL(sse2)
|
||||||
DECL(sse3)
|
DECL(sse3)
|
||||||
DECL(ssse3)
|
DECL(ssse3)
|
||||||
|
@ -223,7 +225,9 @@ static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_SSE
|
#if HAVE_SSE
|
||||||
|
#if ARCH_X86_32
|
||||||
DECL_IMDCT_BLOCKS(sse,sse)
|
DECL_IMDCT_BLOCKS(sse,sse)
|
||||||
|
#endif
|
||||||
DECL_IMDCT_BLOCKS(sse2,sse)
|
DECL_IMDCT_BLOCKS(sse2,sse)
|
||||||
DECL_IMDCT_BLOCKS(sse3,sse)
|
DECL_IMDCT_BLOCKS(sse3,sse)
|
||||||
DECL_IMDCT_BLOCKS(ssse3,sse)
|
DECL_IMDCT_BLOCKS(ssse3,sse)
|
||||||
|
@ -235,9 +239,7 @@ DECL_IMDCT_BLOCKS(avx,avx)
|
||||||
|
|
||||||
av_cold void ff_mpadsp_init_x86(MPADSPContext *s)
|
av_cold void ff_mpadsp_init_x86(MPADSPContext *s)
|
||||||
{
|
{
|
||||||
#if HAVE_SSE2_INLINE || HAVE_YASM
|
|
||||||
int cpu_flags = av_get_cpu_flags();
|
int cpu_flags = av_get_cpu_flags();
|
||||||
#endif
|
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
|
@ -254,15 +256,17 @@ av_cold void ff_mpadsp_init_x86(MPADSPContext *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_SSE2_INLINE
|
#if HAVE_SSE2_INLINE
|
||||||
if (cpu_flags & AV_CPU_FLAG_SSE2) {
|
if (INLINE_SSE2(cpu_flags)) {
|
||||||
s->apply_window_float = apply_window_mp3;
|
s->apply_window_float = apply_window_mp3;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_SSE2_INLINE */
|
#endif /* HAVE_SSE2_INLINE */
|
||||||
|
|
||||||
#if HAVE_YASM
|
#if HAVE_YASM
|
||||||
|
#if ARCH_X86_32
|
||||||
if (EXTERNAL_SSE(cpu_flags)) {
|
if (EXTERNAL_SSE(cpu_flags)) {
|
||||||
s->imdct36_blocks_float = imdct36_blocks_sse;
|
s->imdct36_blocks_float = imdct36_blocks_sse;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||||
s->imdct36_blocks_float = imdct36_blocks_sse2;
|
s->imdct36_blocks_float = imdct36_blocks_sse2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
|
@ -20,7 +20,6 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
@ -91,7 +90,7 @@ static int adts_aac_read_header(AVFormatContext *s)
|
||||||
|
|
||||||
AVInputFormat ff_aac_demuxer = {
|
AVInputFormat ff_aac_demuxer = {
|
||||||
.name = "aac",
|
.name = "aac",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"),
|
.long_name = "raw ADTS AAC (Advanced Audio Coding)",
|
||||||
.read_probe = adts_aac_probe,
|
.read_probe = adts_aac_probe,
|
||||||
.read_header = adts_aac_read_header,
|
.read_header = adts_aac_read_header,
|
||||||
.read_packet = ff_raw_read_partial_packet,
|
.read_packet = ff_raw_read_partial_packet,
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "avformat.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "avformat.h"
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "rdt.h"
|
#include "rdt.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
@ -46,8 +46,7 @@
|
||||||
{ \
|
{ \
|
||||||
extern URLProtocol ff_##x##_protocol; \
|
extern URLProtocol ff_##x##_protocol; \
|
||||||
if (CONFIG_##X##_PROTOCOL) \
|
if (CONFIG_##X##_PROTOCOL) \
|
||||||
ffurl_register_protocol(&ff_##x##_protocol, \
|
ffurl_register_protocol(&ff_##x##_protocol); \
|
||||||
sizeof(ff_##x##_protocol)); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_register_all(void)
|
void av_register_all(void)
|
||||||
|
@ -136,8 +135,10 @@ void av_register_all(void)
|
||||||
REGISTER_MUXDEMUX(H261, h261);
|
REGISTER_MUXDEMUX(H261, h261);
|
||||||
REGISTER_MUXDEMUX(H263, h263);
|
REGISTER_MUXDEMUX(H263, h263);
|
||||||
REGISTER_MUXDEMUX(H264, h264);
|
REGISTER_MUXDEMUX(H264, h264);
|
||||||
REGISTER_DEMUXER (H265, h265);
|
REGISTER_MUXER (HDS, hds);
|
||||||
|
REGISTER_MUXDEMUX(HEVC, hevc);
|
||||||
REGISTER_MUXDEMUX(HLS, hls);
|
REGISTER_MUXDEMUX(HLS, hls);
|
||||||
|
REGISTER_DEMUXER (HNM, hnm);
|
||||||
REGISTER_MUXDEMUX(ICO, ico);
|
REGISTER_MUXDEMUX(ICO, ico);
|
||||||
REGISTER_DEMUXER (IDCIN, idcin);
|
REGISTER_DEMUXER (IDCIN, idcin);
|
||||||
REGISTER_DEMUXER (IDF, idf);
|
REGISTER_DEMUXER (IDF, idf);
|
||||||
|
@ -205,6 +206,7 @@ void av_register_all(void)
|
||||||
REGISTER_DEMUXER (NUV, nuv);
|
REGISTER_DEMUXER (NUV, nuv);
|
||||||
REGISTER_MUXDEMUX(OGG, ogg);
|
REGISTER_MUXDEMUX(OGG, ogg);
|
||||||
REGISTER_MUXDEMUX(OMA, oma);
|
REGISTER_MUXDEMUX(OMA, oma);
|
||||||
|
REGISTER_MUXER (OPUS, opus);
|
||||||
REGISTER_DEMUXER (PAF, paf);
|
REGISTER_DEMUXER (PAF, paf);
|
||||||
REGISTER_MUXDEMUX(PCM_ALAW, pcm_alaw);
|
REGISTER_MUXDEMUX(PCM_ALAW, pcm_alaw);
|
||||||
REGISTER_MUXDEMUX(PCM_MULAW, pcm_mulaw);
|
REGISTER_MUXDEMUX(PCM_MULAW, pcm_mulaw);
|
||||||
|
@ -248,9 +250,10 @@ void av_register_all(void)
|
||||||
REGISTER_MUXDEMUX(SAP, sap);
|
REGISTER_MUXDEMUX(SAP, sap);
|
||||||
REGISTER_DEMUXER (SBG, sbg);
|
REGISTER_DEMUXER (SBG, sbg);
|
||||||
REGISTER_DEMUXER (SDP, sdp);
|
REGISTER_DEMUXER (SDP, sdp);
|
||||||
|
REGISTER_DEMUXER (SDR2, sdr2);
|
||||||
#if CONFIG_RTPDEC
|
#if CONFIG_RTPDEC
|
||||||
av_register_rtp_dynamic_payload_handlers();
|
ff_register_rtp_dynamic_payload_handlers();
|
||||||
av_register_rdt_dynamic_payload_handlers();
|
ff_register_rdt_dynamic_payload_handlers();
|
||||||
#endif
|
#endif
|
||||||
REGISTER_DEMUXER (SEGAFILM, segafilm);
|
REGISTER_DEMUXER (SEGAFILM, segafilm);
|
||||||
REGISTER_MUXER (SEGMENT, segment);
|
REGISTER_MUXER (SEGMENT, segment);
|
||||||
|
@ -264,6 +267,7 @@ void av_register_all(void)
|
||||||
REGISTER_DEMUXER (SOL, sol);
|
REGISTER_DEMUXER (SOL, sol);
|
||||||
REGISTER_MUXDEMUX(SOX, sox);
|
REGISTER_MUXDEMUX(SOX, sox);
|
||||||
REGISTER_MUXDEMUX(SPDIF, spdif);
|
REGISTER_MUXDEMUX(SPDIF, spdif);
|
||||||
|
REGISTER_MUXER (SPEEX, speex);
|
||||||
REGISTER_MUXDEMUX(SRT, srt);
|
REGISTER_MUXDEMUX(SRT, srt);
|
||||||
REGISTER_DEMUXER (STR, str);
|
REGISTER_DEMUXER (STR, str);
|
||||||
REGISTER_DEMUXER (SUBVIEWER1, subviewer1);
|
REGISTER_DEMUXER (SUBVIEWER1, subviewer1);
|
||||||
|
@ -282,6 +286,7 @@ void av_register_all(void)
|
||||||
REGISTER_DEMUXER (TTA, tta);
|
REGISTER_DEMUXER (TTA, tta);
|
||||||
REGISTER_DEMUXER (TXD, txd);
|
REGISTER_DEMUXER (TXD, txd);
|
||||||
REGISTER_DEMUXER (TTY, tty);
|
REGISTER_DEMUXER (TTY, tty);
|
||||||
|
REGISTER_MUXER (UNCODEDFRAMECRC, uncodedframecrc);
|
||||||
REGISTER_MUXDEMUX(VC1, vc1);
|
REGISTER_MUXDEMUX(VC1, vc1);
|
||||||
REGISTER_MUXDEMUX(VC1T, vc1t);
|
REGISTER_MUXDEMUX(VC1T, vc1t);
|
||||||
REGISTER_DEMUXER (VIVO, vivo);
|
REGISTER_DEMUXER (VIVO, vivo);
|
||||||
|
@ -334,6 +339,7 @@ void av_register_all(void)
|
||||||
REGISTER_PROTOCOL(RTP, rtp);
|
REGISTER_PROTOCOL(RTP, rtp);
|
||||||
REGISTER_PROTOCOL(SCTP, sctp);
|
REGISTER_PROTOCOL(SCTP, sctp);
|
||||||
REGISTER_PROTOCOL(SRTP, srtp);
|
REGISTER_PROTOCOL(SRTP, srtp);
|
||||||
|
REGISTER_PROTOCOL(SUBFILE, subfile);
|
||||||
REGISTER_PROTOCOL(TCP, tcp);
|
REGISTER_PROTOCOL(TCP, tcp);
|
||||||
REGISTER_PROTOCOL(TLS, tls);
|
REGISTER_PROTOCOL(TLS, tls);
|
||||||
REGISTER_PROTOCOL(UDP, udp);
|
REGISTER_PROTOCOL(UDP, udp);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
@ -87,10 +86,14 @@ typedef struct {
|
||||||
|
|
||||||
static int ape_probe(AVProbeData * p)
|
static int ape_probe(AVProbeData * p)
|
||||||
{
|
{
|
||||||
if (p->buf[0] == 'M' && p->buf[1] == 'A' && p->buf[2] == 'C' && p->buf[3] == ' ')
|
int version = AV_RL16(p->buf+4);
|
||||||
return AVPROBE_SCORE_MAX;
|
if (AV_RL32(p->buf) != MKTAG('M', 'A', 'C', ' '))
|
||||||
|
return 0;
|
||||||
|
|
||||||
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)
|
static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
|
||||||
|
@ -279,18 +282,20 @@ static int ape_read_header(AVFormatContext * s)
|
||||||
ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1);
|
ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1);
|
||||||
|
|
||||||
if (ape->seektablelength > 0) {
|
if (ape->seektablelength > 0) {
|
||||||
ape->seektable = av_malloc(ape->seektablelength);
|
ape->seektable = av_mallocz(ape->seektablelength);
|
||||||
if (!ape->seektable)
|
if (!ape->seektable)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
for (i = 0; i < ape->seektablelength / sizeof(uint32_t) && !pb->eof_reached; i++)
|
for (i = 0; i < ape->seektablelength / sizeof(uint32_t) && !pb->eof_reached; i++)
|
||||||
ape->seektable[i] = avio_rl32(pb);
|
ape->seektable[i] = avio_rl32(pb);
|
||||||
if (ape->fileversion < 3810) {
|
if (ape->fileversion < 3810) {
|
||||||
ape->bittable = av_malloc(ape->totalframes);
|
ape->bittable = av_mallocz(ape->totalframes);
|
||||||
if (!ape->bittable)
|
if (!ape->bittable)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
for (i = 0; i < ape->totalframes && !pb->eof_reached; i++)
|
for (i = 0; i < ape->totalframes && !pb->eof_reached; i++)
|
||||||
ape->bittable[i] = avio_r8(pb);
|
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].pos = ape->firstframe;
|
||||||
|
@ -355,8 +360,8 @@ static int ape_read_header(AVFormatContext * s)
|
||||||
st->duration = total_blocks;
|
st->duration = total_blocks;
|
||||||
avpriv_set_pts_info(st, 64, 1, ape->samplerate);
|
avpriv_set_pts_info(st, 64, 1, ape->samplerate);
|
||||||
|
|
||||||
st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);
|
if (ff_alloc_extradata(st->codec, APE_EXTRADATA_SIZE))
|
||||||
st->codec->extradata_size = APE_EXTRADATA_SIZE;
|
return AVERROR(ENOMEM);
|
||||||
AV_WL16(st->codec->extradata + 0, ape->fileversion);
|
AV_WL16(st->codec->extradata + 0, ape->fileversion);
|
||||||
AV_WL16(st->codec->extradata + 2, ape->compressiontype);
|
AV_WL16(st->codec->extradata + 2, ape->compressiontype);
|
||||||
AV_WL16(st->codec->extradata + 4, ape->formatflags);
|
AV_WL16(st->codec->extradata + 4, ape->formatflags);
|
||||||
|
@ -412,8 +417,10 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||||
AV_WL32(pkt->data , nblocks);
|
AV_WL32(pkt->data , nblocks);
|
||||||
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
|
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
|
||||||
ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
|
ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
av_free_packet(pkt);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
pkt->pts = ape->frames[ape->currentframe].pts;
|
pkt->pts = ape->frames[ape->currentframe].pts;
|
||||||
pkt->stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
|
@ -454,7 +461,7 @@ static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
|
||||||
|
|
||||||
AVInputFormat ff_ape_demuxer = {
|
AVInputFormat ff_ape_demuxer = {
|
||||||
.name = "ape",
|
.name = "ape",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
|
.long_name = "Monkey's Audio",
|
||||||
.priv_data_size = sizeof(APEContext),
|
.priv_data_size = sizeof(APEContext),
|
||||||
.read_probe = ape_probe,
|
.read_probe = ape_probe,
|
||||||
.read_header = ape_read_header,
|
.read_header = ape_read_header,
|
||||||
|
|
|
@ -62,15 +62,15 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||||
if (!st)
|
if (!st)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
size -= avio_get_str(pb, size, (char *) filename, sizeof(filename));
|
size -= avio_get_str(pb, size, (char *)filename, sizeof(filename));
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key);
|
av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_dict_set(&st->metadata, (const char *) key, (const char *) filename, 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) {
|
if ((id = ff_guess_image2_codec((const char *)filename)) != AV_CODEC_ID_NONE) {
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -88,14 +88,8 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||||
st->attached_pic.stream_index = st->index;
|
st->attached_pic.stream_index = st->index;
|
||||||
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
||||||
} else {
|
} else {
|
||||||
st->codec->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
if (ff_get_extradata(st->codec, s->pb, size) < 0)
|
||||||
if (!st->codec->extradata)
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
if (avio_read(pb, st->codec->extradata, size) != size) {
|
|
||||||
av_freep(&st->codec->extradata);
|
|
||||||
return AVERROR(EIO);
|
|
||||||
}
|
|
||||||
st->codec->extradata_size = size;
|
|
||||||
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
|
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,7 +102,7 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
value[c] = 0;
|
value[c] = 0;
|
||||||
av_dict_set(&s->metadata, (const char *) key, (const char *) value, AV_DICT_DONT_STRDUP_VAL);
|
av_dict_set(&s->metadata, (const char *)key, (const char *)value, AV_DICT_DONT_STRDUP_VAL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +122,7 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
|
||||||
avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
|
avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
|
||||||
|
|
||||||
avio_read(pb, buf, 8); /* APETAGEX */
|
avio_read(pb, buf, 8); /* APETAGEX */
|
||||||
if (strncmp((const char *) buf, APE_TAG_PREAMBLE, 8)) {
|
if (strncmp((const char *)buf, APE_TAG_PREAMBLE, 8)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +188,7 @@ int ff_ape_write_tag(AVFormatContext *s)
|
||||||
while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
|
while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
|
||||||
int val_len;
|
int val_len;
|
||||||
|
|
||||||
if (!string_is_ascii((const unsigned char *) e->key)) {
|
if (!string_is_ascii((const uint8_t *)e->key)) {
|
||||||
av_log(s, AV_LOG_WARNING, "Non ASCII keys are not allowed\n");
|
av_log(s, AV_LOG_WARNING, "Non ASCII keys are not allowed\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +197,7 @@ int ff_ape_write_tag(AVFormatContext *s)
|
||||||
avio_wl32(dyn_bc, val_len); // value length
|
avio_wl32(dyn_bc, val_len); // value length
|
||||||
avio_wl32(dyn_bc, 0); // item flags
|
avio_wl32(dyn_bc, 0); // item flags
|
||||||
avio_put_str(dyn_bc, e->key); // key
|
avio_put_str(dyn_bc, e->key); // key
|
||||||
avio_write(dyn_bc, (const unsigned char *) e->value, val_len); // value
|
avio_write(dyn_bc, (const unsigned char *)e->value, val_len); // value
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (!count)
|
if (!count)
|
||||||
|
@ -215,7 +209,7 @@ int ff_ape_write_tag(AVFormatContext *s)
|
||||||
size += 20;
|
size += 20;
|
||||||
|
|
||||||
// header
|
// header
|
||||||
avio_write(s->pb, (const unsigned char *) "APETAGEX", 8); // id
|
avio_write(s->pb, (const unsigned char *)"APETAGEX", 8); // id
|
||||||
avio_wl32(s->pb, APE_TAG_VERSION); // version
|
avio_wl32(s->pb, APE_TAG_VERSION); // version
|
||||||
avio_wl32(s->pb, size);
|
avio_wl32(s->pb, size);
|
||||||
avio_wl32(s->pb, count);
|
avio_wl32(s->pb, count);
|
||||||
|
@ -223,7 +217,7 @@ int ff_ape_write_tag(AVFormatContext *s)
|
||||||
avio_write(s->pb, dyn_buf, size - 20);
|
avio_write(s->pb, dyn_buf, size - 20);
|
||||||
|
|
||||||
// footer
|
// footer
|
||||||
avio_write(s->pb, (const unsigned char *) "APETAGEX", 8); // id
|
avio_write(s->pb, (const unsigned char *)"APETAGEX", 8); // id
|
||||||
avio_wl32(s->pb, APE_TAG_VERSION); // version
|
avio_wl32(s->pb, APE_TAG_VERSION); // version
|
||||||
avio_wl32(s->pb, size); // size
|
avio_wl32(s->pb, size); // size
|
||||||
avio_wl32(s->pb, count); // tag count
|
avio_wl32(s->pb, count); // tag count
|
||||||
|
|
|
@ -43,6 +43,7 @@ typedef struct ASFStream {
|
||||||
int timestamp;
|
int timestamp;
|
||||||
int64_t duration;
|
int64_t duration;
|
||||||
int skip_to_key;
|
int skip_to_key;
|
||||||
|
int pkt_clean;
|
||||||
|
|
||||||
int ds_span; /* descrambling */
|
int ds_span; /* descrambling */
|
||||||
int ds_packet_size;
|
int ds_packet_size;
|
||||||
|
@ -188,6 +189,4 @@ extern const AVMetadataConv ff_asf_metadata_conv[];
|
||||||
|
|
||||||
extern AVInputFormat ff_asf_demuxer;
|
extern AVInputFormat ff_asf_demuxer;
|
||||||
|
|
||||||
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g);
|
|
||||||
|
|
||||||
#endif /* AVFORMAT_ASF_H */
|
#endif /* AVFORMAT_ASF_H */
|
||||||
|
|
|
@ -1120,8 +1120,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
|
||||||
if (url_feof(pb))
|
if (url_feof(pb))
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
|
|
||||||
if (asf->packet_size_left < FRAME_HEADER_SIZE ||
|
if (asf->packet_size_left < FRAME_HEADER_SIZE) {
|
||||||
asf->packet_segments < 1) {
|
|
||||||
int ret = asf->packet_size_left + asf->packet_padsize;
|
int ret = asf->packet_size_left + asf->packet_padsize;
|
||||||
|
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
|
@ -1136,7 +1135,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
|
||||||
}
|
}
|
||||||
if (asf->packet_time_start == 0) {
|
if (asf->packet_time_start == 0) {
|
||||||
if (asf_read_frame_header(s, pb) < 0) {
|
if (asf_read_frame_header(s, pb) < 0) {
|
||||||
asf->packet_segments = 0;
|
asf->packet_time_start = asf->packet_segments = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (asf->stream_index < 0 ||
|
if (asf->stream_index < 0 ||
|
||||||
|
@ -1158,6 +1157,16 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
|
||||||
asf_st = asf->asf_st;
|
asf_st = asf->asf_st;
|
||||||
av_assert0(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) {
|
if (asf->packet_replic_size == 1) {
|
||||||
// frag_offset is here used as the beginning timestamp
|
// frag_offset is here used as the beginning timestamp
|
||||||
asf->packet_frag_timestamp = asf->packet_time_start;
|
asf->packet_frag_timestamp = asf->packet_time_start;
|
||||||
|
@ -1190,6 +1199,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
|
||||||
asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
|
asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
|
||||||
asf_st->pkt.stream_index = asf->stream_index;
|
asf_st->pkt.stream_index = asf->stream_index;
|
||||||
asf_st->pkt.pos = asf_st->packet_pos = asf->packet_pos;
|
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) {
|
if (asf_st->pkt.data && asf_st->palette_changed) {
|
||||||
uint8_t *pal;
|
uint8_t *pal;
|
||||||
|
@ -1230,6 +1240,11 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
|
||||||
continue;
|
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,
|
ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset,
|
||||||
asf->packet_frag_size);
|
asf->packet_frag_size);
|
||||||
if (ret != asf->packet_frag_size) {
|
if (ret != asf->packet_frag_size) {
|
||||||
|
@ -1347,7 +1362,6 @@ static void asf_reset_header(AVFormatContext *s)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
asf->packet_size_left = 0;
|
asf->packet_size_left = 0;
|
||||||
asf->packet_segments = 0;
|
|
||||||
asf->packet_flags = 0;
|
asf->packet_flags = 0;
|
||||||
asf->packet_property = 0;
|
asf->packet_property = 0;
|
||||||
asf->packet_timestamp = 0;
|
asf->packet_timestamp = 0;
|
||||||
|
@ -1450,30 +1464,30 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index,
|
||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void asf_build_simple_index(AVFormatContext *s, int stream_index)
|
static int asf_build_simple_index(AVFormatContext *s, int stream_index)
|
||||||
{
|
{
|
||||||
ff_asf_guid g;
|
ff_asf_guid g;
|
||||||
ASFContext *asf = s->priv_data;
|
ASFContext *asf = s->priv_data;
|
||||||
int64_t current_pos = avio_tell(s->pb);
|
int64_t current_pos = avio_tell(s->pb);
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if(avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET) < 0) {
|
if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) {
|
||||||
asf->index_read= -1;
|
return ret;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_get_guid(s->pb, &g);
|
if ((ret = ff_get_guid(s->pb, &g)) < 0)
|
||||||
|
goto end;
|
||||||
|
|
||||||
/* the data object can be followed by other top-level objects,
|
/* the data object can be followed by other top-level objects,
|
||||||
* skip them until the simple index object is reached */
|
* skip them until the simple index object is reached */
|
||||||
while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {
|
while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {
|
||||||
int64_t gsize = avio_rl64(s->pb);
|
int64_t gsize = avio_rl64(s->pb);
|
||||||
if (gsize < 24 || url_feof(s->pb)) {
|
if (gsize < 24 || url_feof(s->pb)) {
|
||||||
avio_seek(s->pb, current_pos, SEEK_SET);
|
goto end;
|
||||||
asf->index_read= -1;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
avio_skip(s->pb, gsize - 24);
|
avio_skip(s->pb, gsize - 24);
|
||||||
ff_get_guid(s->pb, &g);
|
if ((ret = ff_get_guid(s->pb, &g)) < 0)
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1481,7 +1495,8 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
|
||||||
int pct, ict;
|
int pct, ict;
|
||||||
int i;
|
int i;
|
||||||
int64_t av_unused gsize = avio_rl64(s->pb);
|
int64_t av_unused gsize = avio_rl64(s->pb);
|
||||||
ff_get_guid(s->pb, &g);
|
if ((ret = ff_get_guid(s->pb, &g)) < 0)
|
||||||
|
goto end;
|
||||||
itime = avio_rl64(s->pb);
|
itime = avio_rl64(s->pb);
|
||||||
pct = avio_rl32(s->pb);
|
pct = avio_rl32(s->pb);
|
||||||
ict = avio_rl32(s->pb);
|
ict = avio_rl32(s->pb);
|
||||||
|
@ -1504,7 +1519,12 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
|
||||||
}
|
}
|
||||||
asf->index_read = ict > 1;
|
asf->index_read = ict > 1;
|
||||||
}
|
}
|
||||||
|
end:
|
||||||
|
// if (url_feof(s->pb)) {
|
||||||
|
// ret = 0;
|
||||||
|
// }
|
||||||
avio_seek(s->pb, current_pos, SEEK_SET);
|
avio_seek(s->pb, current_pos, SEEK_SET);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int asf_read_seek(AVFormatContext *s, int stream_index,
|
static int asf_read_seek(AVFormatContext *s, int stream_index,
|
||||||
|
@ -1512,6 +1532,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index,
|
||||||
{
|
{
|
||||||
ASFContext *asf = s->priv_data;
|
ASFContext *asf = s->priv_data;
|
||||||
AVStream *st = s->streams[stream_index];
|
AVStream *st = s->streams[stream_index];
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (s->packet_size <= 0)
|
if (s->packet_size <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1525,10 +1546,20 @@ static int asf_read_seek(AVFormatContext *s, int stream_index,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!asf->index_read)
|
/* explicitly handle the case of seeking to 0 */
|
||||||
asf_build_simple_index(s, stream_index);
|
if (!pts) {
|
||||||
|
asf_reset_header(s);
|
||||||
|
avio_seek(s->pb, s->data_offset, SEEK_SET);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((asf->index_read > 0 && st->index_entries)) {
|
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);
|
int index = av_index_search_timestamp(st, pts, flags);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
/* find the position */
|
/* find the position */
|
||||||
|
|
|
@ -19,23 +19,23 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "libavutil/channel_layout.h"
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/internal.h"
|
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "ast.h"
|
#include "ast.h"
|
||||||
|
|
||||||
static int ast_probe(AVProbeData *p)
|
static int ast_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
if (AV_RL32(p->buf) == MKTAG('S','T','R','M') &&
|
if (AV_RL32(p->buf) != MKTAG('S','T','R','M'))
|
||||||
AV_RB16(p->buf + 10) &&
|
return 0;
|
||||||
AV_RB16(p->buf + 12) &&
|
|
||||||
AV_RB32(p->buf + 16))
|
if (!AV_RB16(p->buf + 10) ||
|
||||||
return AVPROBE_SCORE_MAX / 3 * 2;
|
!AV_RB16(p->buf + 12) || AV_RB16(p->buf + 12) > 256 ||
|
||||||
return 0;
|
!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)
|
static int ast_read_header(AVFormatContext *s)
|
||||||
|
@ -112,7 +112,7 @@ static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
|
||||||
AVInputFormat ff_ast_demuxer = {
|
AVInputFormat ff_ast_demuxer = {
|
||||||
.name = "ast",
|
.name = "ast",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("AST (Audio Stream)"),
|
.long_name = "AST (Audio Stream)",
|
||||||
.read_probe = ast_probe,
|
.read_probe = ast_probe,
|
||||||
.read_header = ast_read_header,
|
.read_header = ast_read_header,
|
||||||
.read_packet = ast_read_packet,
|
.read_packet = ast_read_packet,
|
||||||
|
|
|
@ -173,6 +173,58 @@
|
||||||
*
|
*
|
||||||
* @defgroup lavf_encoding Muxing
|
* @defgroup lavf_encoding Muxing
|
||||||
* @{
|
* @{
|
||||||
|
* Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write
|
||||||
|
* it into files or other output bytestreams in the specified container format.
|
||||||
|
*
|
||||||
|
* The main API functions for muxing are avformat_write_header() for writing the
|
||||||
|
* file header, av_write_frame() / av_interleaved_write_frame() for writing the
|
||||||
|
* packets and av_write_trailer() for finalizing the file.
|
||||||
|
*
|
||||||
|
* At the beginning of the muxing process, the caller must first call
|
||||||
|
* avformat_alloc_context() to create a muxing context. The caller then sets up
|
||||||
|
* the muxer by filling the various fields in this context:
|
||||||
|
*
|
||||||
|
* - The @ref AVFormatContext.oformat "oformat" field must be set to select the
|
||||||
|
* muxer that will be used.
|
||||||
|
* - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb
|
||||||
|
* "pb" field must be set to an opened IO context, either returned from
|
||||||
|
* avio_open2() or a custom one.
|
||||||
|
* - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must
|
||||||
|
* be created with the avformat_new_stream() function. The caller should fill
|
||||||
|
* 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
|
||||||
|
* 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).
|
||||||
|
* - 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
|
||||||
|
* AVFormatContext.programs "programs", etc. as described in the
|
||||||
|
* AVFormatContext documentation. Whether such information will actually be
|
||||||
|
* stored in the output depends on what the container format and the muxer
|
||||||
|
* support.
|
||||||
|
*
|
||||||
|
* When the muxing context is fully set up, the caller must call
|
||||||
|
* avformat_write_header() to initialize the muxer internals and write the file
|
||||||
|
* header. Whether anything actually is written to the IO context at this step
|
||||||
|
* depends on the muxer, but this function must always be called. Any muxer
|
||||||
|
* private options must be passed in the options parameter to this function.
|
||||||
|
*
|
||||||
|
* The data is then sent to the muxer by repeatedly calling av_write_frame() or
|
||||||
|
* av_interleaved_write_frame() (consult those functions' documentation for
|
||||||
|
* discussion on the difference between them; only one of them may be used with
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* context (if any) and finally free the muxing context with
|
||||||
|
* avformat_free_context().
|
||||||
* @}
|
* @}
|
||||||
*
|
*
|
||||||
* @defgroup lavf_io I/O Read/Write
|
* @defgroup lavf_io I/O Read/Write
|
||||||
|
@ -217,6 +269,7 @@
|
||||||
|
|
||||||
struct AVFormatContext;
|
struct AVFormatContext;
|
||||||
|
|
||||||
|
struct AVDeviceInfoList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup metadata_api Public Metadata API
|
* @defgroup metadata_api Public Metadata API
|
||||||
|
@ -298,6 +351,7 @@ struct AVFormatContext;
|
||||||
* Allocate and read the payload of a packet and initialize its
|
* Allocate and read the payload of a packet and initialize its
|
||||||
* fields with default values.
|
* fields with default values.
|
||||||
*
|
*
|
||||||
|
* @param s associated IO context
|
||||||
* @param pkt packet
|
* @param pkt packet
|
||||||
* @param size desired payload size
|
* @param size desired payload size
|
||||||
* @return >0 (read size) if OK, AVERROR_xxx otherwise
|
* @return >0 (read size) if OK, AVERROR_xxx otherwise
|
||||||
|
@ -313,6 +367,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
|
||||||
* when there is no reasonable way to know (an upper bound of)
|
* when there is no reasonable way to know (an upper bound of)
|
||||||
* the final size.
|
* the final size.
|
||||||
*
|
*
|
||||||
|
* @param s associated IO context
|
||||||
* @param pkt packet
|
* @param pkt packet
|
||||||
* @param size amount of data to read
|
* @param size amount of data to read
|
||||||
* @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
|
* @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
|
||||||
|
@ -346,6 +401,8 @@ typedef struct AVProbeData {
|
||||||
} AVProbeData;
|
} AVProbeData;
|
||||||
|
|
||||||
#define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
|
#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_EXTENSION 50 ///< score for file extension
|
||||||
#define AVPROBE_SCORE_MAX 100 ///< maximum score
|
#define AVPROBE_SCORE_MAX 100 ///< maximum score
|
||||||
|
|
||||||
|
@ -461,6 +518,27 @@ typedef struct AVOutputFormat {
|
||||||
|
|
||||||
void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
|
void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
|
||||||
int64_t *dts, int64_t *wall);
|
int64_t *dts, int64_t *wall);
|
||||||
|
/**
|
||||||
|
* Allows sending messages from application to device.
|
||||||
|
*/
|
||||||
|
int (*control_message)(struct AVFormatContext *s, int type,
|
||||||
|
void *data, size_t data_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an uncoded AVFrame.
|
||||||
|
*
|
||||||
|
* See av_write_uncoded_frame() for details.
|
||||||
|
*
|
||||||
|
* The library will free *frame afterwards, but the muxer can prevent it
|
||||||
|
* by setting the pointer to NULL.
|
||||||
|
*/
|
||||||
|
int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index,
|
||||||
|
AVFrame **frame, unsigned flags);
|
||||||
|
/**
|
||||||
|
* Returns device list with it properties.
|
||||||
|
* @see avdevice_list_devices() for more details.
|
||||||
|
*/
|
||||||
|
int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
|
||||||
} AVOutputFormat;
|
} AVOutputFormat;
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
@ -589,6 +667,12 @@ typedef struct AVInputFormat {
|
||||||
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
|
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
|
||||||
*/
|
*/
|
||||||
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
|
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns device list with it properties.
|
||||||
|
* @see avdevice_list_devices() for more details.
|
||||||
|
*/
|
||||||
|
int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
|
||||||
} AVInputFormat;
|
} AVInputFormat;
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
@ -764,6 +848,7 @@ typedef struct AVStream {
|
||||||
int64_t last_dts;
|
int64_t last_dts;
|
||||||
int64_t duration_gcd;
|
int64_t duration_gcd;
|
||||||
int duration_count;
|
int duration_count;
|
||||||
|
int64_t rfps_duration_sum;
|
||||||
double (*duration_error)[2][MAX_STD_TIMEBASES];
|
double (*duration_error)[2][MAX_STD_TIMEBASES];
|
||||||
int64_t codec_info_duration;
|
int64_t codec_info_duration;
|
||||||
int64_t codec_info_duration_fields;
|
int64_t codec_info_duration_fields;
|
||||||
|
@ -783,6 +868,11 @@ typedef struct AVStream {
|
||||||
|
|
||||||
int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
|
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 generation support:
|
||||||
/**
|
/**
|
||||||
* Timestamp corresponding to the last dts sync point.
|
* Timestamp corresponding to the last dts sync point.
|
||||||
|
@ -791,7 +881,6 @@ typedef struct AVStream {
|
||||||
* a DTS is received from the underlying container. Otherwise set to
|
* a DTS is received from the underlying container. Otherwise set to
|
||||||
* AV_NOPTS_VALUE by default.
|
* AV_NOPTS_VALUE by default.
|
||||||
*/
|
*/
|
||||||
int64_t reference_dts;
|
|
||||||
int64_t first_dts;
|
int64_t first_dts;
|
||||||
int64_t cur_dts;
|
int64_t cur_dts;
|
||||||
int64_t last_IP_pts;
|
int64_t last_IP_pts;
|
||||||
|
@ -896,6 +985,24 @@ typedef struct AVStream {
|
||||||
*/
|
*/
|
||||||
int pts_wrap_behavior;
|
int pts_wrap_behavior;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal data to prevent doing update_initial_durations() twice
|
||||||
|
*/
|
||||||
|
int update_initial_durations_done;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal data to generate dts from pts
|
||||||
|
*/
|
||||||
|
int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
|
||||||
|
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal data to analyze DTS and detect faulty mpeg streams
|
||||||
|
*/
|
||||||
|
int64_t last_dts_for_order_check;
|
||||||
|
uint8_t dts_ordered;
|
||||||
|
uint8_t dts_misordered;
|
||||||
|
|
||||||
} AVStream;
|
} AVStream;
|
||||||
|
|
||||||
AVRational av_stream_get_r_frame_rate(const AVStream *s);
|
AVRational av_stream_get_r_frame_rate(const AVStream *s);
|
||||||
|
@ -946,6 +1053,13 @@ typedef struct AVChapter {
|
||||||
} AVChapter;
|
} AVChapter;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback used by devices to communicate with application.
|
||||||
|
*/
|
||||||
|
typedef int (*av_format_control_message)(struct AVFormatContext *s, int type,
|
||||||
|
void *data, size_t data_size);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The duration of a video can be estimated through various ways, and this enum can be used
|
* The duration of a video can be estimated through various ways, and this enum can be used
|
||||||
* to know how the duration was estimated.
|
* to know how the duration was estimated.
|
||||||
|
@ -956,6 +1070,8 @@ enum AVDurationEstimationMethod {
|
||||||
AVFMT_DURATION_FROM_BITRATE ///< Duration estimated from bitrate (less accurate)
|
AVFMT_DURATION_FROM_BITRATE ///< Duration estimated from bitrate (less accurate)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct AVFormatInternal AVFormatInternal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format I/O context.
|
* Format I/O context.
|
||||||
* New fields can be added to the end with minor version bumps.
|
* New fields can be added to the end with minor version bumps.
|
||||||
|
@ -966,32 +1082,41 @@ enum AVDurationEstimationMethod {
|
||||||
*/
|
*/
|
||||||
typedef struct AVFormatContext {
|
typedef struct AVFormatContext {
|
||||||
/**
|
/**
|
||||||
* A class for logging and AVOptions. Set by avformat_alloc_context().
|
* A class for logging and @ref avoptions. Set by avformat_alloc_context().
|
||||||
* Exports (de)muxer private options if they exist.
|
* Exports (de)muxer private options if they exist.
|
||||||
*/
|
*/
|
||||||
const AVClass *av_class;
|
const AVClass *av_class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can only be iformat or oformat, not both at the same time.
|
* The input container format.
|
||||||
*
|
*
|
||||||
* decoding: set by avformat_open_input().
|
* Demuxing only, set by avformat_open_input().
|
||||||
* encoding: set by the user.
|
|
||||||
*/
|
*/
|
||||||
struct AVInputFormat *iformat;
|
struct AVInputFormat *iformat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The output container format.
|
||||||
|
*
|
||||||
|
* Muxing only, must be set by the caller before avformat_write_header().
|
||||||
|
*/
|
||||||
struct AVOutputFormat *oformat;
|
struct AVOutputFormat *oformat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format private data. This is an AVOptions-enabled struct
|
* Format private data. This is an AVOptions-enabled struct
|
||||||
* if and only if iformat/oformat.priv_class is not NULL.
|
* if and only if iformat/oformat.priv_class is not NULL.
|
||||||
|
*
|
||||||
|
* - muxing: set by avformat_write_header()
|
||||||
|
* - demuxing: set by avformat_open_input()
|
||||||
*/
|
*/
|
||||||
void *priv_data;
|
void *priv_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I/O context.
|
* I/O context.
|
||||||
*
|
*
|
||||||
* decoding: either set by the user before avformat_open_input() (then
|
* - demuxing: either set by the user before avformat_open_input() (then
|
||||||
* the user must close it manually) or set by avformat_open_input().
|
* the user must close it manually) or set by avformat_open_input().
|
||||||
* encoding: set by the user.
|
* - muxing: set by the user before avformat_write_header(). The caller must
|
||||||
|
* take care of closing / freeing the IO context.
|
||||||
*
|
*
|
||||||
* Do NOT set this field if AVFMT_NOFILE flag is set in
|
* Do NOT set this field if AVFMT_NOFILE flag is set in
|
||||||
* iformat/oformat.flags. In such a case, the (de)muxer will handle
|
* iformat/oformat.flags. In such a case, the (de)muxer will handle
|
||||||
|
@ -1002,37 +1127,54 @@ typedef struct AVFormatContext {
|
||||||
/* stream info */
|
/* stream info */
|
||||||
int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
|
int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of elements in AVFormatContext.streams.
|
||||||
|
*
|
||||||
|
* Set by avformat_new_stream(), must not be modified by any other code.
|
||||||
|
*/
|
||||||
|
unsigned int nb_streams;
|
||||||
/**
|
/**
|
||||||
* A list of all streams in the file. New streams are created with
|
* A list of all streams in the file. New streams are created with
|
||||||
* avformat_new_stream().
|
* avformat_new_stream().
|
||||||
*
|
*
|
||||||
* decoding: streams are created by libavformat in avformat_open_input().
|
* - demuxing: streams are created by libavformat in avformat_open_input().
|
||||||
* If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also
|
* If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also
|
||||||
* appear in av_read_frame().
|
* appear in av_read_frame().
|
||||||
* encoding: streams are created by the user before avformat_write_header().
|
* - muxing: streams are created by the user before avformat_write_header().
|
||||||
|
*
|
||||||
|
* Freed by libavformat in avformat_free_context().
|
||||||
*/
|
*/
|
||||||
unsigned int nb_streams;
|
|
||||||
AVStream **streams;
|
AVStream **streams;
|
||||||
|
|
||||||
char filename[1024]; /**< input or output filename */
|
/**
|
||||||
|
* input or output filename
|
||||||
|
*
|
||||||
|
* - demuxing: set by avformat_open_input()
|
||||||
|
* - muxing: may be set by the caller before avformat_write_header()
|
||||||
|
*/
|
||||||
|
char filename[1024];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decoding: position of the first frame of the component, in
|
* Position of the first frame of the component, in
|
||||||
* AV_TIME_BASE fractional seconds. NEVER set this value directly:
|
* AV_TIME_BASE fractional seconds. NEVER set this value directly:
|
||||||
* It is deduced from the AVStream values.
|
* It is deduced from the AVStream values.
|
||||||
|
*
|
||||||
|
* Demuxing only, set by libavformat.
|
||||||
*/
|
*/
|
||||||
int64_t start_time;
|
int64_t start_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decoding: duration of the stream, in AV_TIME_BASE fractional
|
* Duration of the stream, in AV_TIME_BASE fractional
|
||||||
* seconds. Only set this value if you know none of the individual stream
|
* seconds. Only set this value if you know none of the individual stream
|
||||||
* durations and also do not set any of them. This is deduced from the
|
* durations and also do not set any of them. This is deduced from the
|
||||||
* AVStream values if not set.
|
* AVStream values if not set.
|
||||||
|
*
|
||||||
|
* Demuxing only, set by libavformat.
|
||||||
*/
|
*/
|
||||||
int64_t duration;
|
int64_t duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decoding: total stream bitrate in bit/s, 0 if not
|
* Total stream bitrate in bit/s, 0 if not
|
||||||
* available. Never set it directly if the file_size and the
|
* available. Never set it directly if the file_size and the
|
||||||
* duration are known as FFmpeg can compute it automatically.
|
* duration are known as FFmpeg can compute it automatically.
|
||||||
*/
|
*/
|
||||||
|
@ -1058,13 +1200,16 @@ typedef struct AVFormatContext {
|
||||||
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
|
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* decoding: size of data to probe; encoding: unused.
|
* 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;
|
unsigned int probesize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* decoding: maximum time (in AV_TIME_BASE units) during which the input should
|
* Maximum duration (in AV_TIME_BASE units) of the data read
|
||||||
* be analyzed in avformat_find_stream_info().
|
* from input in avformat_find_stream_info().
|
||||||
|
* Demuxing only, set by the caller before avformat_find_stream_info().
|
||||||
*/
|
*/
|
||||||
int max_analyze_duration;
|
int max_analyze_duration;
|
||||||
|
|
||||||
|
@ -1099,8 +1244,8 @@ typedef struct AVFormatContext {
|
||||||
* accurate seeking (depends on demuxer).
|
* accurate seeking (depends on demuxer).
|
||||||
* Demuxers for which a full in-memory index is mandatory will ignore
|
* Demuxers for which a full in-memory index is mandatory will ignore
|
||||||
* this.
|
* this.
|
||||||
* muxing : unused
|
* - muxing: unused
|
||||||
* demuxing: set by user
|
* - demuxing: set by user
|
||||||
*/
|
*/
|
||||||
unsigned int max_index_size;
|
unsigned int max_index_size;
|
||||||
|
|
||||||
|
@ -1118,41 +1263,49 @@ typedef struct AVFormatContext {
|
||||||
* in the trailer. To write chapters in the trailer, nb_chapters
|
* in the trailer. To write chapters in the trailer, nb_chapters
|
||||||
* must be zero when write_header is called and non-zero when
|
* must be zero when write_header is called and non-zero when
|
||||||
* write_trailer is called.
|
* write_trailer is called.
|
||||||
* muxing : set by user
|
* - muxing: set by user
|
||||||
* demuxing: set by libavformat
|
* - demuxing: set by libavformat
|
||||||
*/
|
*/
|
||||||
unsigned int nb_chapters;
|
unsigned int nb_chapters;
|
||||||
AVChapter **chapters;
|
AVChapter **chapters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metadata that applies to the whole file.
|
||||||
|
*
|
||||||
|
* - demuxing: set by libavformat in avformat_open_input()
|
||||||
|
* - muxing: may be set by the caller before avformat_write_header()
|
||||||
|
*
|
||||||
|
* Freed by libavformat in avformat_free_context().
|
||||||
|
*/
|
||||||
AVDictionary *metadata;
|
AVDictionary *metadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start time of the stream in real world time, in microseconds
|
* Start time of the stream in real world time, in microseconds
|
||||||
* since the unix epoch (00:00 1st January 1970). That is, pts=0
|
* since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the
|
||||||
* in the stream was captured at this real world time.
|
* stream was captured at this real world time.
|
||||||
* - encoding: Set by user.
|
* Muxing only, set by the caller before avformat_write_header().
|
||||||
* - decoding: Unused.
|
|
||||||
*/
|
*/
|
||||||
int64_t start_time_realtime;
|
int64_t start_time_realtime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* decoding: number of frames used to probe fps
|
* The number of frames used for determining the framerate in
|
||||||
|
* avformat_find_stream_info().
|
||||||
|
* Demuxing only, set by the caller before avformat_find_stream_info().
|
||||||
*/
|
*/
|
||||||
int fps_probe_size;
|
int fps_probe_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error recognition; higher values will detect more errors but may
|
* Error recognition; higher values will detect more errors but may
|
||||||
* misdetect some more or less valid parts as errors.
|
* misdetect some more or less valid parts as errors.
|
||||||
* - encoding: unused
|
* Demuxing only, set by the caller before avformat_open_input().
|
||||||
* - decoding: Set by user.
|
|
||||||
*/
|
*/
|
||||||
int error_recognition;
|
int error_recognition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom interrupt callbacks for the I/O layer.
|
* Custom interrupt callbacks for the I/O layer.
|
||||||
*
|
*
|
||||||
* decoding: set by the user before avformat_open_input().
|
* demuxing: set by the user before avformat_open_input().
|
||||||
* encoding: set by the user before avformat_write_header()
|
* muxing: set by the user before avformat_write_header()
|
||||||
* (mainly useful for AVFMT_NOFILE formats). The callback
|
* (mainly useful for AVFMT_NOFILE formats). The callback
|
||||||
* should also be passed to avio_open2() if it's used to
|
* should also be passed to avio_open2() if it's used to
|
||||||
* open the file.
|
* open the file.
|
||||||
|
@ -1165,6 +1318,24 @@ typedef struct AVFormatContext {
|
||||||
int debug;
|
int debug;
|
||||||
#define FF_FDEBUG_TS 0x0001
|
#define FF_FDEBUG_TS 0x0001
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum buffering duration for interleaving.
|
||||||
|
*
|
||||||
|
* To ensure all the streams are interleaved correctly,
|
||||||
|
* av_interleaved_write_frame() will wait until it has at least one packet
|
||||||
|
* for each stream before actually writing any packets to the output file.
|
||||||
|
* When some streams are "sparse" (i.e. there are large gaps between
|
||||||
|
* successive packets), this can result in excessive buffering.
|
||||||
|
*
|
||||||
|
* This field specifies the maximum difference between the timestamps of the
|
||||||
|
* first and the last packet in the muxing queue, above which libavformat
|
||||||
|
* will output a packet regardless of whether it has queued a packet for all
|
||||||
|
* the streams.
|
||||||
|
*
|
||||||
|
* Muxing only, set by the caller before avformat_write_header().
|
||||||
|
*/
|
||||||
|
int64_t max_interleave_delta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transport stream id.
|
* Transport stream id.
|
||||||
* This will be moved into demuxer private options. Thus no API/ABI compatibility
|
* This will be moved into demuxer private options. Thus no API/ABI compatibility
|
||||||
|
@ -1239,14 +1410,14 @@ typedef struct AVFormatContext {
|
||||||
/**
|
/**
|
||||||
* Correct single timestamp overflows
|
* Correct single timestamp overflows
|
||||||
* - encoding: unused
|
* - encoding: unused
|
||||||
* - decoding: Set by user via AVOPtions (NO direct access)
|
* - decoding: Set by user via AVOptions (NO direct access)
|
||||||
*/
|
*/
|
||||||
unsigned int correct_ts_overflow;
|
unsigned int correct_ts_overflow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force seeking to any (also non key) frames.
|
* Force seeking to any (also non key) frames.
|
||||||
* - encoding: unused
|
* - encoding: unused
|
||||||
* - decoding: Set by user via AVOPtions (NO direct access)
|
* - decoding: Set by user via AVOptions (NO direct access)
|
||||||
*/
|
*/
|
||||||
int seek2any;
|
int seek2any;
|
||||||
|
|
||||||
|
@ -1316,6 +1487,12 @@ typedef struct AVFormatContext {
|
||||||
*/
|
*/
|
||||||
AVRational offset_timebase;
|
AVRational offset_timebase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An opaque field for libavformat internal usage.
|
||||||
|
* Must not be accessed in any way by callers.
|
||||||
|
*/
|
||||||
|
AVFormatInternal *internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IO repositioned flag.
|
* IO repositioned flag.
|
||||||
* This is set by avformat when the underlaying IO context read pointer
|
* This is set by avformat when the underlaying IO context read pointer
|
||||||
|
@ -1323,9 +1500,70 @@ typedef struct AVFormatContext {
|
||||||
* Demuxers can use the flag to detect such changes.
|
* Demuxers can use the flag to detect such changes.
|
||||||
*/
|
*/
|
||||||
int io_repositioned;
|
int io_repositioned;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forced video 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_video_codec (NO direct access).
|
||||||
|
*/
|
||||||
|
AVCodec *video_codec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forced audio 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_audio_codec (NO direct access).
|
||||||
|
*/
|
||||||
|
AVCodec *audio_codec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forced subtitle 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_subtitle_codec (NO direct access).
|
||||||
|
*/
|
||||||
|
AVCodec *subtitle_codec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of bytes to be written as padding in a metadata header.
|
||||||
|
* Demuxing: Unused.
|
||||||
|
* Muxing: Set by user via av_format_set_metadata_header_padding.
|
||||||
|
*/
|
||||||
|
int metadata_header_padding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback used by devices to communicate with application.
|
||||||
|
*/
|
||||||
|
av_format_control_message control_message_cb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output timestamp offset, in microseconds.
|
||||||
|
* Muxing: set by user via AVOptions (NO direct access)
|
||||||
|
*/
|
||||||
|
int64_t output_ts_offset;
|
||||||
} AVFormatContext;
|
} AVFormatContext;
|
||||||
|
|
||||||
int av_format_get_probe_score(const AVFormatContext *s);
|
int av_format_get_probe_score(const AVFormatContext *s);
|
||||||
|
AVCodec * av_format_get_video_codec(const AVFormatContext *s);
|
||||||
|
void av_format_set_video_codec(AVFormatContext *s, AVCodec *c);
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the method used to set ctx->duration.
|
* Returns the method used to set ctx->duration.
|
||||||
|
@ -1439,6 +1677,7 @@ const AVClass *avformat_get_class(void);
|
||||||
* User is required to call avcodec_close() and avformat_free_context() to
|
* User is required to call avcodec_close() and avformat_free_context() to
|
||||||
* clean up the allocation by avformat_new_stream().
|
* clean up the allocation by avformat_new_stream().
|
||||||
*
|
*
|
||||||
|
* @param s media file handle
|
||||||
* @param c If non-NULL, the AVCodecContext corresponding to the new stream
|
* @param c If non-NULL, the AVCodecContext corresponding to the new stream
|
||||||
* will be initialized to use this codec. This is needed for e.g. codec-specific
|
* will be initialized to use this codec. This is needed for e.g. codec-specific
|
||||||
* defaults to be set, so codec should be provided if it is known.
|
* defaults to be set, so codec should be provided if it is known.
|
||||||
|
@ -1496,6 +1735,7 @@ AVInputFormat *av_find_input_format(const char *short_name);
|
||||||
/**
|
/**
|
||||||
* Guess the file format.
|
* Guess the file format.
|
||||||
*
|
*
|
||||||
|
* @param pd data to be probed
|
||||||
* @param is_opened Whether the file is already opened; determines whether
|
* @param is_opened Whether the file is already opened; determines whether
|
||||||
* demuxers with or without AVFMT_NOFILE are probed.
|
* demuxers with or without AVFMT_NOFILE are probed.
|
||||||
*/
|
*/
|
||||||
|
@ -1504,6 +1744,7 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
|
||||||
/**
|
/**
|
||||||
* Guess the file format.
|
* Guess the file format.
|
||||||
*
|
*
|
||||||
|
* @param pd data to be probed
|
||||||
* @param is_opened Whether the file is already opened; determines whether
|
* @param is_opened Whether the file is already opened; determines whether
|
||||||
* demuxers with or without AVFMT_NOFILE are probed.
|
* demuxers with or without AVFMT_NOFILE are probed.
|
||||||
* @param score_max A probe score larger that this is required to accept a
|
* @param score_max A probe score larger that this is required to accept a
|
||||||
|
@ -1657,7 +1898,7 @@ int av_find_best_stream(AVFormatContext *ic,
|
||||||
enum AVMediaType type,
|
enum AVMediaType type,
|
||||||
int wanted_stream_nb,
|
int wanted_stream_nb,
|
||||||
int related_stream,
|
int related_stream,
|
||||||
const AVCodec **decoder_ret,
|
AVCodec **decoder_ret,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
#if FF_API_READ_PACKET
|
#if FF_API_READ_PACKET
|
||||||
|
@ -1707,6 +1948,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt);
|
||||||
/**
|
/**
|
||||||
* Seek to the keyframe at timestamp.
|
* Seek to the keyframe at timestamp.
|
||||||
* 'timestamp' in 'stream_index'.
|
* 'timestamp' in 'stream_index'.
|
||||||
|
*
|
||||||
|
* @param s media file handle
|
||||||
* @param stream_index If stream_index is (-1), a default
|
* @param stream_index If stream_index is (-1), a default
|
||||||
* stream is selected, and timestamp is automatically converted
|
* stream is selected, and timestamp is automatically converted
|
||||||
* from AV_TIME_BASE units to the stream specific time_base.
|
* from AV_TIME_BASE units to the stream specific time_base.
|
||||||
|
@ -1734,6 +1977,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
|
||||||
* keyframes (this may not be supported by all demuxers).
|
* keyframes (this may not be supported by all demuxers).
|
||||||
* If flags contain AVSEEK_FLAG_BACKWARD, it is ignored.
|
* If flags contain AVSEEK_FLAG_BACKWARD, it is ignored.
|
||||||
*
|
*
|
||||||
|
* @param s media file handle
|
||||||
* @param stream_index index of the stream which is used as time base reference
|
* @param stream_index index of the stream which is used as time base reference
|
||||||
* @param min_ts smallest acceptable timestamp
|
* @param min_ts smallest acceptable timestamp
|
||||||
* @param ts target timestamp
|
* @param ts target timestamp
|
||||||
|
@ -1833,49 +2077,108 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options);
|
||||||
/**
|
/**
|
||||||
* Write a packet to an output media file.
|
* Write a packet to an output media file.
|
||||||
*
|
*
|
||||||
* The packet shall contain one audio or video frame.
|
* This function passes the packet directly to the muxer, without any buffering
|
||||||
* The packet must be correctly interleaved according to the container
|
* or reordering. The caller is responsible for correctly interleaving the
|
||||||
* specification, if not then av_interleaved_write_frame must be used.
|
* packets if the format requires it. Callers that want libavformat to handle
|
||||||
|
* the interleaving should call av_interleaved_write_frame() instead of this
|
||||||
|
* function.
|
||||||
*
|
*
|
||||||
* @param s media file handle
|
* @param s media file handle
|
||||||
* @param pkt The packet, which contains the stream_index, buf/buf_size,
|
* @param pkt The packet containing the data to be written. Note that unlike
|
||||||
* dts/pts, ...
|
* av_interleaved_write_frame(), this function does not take
|
||||||
* This can be NULL (at any time, not just at the end), in
|
* ownership of the packet passed to it (though some muxers may make
|
||||||
* order to immediately flush data buffered within the muxer,
|
* an internal reference to the input packet).
|
||||||
* for muxers that buffer up data internally before writing it
|
* <br>
|
||||||
* to the output.
|
* This parameter can be NULL (at any time, not just at the end), in
|
||||||
|
* order to immediately flush data buffered within the muxer, for
|
||||||
|
* muxers that buffer up data internally before writing it to the
|
||||||
|
* output.
|
||||||
|
* <br>
|
||||||
|
* 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.
|
||||||
* @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
|
* @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
|
||||||
|
*
|
||||||
|
* @see av_interleaved_write_frame()
|
||||||
*/
|
*/
|
||||||
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
|
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a packet to an output media file ensuring correct interleaving.
|
* Write a packet to an output media file ensuring correct interleaving.
|
||||||
*
|
*
|
||||||
* The packet must contain one audio or video frame.
|
* This function will buffer the packets internally as needed to make sure the
|
||||||
* If the packets are already correctly interleaved, the application should
|
* packets in the output file are properly interleaved in the order of
|
||||||
* call av_write_frame() instead as it is slightly faster. It is also important
|
* increasing dts. Callers doing their own interleaving should call
|
||||||
* to keep in mind that completely non-interleaved input will need huge amounts
|
* av_write_frame() instead of this function.
|
||||||
* of memory to interleave with this, so it is preferable to interleave at the
|
|
||||||
* demuxer level.
|
|
||||||
*
|
*
|
||||||
* @param s media file handle
|
* @param s media file handle
|
||||||
* @param pkt The packet containing the data to be written. pkt->buf must be set
|
* @param pkt The packet containing the data to be written.
|
||||||
* to a valid AVBufferRef describing the packet data. Libavformat takes
|
* <br>
|
||||||
* ownership of this reference and will unref it when it sees fit. The caller
|
* If the packet is reference-counted, this function will take
|
||||||
* must not access the data through this reference after this function returns.
|
* ownership of this reference and unreference it later when it sees
|
||||||
* This can be NULL (at any time, not just at the end), to flush the
|
* fit.
|
||||||
* interleaving queues.
|
* The caller must not access the data through this reference after
|
||||||
* Packet's @ref AVPacket.stream_index "stream_index" field must be set to the
|
* this function returns. If the packet is not reference-counted,
|
||||||
* index of the corresponding stream in @ref AVFormatContext.streams
|
* libavformat will make a copy.
|
||||||
* "s.streams".
|
* <br>
|
||||||
* It is very strongly recommended that timing information (@ref AVPacket.pts
|
* This parameter can be NULL (at any time, not just at the end), to
|
||||||
* "pts", @ref AVPacket.dts "dts" @ref AVPacket.duration "duration") is set to
|
* flush the interleaving queues.
|
||||||
* correct values.
|
* <br>
|
||||||
|
* 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.
|
||||||
*
|
*
|
||||||
* @return 0 on success, a negative AVERROR on error.
|
* @return 0 on success, a negative AVERROR on error. Libavformat will always
|
||||||
|
* take care of freeing the packet, even if this function fails.
|
||||||
|
*
|
||||||
|
* @see av_write_frame(), AVFormatContext.max_interleave_delta
|
||||||
*/
|
*/
|
||||||
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
|
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a uncoded frame to an output media file.
|
||||||
|
*
|
||||||
|
* The frame must be correctly interleaved according to the container
|
||||||
|
* specification; if not, then av_interleaved_write_frame() must be used.
|
||||||
|
*
|
||||||
|
* See av_interleaved_write_frame() for details.
|
||||||
|
*/
|
||||||
|
int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
|
||||||
|
AVFrame *frame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a uncoded frame to an output media file.
|
||||||
|
*
|
||||||
|
* If the muxer supports it, this function allows 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.
|
||||||
|
*
|
||||||
|
* To test whether it is possible to use it with a given muxer and stream,
|
||||||
|
* use av_write_uncoded_frame_query().
|
||||||
|
*
|
||||||
|
* The caller gives up ownership of the frame and must not access it
|
||||||
|
* afterwards.
|
||||||
|
*
|
||||||
|
* @return >=0 for success, a negative code on error
|
||||||
|
*/
|
||||||
|
int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index,
|
||||||
|
AVFrame *frame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether a muxer supports uncoded frame.
|
||||||
|
*
|
||||||
|
* @return >=0 if an uncoded frame can be written to that muxer and stream,
|
||||||
|
* <0 if not
|
||||||
|
*/
|
||||||
|
int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the stream trailer to an output media file and free the
|
* Write the stream trailer to an output media file and free the
|
||||||
* file private data.
|
* file private data.
|
||||||
|
@ -1999,6 +2302,7 @@ void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
|
||||||
*
|
*
|
||||||
* @param tags list of supported codec_id-codec_tag pairs, as stored
|
* @param tags list of supported codec_id-codec_tag pairs, as stored
|
||||||
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
||||||
|
* @param tag codec tag to match to a codec ID
|
||||||
*/
|
*/
|
||||||
enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
|
enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
|
||||||
|
|
||||||
|
@ -2008,6 +2312,7 @@ enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned i
|
||||||
*
|
*
|
||||||
* @param tags list of supported codec_id-codec_tag pairs, as stored
|
* @param tags list of supported codec_id-codec_tag pairs, as stored
|
||||||
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
||||||
|
* @param id codec ID to match to a codec tag
|
||||||
*/
|
*/
|
||||||
unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id);
|
unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id);
|
||||||
|
|
||||||
|
@ -2027,6 +2332,9 @@ int av_find_default_stream_index(AVFormatContext *s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the index for a specific timestamp.
|
* Get the index for a specific timestamp.
|
||||||
|
*
|
||||||
|
* @param st stream that the timestamp belongs to
|
||||||
|
* @param timestamp timestamp to retrieve the index for
|
||||||
* @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
|
* @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
|
||||||
* to the timestamp which is <= the requested one, if backward
|
* to the timestamp which is <= the requested one, if backward
|
||||||
* is 0, then it will be >=
|
* is 0, then it will be >=
|
||||||
|
@ -2123,6 +2431,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
|
||||||
* Return a positive value if the given filename has one of the given
|
* Return a positive value if the given filename has one of the given
|
||||||
* extensions, 0 otherwise.
|
* extensions, 0 otherwise.
|
||||||
*
|
*
|
||||||
|
* @param filename file name to check against the given extensions
|
||||||
* @param extensions a comma-separated list of filename extensions
|
* @param extensions a comma-separated list of filename extensions
|
||||||
*/
|
*/
|
||||||
int av_match_ext(const char *filename, const char *extensions);
|
int av_match_ext(const char *filename, const char *extensions);
|
||||||
|
@ -2130,6 +2439,8 @@ int av_match_ext(const char *filename, const char *extensions);
|
||||||
/**
|
/**
|
||||||
* Test if the given container can store a codec.
|
* Test if the given container can store a codec.
|
||||||
*
|
*
|
||||||
|
* @param ofmt container to check for compatibility
|
||||||
|
* @param codec_id codec to potentially store in container
|
||||||
* @param std_compliance standards compliance level, one of FF_COMPLIANCE_*
|
* @param std_compliance standards compliance level, one of FF_COMPLIANCE_*
|
||||||
*
|
*
|
||||||
* @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot.
|
* @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot.
|
||||||
|
@ -2157,6 +2468,14 @@ const struct AVCodecTag *avformat_get_riff_video_tags(void);
|
||||||
* @return the table mapping RIFF FourCCs for audio to AVCodecID.
|
* @return the table mapping RIFF FourCCs for audio to AVCodecID.
|
||||||
*/
|
*/
|
||||||
const struct AVCodecTag *avformat_get_riff_audio_tags(void);
|
const struct AVCodecTag *avformat_get_riff_audio_tags(void);
|
||||||
|
/**
|
||||||
|
* @return the table mapping MOV FourCCs for video to libavcodec AVCodecID.
|
||||||
|
*/
|
||||||
|
const struct AVCodecTag *avformat_get_mov_video_tags(void);
|
||||||
|
/**
|
||||||
|
* @return the table mapping MOV FourCCs for audio to AVCodecID.
|
||||||
|
*/
|
||||||
|
const struct AVCodecTag *avformat_get_mov_audio_tags(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include "libavutil/avstring.h"
|
#include "libavutil/avstring.h"
|
||||||
#include "libavutil/bswap.h"
|
#include "libavutil/bswap.h"
|
||||||
|
@ -111,8 +113,8 @@ static int avi_load_index(AVFormatContext *s);
|
||||||
static int guess_ni_flag(AVFormatContext *s);
|
static int guess_ni_flag(AVFormatContext *s);
|
||||||
|
|
||||||
#define print_tag(str, tag, size) \
|
#define print_tag(str, tag, size) \
|
||||||
av_dlog(NULL, "%s: tag=%c%c%c%c size=0x%x\n", \
|
av_dlog(NULL, "pos:%"PRIX64" %s: tag=%c%c%c%c size=0x%x\n", \
|
||||||
str, tag & 0xff, \
|
avio_tell(pb), str, tag & 0xff, \
|
||||||
(tag >> 8) & 0xff, \
|
(tag >> 8) & 0xff, \
|
||||||
(tag >> 16) & 0xff, \
|
(tag >> 16) & 0xff, \
|
||||||
(tag >> 24) & 0xff, \
|
(tag >> 24) & 0xff, \
|
||||||
|
@ -135,10 +137,10 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* check RIFF header */
|
/* check RIFF header */
|
||||||
avio_read(pb, (unsigned char *)header, 4);
|
avio_read(pb, header, 4);
|
||||||
avi->riff_end = avio_rl32(pb); /* RIFF chunk size */
|
avi->riff_end = avio_rl32(pb); /* RIFF chunk size */
|
||||||
avi->riff_end += avio_tell(pb); /* RIFF chunk end */
|
avi->riff_end += avio_tell(pb); /* RIFF chunk end */
|
||||||
avio_read(pb, (unsigned char *)header + 4, 4);
|
avio_read(pb, header + 4, 4);
|
||||||
|
|
||||||
for (i = 0; avi_headers[i][0]; i++)
|
for (i = 0; avi_headers[i][0]; i++)
|
||||||
if (!memcmp(header, avi_headers[i], 8))
|
if (!memcmp(header, avi_headers[i], 8))
|
||||||
|
@ -303,7 +305,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag,
|
||||||
value = av_malloc(size + 1);
|
value = av_malloc(size + 1);
|
||||||
if (!value)
|
if (!value)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
avio_read(pb, (unsigned char *)value, size);
|
avio_read(pb, value, size);
|
||||||
value[size] = 0;
|
value[size] = 0;
|
||||||
|
|
||||||
AV_WL32(key, tag);
|
AV_WL32(key, tag);
|
||||||
|
@ -348,7 +350,8 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
|
||||||
uint16_t size = avio_rl16(s->pb);
|
uint16_t size = avio_rl16(s->pb);
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
char buffer[64] = { 0 };
|
char buffer[64] = { 0 };
|
||||||
size -= avio_read(s->pb, (unsigned char *)buffer,
|
size = FFMIN(size, tag_end - avio_tell(s->pb));
|
||||||
|
size -= avio_read(s->pb, buffer,
|
||||||
FFMIN(size, sizeof(buffer) - 1));
|
FFMIN(size, sizeof(buffer) - 1));
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 0x03:
|
case 0x03:
|
||||||
|
@ -444,7 +447,7 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
size += (size & 1);
|
size += (size & 1);
|
||||||
size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1));
|
size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1));
|
||||||
avio_skip(pb, size);
|
avio_skip(pb, size);
|
||||||
avi_metadata_creation_time(&s->metadata, (char *)date);
|
avi_metadata_creation_time(&s->metadata, date);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MKTAG('d', 'm', 'l', 'h'):
|
case MKTAG('d', 'm', 'l', 'h'):
|
||||||
|
@ -522,7 +525,8 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
avi->dv_demux = avpriv_dv_init_demux(s);
|
avi->dv_demux = avpriv_dv_init_demux(s);
|
||||||
if (!avi->dv_demux)
|
if (!avi->dv_demux)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
} else
|
||||||
|
goto fail;
|
||||||
s->streams[0]->priv_data = ast;
|
s->streams[0]->priv_data = ast;
|
||||||
avio_skip(pb, 3 * 4);
|
avio_skip(pb, 3 * 4);
|
||||||
ast->scale = avio_rl32(pb);
|
ast->scale = avio_rl32(pb);
|
||||||
|
@ -622,6 +626,10 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
if (cur_pos < list_end)
|
if (cur_pos < list_end)
|
||||||
size = FFMIN(size, list_end - cur_pos);
|
size = FFMIN(size, list_end - cur_pos);
|
||||||
st = s->streams[stream_index];
|
st = s->streams[stream_index];
|
||||||
|
if (st->codec->codec_type != AVMEDIA_TYPE_UNKNOWN) {
|
||||||
|
avio_skip(pb, size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (codec_type) {
|
switch (codec_type) {
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
if (amv_file_format) {
|
if (amv_file_format) {
|
||||||
|
@ -647,15 +655,8 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
st->codec->extradata_size = esize - 10 * 4;
|
st->codec->extradata_size = esize - 10 * 4;
|
||||||
} else
|
} else
|
||||||
st->codec->extradata_size = size - 10 * 4;
|
st->codec->extradata_size = size - 10 * 4;
|
||||||
st->codec->extradata = av_malloc(st->codec->extradata_size +
|
if (ff_get_extradata(st->codec, pb, st->codec->extradata_size) < 0)
|
||||||
FF_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
if (!st->codec->extradata) {
|
|
||||||
st->codec->extradata_size = 0;
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
avio_read(pb,
|
|
||||||
st->codec->extradata,
|
|
||||||
st->codec->extradata_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: check if the encoder really did this correctly
|
// FIXME: check if the encoder really did this correctly
|
||||||
|
@ -688,6 +689,8 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
/* This is needed to get the pict type which is necessary
|
/* This is needed to get the pict type which is necessary
|
||||||
* for generating correct pts. */
|
* for generating correct pts. */
|
||||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
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 &&
|
if (st->codec->codec_tag == 0 && st->codec->height > 0 &&
|
||||||
st->codec->extradata_size < 1U << 30) {
|
st->codec->extradata_size < 1U << 30) {
|
||||||
|
@ -747,9 +750,9 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
av_log(s, AV_LOG_DEBUG, "overriding invalid dshow_block_align of %d\n", 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;
|
ast->dshow_block_align = 0;
|
||||||
}
|
}
|
||||||
if ((st->codec->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 1024 && ast->sample_size == 1024) ||
|
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_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)) {
|
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");
|
av_log(s, AV_LOG_DEBUG, "overriding sample_size\n");
|
||||||
ast->sample_size = 0;
|
ast->sample_size = 0;
|
||||||
}
|
}
|
||||||
|
@ -780,13 +783,8 @@ static int avi_read_header(AVFormatContext *s)
|
||||||
st = s->streams[stream_index];
|
st = s->streams[stream_index];
|
||||||
|
|
||||||
if (size<(1<<30)) {
|
if (size<(1<<30)) {
|
||||||
st->codec->extradata_size= size;
|
if (ff_get_extradata(st->codec, pb, size) < 0)
|
||||||
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);
|
return AVERROR(ENOMEM);
|
||||||
}
|
|
||||||
avio_read(pb, st->codec->extradata, st->codec->extradata_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
|
if (st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
|
||||||
|
@ -906,12 +904,14 @@ fail:
|
||||||
static int read_gab2_sub(AVStream *st, AVPacket *pkt)
|
static int read_gab2_sub(AVStream *st, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
if (pkt->size >= 7 &&
|
if (pkt->size >= 7 &&
|
||||||
!strcmp((char *)pkt->data, "GAB2") && AV_RL16(pkt->data + 5) == 2) {
|
pkt->size < INT_MAX - AVPROBE_PADDING_SIZE &&
|
||||||
|
!strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data + 5) == 2) {
|
||||||
uint8_t desc[256];
|
uint8_t desc[256];
|
||||||
int score = AVPROBE_SCORE_EXTENSION, ret;
|
int score = AVPROBE_SCORE_EXTENSION, ret;
|
||||||
AVIStream *ast = st->priv_data;
|
AVIStream *ast = st->priv_data;
|
||||||
AVInputFormat *sub_demuxer;
|
AVInputFormat *sub_demuxer;
|
||||||
AVRational time_base;
|
AVRational time_base;
|
||||||
|
int size;
|
||||||
AVIOContext *pb = avio_alloc_context(pkt->data + 7,
|
AVIOContext *pb = avio_alloc_context(pkt->data + 7,
|
||||||
pkt->size - 7,
|
pkt->size - 7,
|
||||||
0, NULL, NULL, NULL, NULL);
|
0, NULL, NULL, NULL, NULL);
|
||||||
|
@ -921,17 +921,23 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt)
|
||||||
if (desc_len > pb->buf_end - pb->buf_ptr)
|
if (desc_len > pb->buf_end - pb->buf_ptr)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ret = avio_get_str16le(pb, desc_len, (char *)desc, sizeof(desc));
|
ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc));
|
||||||
avio_skip(pb, desc_len - ret);
|
avio_skip(pb, desc_len - ret);
|
||||||
if (*desc)
|
if (*desc)
|
||||||
av_dict_set(&st->metadata, "title", (const char *)desc, 0);
|
av_dict_set(&st->metadata, "title", desc, 0);
|
||||||
|
|
||||||
avio_rl16(pb); /* flags? */
|
avio_rl16(pb); /* flags? */
|
||||||
avio_rl32(pb); /* data size */
|
avio_rl32(pb); /* data size */
|
||||||
|
|
||||||
pd = (AVProbeData) { .buf = pb->buf_ptr,
|
size = pb->buf_end - pb->buf_ptr;
|
||||||
.buf_size = pb->buf_end - pb->buf_ptr };
|
pd = (AVProbeData) { .buf = av_mallocz(size + AVPROBE_PADDING_SIZE),
|
||||||
if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score)))
|
.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;
|
goto error;
|
||||||
|
|
||||||
if (!(ast->sub_ctx = avformat_alloc_context()))
|
if (!(ast->sub_ctx = avformat_alloc_context()))
|
||||||
|
@ -1044,7 +1050,7 @@ start_sync:
|
||||||
goto start_sync;
|
goto start_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = get_stream_idx(d);
|
n = avi->dv_demux ? 0 : get_stream_idx(d);
|
||||||
|
|
||||||
if (!((i - avi->last_pkt_pos) & 1) &&
|
if (!((i - avi->last_pkt_pos) & 1) &&
|
||||||
get_stream_idx(d + 1) < s->nb_streams)
|
get_stream_idx(d + 1) < s->nb_streams)
|
||||||
|
@ -1161,6 +1167,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
int size = avpriv_dv_get_packet(avi->dv_demux, pkt);
|
int size = avpriv_dv_get_packet(avi->dv_demux, pkt);
|
||||||
if (size >= 0)
|
if (size >= 0)
|
||||||
return size;
|
return size;
|
||||||
|
else
|
||||||
|
goto resync;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avi->non_interleaved) {
|
if (avi->non_interleaved) {
|
||||||
|
@ -1311,10 +1319,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
size);
|
size);
|
||||||
pkt->stream_index = avi->stream_index;
|
pkt->stream_index = avi->stream_index;
|
||||||
|
|
||||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->index_entries) {
|
||||||
AVIndexEntry *e;
|
AVIndexEntry *e;
|
||||||
int index;
|
int index;
|
||||||
av_assert0(st->index_entries);
|
|
||||||
|
|
||||||
index = av_index_search_timestamp(st, ast->frame_offset, 0);
|
index = av_index_search_timestamp(st, ast->frame_offset, 0);
|
||||||
e = &st->index_entries[index];
|
e = &st->index_entries[index];
|
||||||
|
@ -1584,6 +1591,12 @@ static int avi_read_seek(AVFormatContext *s, int stream_index,
|
||||||
int64_t pos, pos_min;
|
int64_t pos, pos_min;
|
||||||
AVIStream *ast;
|
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) {
|
if (!avi->index_loaded) {
|
||||||
/* we only load the index on demand */
|
/* we only load the index on demand */
|
||||||
avi_load_index(s);
|
avi_load_index(s);
|
||||||
|
@ -1616,7 +1629,6 @@ static int avi_read_seek(AVFormatContext *s, int stream_index,
|
||||||
/* One and only one real stream for DV in AVI, and it has video */
|
/* One and only one real stream for DV in AVI, and it has video */
|
||||||
/* offsets. Calling with other stream indexes should have failed */
|
/* offsets. Calling with other stream indexes should have failed */
|
||||||
/* the av_index_search_timestamp call above. */
|
/* the av_index_search_timestamp call above. */
|
||||||
av_assert0(stream_index == 0);
|
|
||||||
|
|
||||||
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -42,8 +42,10 @@ URLProtocol *ffurl_protocol_next(URLProtocol *prev)
|
||||||
static const char *urlcontext_to_name(void *ptr)
|
static const char *urlcontext_to_name(void *ptr)
|
||||||
{
|
{
|
||||||
URLContext *h = (URLContext *)ptr;
|
URLContext *h = (URLContext *)ptr;
|
||||||
if(h->prot) return h->prot->name;
|
if (h->prot)
|
||||||
else return "NULL";
|
return h->prot->name;
|
||||||
|
else
|
||||||
|
return "NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *urlcontext_child_next(void *obj, void *prev)
|
static void *urlcontext_child_next(void *obj, void *prev)
|
||||||
|
@ -64,53 +66,48 @@ static const AVClass *urlcontext_child_class_next(const AVClass *prev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* find next protocol with priv options */
|
/* find next protocol with priv options */
|
||||||
while ((p = ffurl_protocol_next(p)))
|
while (p = ffurl_protocol_next(p))
|
||||||
if (p->priv_data_class)
|
if (p->priv_data_class)
|
||||||
return p->priv_data_class;
|
return p->priv_data_class;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const AVOption options[] = {{NULL}};
|
static const AVOption options[] = { { NULL } };
|
||||||
const AVClass ffurl_context_class = {
|
const AVClass ffurl_context_class = {
|
||||||
.class_name = "URLContext",
|
.class_name = "URLContext",
|
||||||
.item_name = urlcontext_to_name,
|
.item_name = urlcontext_to_name,
|
||||||
.option = options,
|
.option = options,
|
||||||
.version = LIBAVUTIL_VERSION_INT,
|
.version = LIBAVUTIL_VERSION_INT,
|
||||||
.child_next = urlcontext_child_next,
|
.child_next = urlcontext_child_next,
|
||||||
.child_class_next = urlcontext_child_class_next,
|
.child_class_next = urlcontext_child_class_next,
|
||||||
};
|
};
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
const char *avio_enum_protocols(void **opaque, int output)
|
const char *avio_enum_protocols(void **opaque, int output)
|
||||||
{
|
{
|
||||||
URLProtocol *p;
|
URLProtocol *p;
|
||||||
*opaque = ffurl_protocol_next(*opaque);
|
*opaque = ffurl_protocol_next(*opaque);
|
||||||
if (!(p = *opaque)) return NULL;
|
if (!(p = *opaque))
|
||||||
|
return NULL;
|
||||||
if ((output && p->url_write) || (!output && p->url_read))
|
if ((output && p->url_write) || (!output && p->url_read))
|
||||||
return p->name;
|
return p->name;
|
||||||
return avio_enum_protocols(opaque, output);
|
return avio_enum_protocols(opaque, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffurl_register_protocol(URLProtocol *protocol, int size)
|
int ffurl_register_protocol(URLProtocol *protocol)
|
||||||
{
|
{
|
||||||
URLProtocol **p;
|
URLProtocol **p;
|
||||||
if (size < sizeof(URLProtocol)) {
|
|
||||||
URLProtocol* temp = av_mallocz(sizeof(URLProtocol));
|
|
||||||
memcpy(temp, protocol, size);
|
|
||||||
protocol = temp;
|
|
||||||
}
|
|
||||||
p = &first_protocol;
|
p = &first_protocol;
|
||||||
while (*p != NULL) p = &(*p)->next;
|
while (*p != NULL)
|
||||||
*p = protocol;
|
p = &(*p)->next;
|
||||||
|
*p = protocol;
|
||||||
protocol->next = NULL;
|
protocol->next = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up,
|
||||||
const char *filename, int flags,
|
const char *filename, int flags,
|
||||||
const AVIOInterruptCB *int_cb)
|
const AVIOInterruptCB *int_cb)
|
||||||
{
|
{
|
||||||
URLContext *uc;
|
URLContext *uc;
|
||||||
int err;
|
int err;
|
||||||
|
@ -135,18 +132,22 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
uc->av_class = &ffurl_context_class;
|
uc->av_class = &ffurl_context_class;
|
||||||
uc->filename = (char *) &uc[1];
|
uc->filename = (char *)&uc[1];
|
||||||
strcpy(uc->filename, filename);
|
strcpy(uc->filename, filename);
|
||||||
uc->prot = up;
|
uc->prot = up;
|
||||||
uc->flags = flags;
|
uc->flags = flags;
|
||||||
uc->is_streamed = 0; /* default = not streamed */
|
uc->is_streamed = 0; /* default = not streamed */
|
||||||
uc->max_packet_size = 0; /* default: stream file */
|
uc->max_packet_size = 0; /* default: stream file */
|
||||||
if (up->priv_data_size) {
|
if (up->priv_data_size) {
|
||||||
uc->priv_data = av_mallocz(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) {
|
if (up->priv_data_class) {
|
||||||
int proto_len= strlen(up->name);
|
int proto_len= strlen(up->name);
|
||||||
char *start = strchr(uc->filename, ',');
|
char *start = strchr(uc->filename, ',');
|
||||||
*(const AVClass**)uc->priv_data = up->priv_data_class;
|
*(const AVClass **)uc->priv_data = up->priv_data_class;
|
||||||
av_opt_set_defaults(uc->priv_data);
|
av_opt_set_defaults(uc->priv_data);
|
||||||
if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){
|
if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){
|
||||||
int ret= 0;
|
int ret= 0;
|
||||||
|
@ -178,8 +179,11 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||||
|
|
||||||
*puc = uc;
|
*puc = uc;
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
*puc = NULL;
|
*puc = NULL;
|
||||||
|
if (uc)
|
||||||
|
av_freep(&uc->priv_data);
|
||||||
|
av_freep(&uc);
|
||||||
#if CONFIG_NETWORK
|
#if CONFIG_NETWORK
|
||||||
if (up->flags & URL_PROTOCOL_FLAG_NETWORK)
|
if (up->flags & URL_PROTOCOL_FLAG_NETWORK)
|
||||||
ff_network_close();
|
ff_network_close();
|
||||||
|
@ -187,19 +191,22 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffurl_connect(URLContext* uc, AVDictionary **options)
|
int ffurl_connect(URLContext *uc, AVDictionary **options)
|
||||||
{
|
{
|
||||||
int err =
|
int err =
|
||||||
uc->prot->url_open2 ? uc->prot->url_open2(uc, uc->filename, uc->flags, options) :
|
uc->prot->url_open2 ? uc->prot->url_open2(uc,
|
||||||
|
uc->filename,
|
||||||
|
uc->flags,
|
||||||
|
options) :
|
||||||
uc->prot->url_open(uc, uc->filename, uc->flags);
|
uc->prot->url_open(uc, uc->filename, uc->flags);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
uc->is_connected = 1;
|
uc->is_connected = 1;
|
||||||
//We must be careful here as ffurl_seek() could be slow, for example for http
|
/* We must be careful here as ffurl_seek() could be slow,
|
||||||
if( (uc->flags & AVIO_FLAG_WRITE)
|
* for example for http */
|
||||||
|| !strcmp(uc->prot->name, "file"))
|
if ((uc->flags & AVIO_FLAG_WRITE) || !strcmp(uc->prot->name, "file"))
|
||||||
if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
|
if (!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
|
||||||
uc->is_streamed= 1;
|
uc->is_streamed = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,24 +215,19 @@ int ffurl_connect(URLContext* uc, AVDictionary **options)
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||||
"0123456789+-."
|
"0123456789+-."
|
||||||
|
|
||||||
int ffurl_alloc(URLContext **puc, const char *filename, int flags,
|
static struct URLProtocol *url_find_protocol(const char *filename)
|
||||||
const AVIOInterruptCB *int_cb)
|
|
||||||
{
|
{
|
||||||
URLProtocol *up = NULL;
|
URLProtocol *up = NULL;
|
||||||
char proto_str[128], proto_nested[128], *ptr;
|
char proto_str[128], proto_nested[128], *ptr;
|
||||||
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
|
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
|
||||||
|
|
||||||
if (!first_protocol) {
|
if (filename[proto_len] != ':' &&
|
||||||
av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. "
|
(filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) ||
|
||||||
"Missing call to av_register_all()?\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((filename[proto_len] != ':' &&
|
|
||||||
(filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':'))) ||
|
|
||||||
is_dos_path(filename))
|
is_dos_path(filename))
|
||||||
strcpy(proto_str, "file");
|
strcpy(proto_str, "file");
|
||||||
else
|
else
|
||||||
av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
|
av_strlcpy(proto_str, filename,
|
||||||
|
FFMIN(proto_len + 1, sizeof(proto_str)));
|
||||||
|
|
||||||
if ((ptr = strchr(proto_str, ',')))
|
if ((ptr = strchr(proto_str, ',')))
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
@ -233,15 +235,33 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
|
||||||
if ((ptr = strchr(proto_nested, '+')))
|
if ((ptr = strchr(proto_nested, '+')))
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
|
||||||
while ((up = ffurl_protocol_next(up))) {
|
while (up = ffurl_protocol_next(up)) {
|
||||||
if (!strcmp(proto_str, up->name))
|
if (!strcmp(proto_str, up->name))
|
||||||
return url_alloc_for_protocol (puc, up, filename, flags, int_cb);
|
break;
|
||||||
if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&
|
if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME &&
|
||||||
!strcmp(proto_nested, up->name))
|
!strcmp(proto_nested, up->name))
|
||||||
return url_alloc_for_protocol (puc, up, filename, flags, int_cb);
|
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;
|
*puc = NULL;
|
||||||
if (!strcmp("https", proto_str))
|
if (av_strstart("https:", filename, NULL))
|
||||||
av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile with openssl or gnutls enabled.\n");
|
av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile with openssl or gnutls enabled.\n");
|
||||||
return AVERROR_PROTOCOL_NOT_FOUND;
|
return AVERROR_PROTOCOL_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +270,7 @@ int ffurl_open(URLContext **puc, const char *filename, int flags,
|
||||||
const AVIOInterruptCB *int_cb, AVDictionary **options)
|
const AVIOInterruptCB *int_cb, AVDictionary **options)
|
||||||
{
|
{
|
||||||
int ret = ffurl_alloc(puc, filename, flags, int_cb);
|
int ret = ffurl_alloc(puc, filename, flags, int_cb);
|
||||||
if (ret)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (options && (*puc)->prot->priv_data_class &&
|
if (options && (*puc)->prot->priv_data_class &&
|
||||||
(ret = av_opt_set_dict((*puc)->priv_data, options)) < 0)
|
(ret = av_opt_set_dict((*puc)->priv_data, options)) < 0)
|
||||||
|
@ -264,8 +284,11 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min,
|
static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
|
||||||
int (*transfer_func)(URLContext *h, unsigned char *buf, int size))
|
int size, int size_min,
|
||||||
|
int (*transfer_func)(URLContext *h,
|
||||||
|
uint8_t *buf,
|
||||||
|
int size))
|
||||||
{
|
{
|
||||||
int ret, len;
|
int ret, len;
|
||||||
int fast_retries = 5;
|
int fast_retries = 5;
|
||||||
|
@ -275,7 +298,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
|
||||||
while (len < size_min) {
|
while (len < size_min) {
|
||||||
if (ff_check_interrupt(&h->interrupt_callback))
|
if (ff_check_interrupt(&h->interrupt_callback))
|
||||||
return AVERROR_EXIT;
|
return AVERROR_EXIT;
|
||||||
ret = transfer_func(h, buf+len, size-len);
|
ret = transfer_func(h, buf + len, size - len);
|
||||||
if (ret == AVERROR(EINTR))
|
if (ret == AVERROR(EINTR))
|
||||||
continue;
|
continue;
|
||||||
if (h->flags & AVIO_FLAG_NONBLOCK)
|
if (h->flags & AVIO_FLAG_NONBLOCK)
|
||||||
|
@ -296,7 +319,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
|
||||||
} else if (ret < 1)
|
} else if (ret < 1)
|
||||||
return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
|
return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
|
||||||
if (ret)
|
if (ret)
|
||||||
fast_retries = FFMAX(fast_retries, 2);
|
fast_retries = FFMAX(fast_retries, 2);
|
||||||
len += ret;
|
len += ret;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
|
@ -341,7 +364,8 @@ int ffurl_closep(URLContext **hh)
|
||||||
{
|
{
|
||||||
URLContext *h= *hh;
|
URLContext *h= *hh;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (!h) return 0; /* can happen when ffurl_open fails */
|
if (!h)
|
||||||
|
return 0; /* can happen when ffurl_open fails */
|
||||||
|
|
||||||
if (h->is_connected && h->prot->url_close)
|
if (h->is_connected && h->prot->url_close)
|
||||||
ret = h->prot->url_close(h);
|
ret = h->prot->url_close(h);
|
||||||
|
@ -364,11 +388,18 @@ int ffurl_close(URLContext *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)
|
int avio_check(const char *url, int flags)
|
||||||
{
|
{
|
||||||
URLContext *h;
|
URLContext *h;
|
||||||
int ret = ffurl_alloc(&h, url, flags, NULL);
|
int ret = ffurl_alloc(&h, url, flags, NULL);
|
||||||
if (ret)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (h->prot->url_check) {
|
if (h->prot->url_check) {
|
||||||
|
@ -387,8 +418,8 @@ int64_t ffurl_size(URLContext *h)
|
||||||
{
|
{
|
||||||
int64_t pos, size;
|
int64_t pos, size;
|
||||||
|
|
||||||
size= ffurl_seek(h, 0, AVSEEK_SIZE);
|
size = ffurl_seek(h, 0, AVSEEK_SIZE);
|
||||||
if(size<0){
|
if (size < 0) {
|
||||||
pos = ffurl_seek(h, 0, SEEK_CUR);
|
pos = ffurl_seek(h, 0, SEEK_CUR);
|
||||||
if ((size = ffurl_seek(h, -1, SEEK_END)) < 0)
|
if ((size = ffurl_seek(h, -1, SEEK_END)) < 0)
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -156,6 +156,15 @@ typedef struct AVIOContext {
|
||||||
|
|
||||||
/* unbuffered I/O */
|
/* unbuffered I/O */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the protocol that will handle the passed URL.
|
||||||
|
*
|
||||||
|
* NULL is returned if no protocol could be found for the given URL.
|
||||||
|
*
|
||||||
|
* @return Name of the protocol or NULL.
|
||||||
|
*/
|
||||||
|
const char *avio_find_protocol_name(const char *url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
||||||
* of the resource in url, or a negative value corresponding to an
|
* of the resource in url, or a negative value corresponding to an
|
||||||
|
@ -372,9 +381,10 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||||
*
|
*
|
||||||
* @param s Used to return the pointer to the created AVIOContext.
|
* @param s Used to return the pointer to the created AVIOContext.
|
||||||
* In case of failure the pointed to value is set to NULL.
|
* In case of failure the pointed to value is set to NULL.
|
||||||
|
* @param url resource to access
|
||||||
* @param flags flags which control how the resource indicated by url
|
* @param flags flags which control how the resource indicated by url
|
||||||
* is to be opened
|
* is to be opened
|
||||||
* @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 in case of failure
|
* AVERROR code in case of failure
|
||||||
*/
|
*/
|
||||||
int avio_open(AVIOContext **s, const char *url, int flags);
|
int avio_open(AVIOContext **s, const char *url, int flags);
|
||||||
|
@ -387,13 +397,14 @@ int avio_open(AVIOContext **s, const char *url, int flags);
|
||||||
*
|
*
|
||||||
* @param s Used to return the pointer to the created AVIOContext.
|
* @param s Used to return the pointer to the created AVIOContext.
|
||||||
* In case of failure the pointed to value is set to NULL.
|
* In case of failure the pointed to value is set to NULL.
|
||||||
|
* @param url resource to access
|
||||||
* @param flags flags which control how the resource indicated by url
|
* @param flags flags which control how the resource indicated by url
|
||||||
* is to be opened
|
* is to be opened
|
||||||
* @param int_cb an interrupt callback to be used at the protocols level
|
* @param int_cb an interrupt callback to be used at the protocols level
|
||||||
* @param options A dictionary filled with protocol-private options. On return
|
* @param options A dictionary filled with protocol-private options. On return
|
||||||
* this parameter will be destroyed and replaced with a dict containing options
|
* this parameter will be destroyed and replaced with a dict containing options
|
||||||
* that were not found. May be NULL.
|
* that were not found. May be NULL.
|
||||||
* @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 in case of failure
|
* AVERROR code in case of failure
|
||||||
*/
|
*/
|
||||||
int avio_open2(AVIOContext **s, const char *url, int flags,
|
int avio_open2(AVIOContext **s, const char *url, int flags,
|
||||||
|
@ -460,6 +471,8 @@ const char *avio_enum_protocols(void **opaque, int output);
|
||||||
/**
|
/**
|
||||||
* Pause and resume playing - only meaningful if using a network streaming
|
* Pause and resume playing - only meaningful if using a network streaming
|
||||||
* protocol (e.g. MMS).
|
* protocol (e.g. MMS).
|
||||||
|
*
|
||||||
|
* @param h IO context from which to call the read_pause function pointer
|
||||||
* @param pause 1 for pause, 0 for resume
|
* @param pause 1 for pause, 0 for resume
|
||||||
*/
|
*/
|
||||||
int avio_pause(AVIOContext *h, int pause);
|
int avio_pause(AVIOContext *h, int pause);
|
||||||
|
@ -467,6 +480,8 @@ int avio_pause(AVIOContext *h, int pause);
|
||||||
/**
|
/**
|
||||||
* Seek to a given timestamp relative to some component stream.
|
* Seek to a given timestamp relative to some component stream.
|
||||||
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
||||||
|
*
|
||||||
|
* @param h IO context from which to call the seek function pointers
|
||||||
* @param stream_index The stream index that the timestamp is relative to.
|
* @param stream_index The stream index that the timestamp is relative to.
|
||||||
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
||||||
* units from the beginning of the presentation.
|
* units from the beginning of the presentation.
|
||||||
|
|
|
@ -201,12 +201,14 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||||
int64_t offset1;
|
int64_t offset1;
|
||||||
int64_t pos;
|
int64_t pos;
|
||||||
int force = whence & AVSEEK_FORCE;
|
int force = whence & AVSEEK_FORCE;
|
||||||
|
int buffer_size;
|
||||||
whence &= ~AVSEEK_FORCE;
|
whence &= ~AVSEEK_FORCE;
|
||||||
|
|
||||||
if(!s)
|
if(!s)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
|
buffer_size = s->buf_end - s->buffer;
|
||||||
|
pos = s->pos - (s->write_flag ? 0 : buffer_size);
|
||||||
|
|
||||||
if (whence != SEEK_CUR && whence != SEEK_SET)
|
if (whence != SEEK_CUR && whence != SEEK_SET)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
@ -219,7 +221,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||||
}
|
}
|
||||||
offset1 = offset - pos;
|
offset1 = offset - pos;
|
||||||
if (!s->must_flush && (!s->direct || !s->seek) &&
|
if (!s->must_flush && (!s->direct || !s->seek) &&
|
||||||
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
|
offset1 >= 0 && offset1 <= buffer_size) {
|
||||||
/* can do the seek inside the buffer */
|
/* can do the seek inside the buffer */
|
||||||
s->buf_ptr = s->buffer + offset1;
|
s->buf_ptr = s->buffer + offset1;
|
||||||
} else if ((!s->seekable ||
|
} else if ((!s->seekable ||
|
||||||
|
@ -232,9 +234,20 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
|
||||||
if (s->eof_reached)
|
if (s->eof_reached)
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
s->buf_ptr = s->buf_end + offset - s->pos;
|
s->buf_ptr = s->buf_end + offset - s->pos;
|
||||||
} else {
|
} else if(!s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 && s->seek && offset > 0) {
|
||||||
int64_t res;
|
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) {
|
if (s->write_flag) {
|
||||||
flush_buffer(s);
|
flush_buffer(s);
|
||||||
s->must_flush = 1;
|
s->must_flush = 1;
|
||||||
|
@ -317,17 +330,24 @@ int avio_put_str(AVIOContext *s, const char *str)
|
||||||
|
|
||||||
int avio_put_str16le(AVIOContext *s, const char *str)
|
int avio_put_str16le(AVIOContext *s, const char *str)
|
||||||
{
|
{
|
||||||
const uint8_t *q = (const uint8_t *) str;
|
const uint8_t *q = str;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
while (*q) {
|
while (*q) {
|
||||||
uint32_t ch;
|
uint32_t ch;
|
||||||
uint16_t tmp;
|
uint16_t tmp;
|
||||||
|
|
||||||
GET_UTF8(ch, *q++, break;)
|
GET_UTF8(ch, *q++, goto invalid;)
|
||||||
PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;)
|
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);
|
avio_wl16(s, 0);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
ret += 2;
|
ret += 2;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -891,7 +911,7 @@ int avio_printf(AVIOContext *s, const char *fmt, ...)
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ret = vsnprintf(buf, sizeof(buf), fmt, ap);
|
ret = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
avio_write(s, (const unsigned char *) buf, strlen(buf));
|
avio_write(s, buf, strlen(buf));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,14 +1049,20 @@ int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
|
||||||
|
|
||||||
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
|
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
|
||||||
{
|
{
|
||||||
DynBuffer *d = s->opaque;
|
DynBuffer *d;
|
||||||
int size;
|
int size;
|
||||||
static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0};
|
static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0};
|
||||||
int padding = 0;
|
int padding = 0;
|
||||||
|
|
||||||
|
if (!s) {
|
||||||
|
*pbuffer = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
d = s->opaque;
|
||||||
|
|
||||||
/* don't attempt to pad fixed-size packet buffers */
|
/* don't attempt to pad fixed-size packet buffers */
|
||||||
if (!s->max_packet_size) {
|
if (!s->max_packet_size) {
|
||||||
avio_write(s, (const unsigned char *) padbuf, sizeof(padbuf));
|
avio_write(s, padbuf, sizeof(padbuf));
|
||||||
padding = FF_INPUT_BUFFER_PADDING_SIZE;
|
padding = FF_INPUT_BUFFER_PADDING_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "libavcodec/bytestream.h"
|
#include "libavcodec/bytestream.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "rawdec.h"
|
#include "rawdec.h"
|
||||||
|
@ -73,7 +72,7 @@ static int dts_probe(AVProbeData *p)
|
||||||
|
|
||||||
AVInputFormat ff_dts_demuxer = {
|
AVInputFormat ff_dts_demuxer = {
|
||||||
.name = "dts",
|
.name = "dts",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("raw DTS"),
|
.long_name = "raw DTS",
|
||||||
.read_probe = dts_probe,
|
.read_probe = dts_probe,
|
||||||
.read_header = ff_raw_audio_read_header,
|
.read_header = ff_raw_audio_read_header,
|
||||||
.read_packet = ff_raw_read_partial_packet,
|
.read_packet = ff_raw_read_partial_packet,
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/dict.h"
|
#include "libavutil/dict.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
|
@ -91,7 +90,7 @@ static int dtshd_read_header(AVFormatContext *s)
|
||||||
value = av_malloc(chunk_size);
|
value = av_malloc(chunk_size);
|
||||||
if (!value)
|
if (!value)
|
||||||
goto skip;
|
goto skip;
|
||||||
avio_read(pb, (unsigned char *) value, chunk_size);
|
avio_read(pb, (unsigned char *)value, chunk_size);
|
||||||
value[chunk_size - 1] = 0;
|
value[chunk_size - 1] = 0;
|
||||||
av_dict_set(&s->metadata, "fileinfo", value,
|
av_dict_set(&s->metadata, "fileinfo", value,
|
||||||
AV_DICT_DONT_STRDUP_VAL);
|
AV_DICT_DONT_STRDUP_VAL);
|
||||||
|
@ -129,7 +128,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
|
||||||
AVInputFormat ff_dtshd_demuxer = {
|
AVInputFormat ff_dtshd_demuxer = {
|
||||||
.name = "dtshd",
|
.name = "dtshd",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("raw DTS-HD"),
|
.long_name = "raw DTS-HD",
|
||||||
.priv_data_size = sizeof(DTSHDDemuxContext),
|
.priv_data_size = sizeof(DTSHDDemuxContext),
|
||||||
.read_probe = dtshd_probe,
|
.read_probe = dtshd_probe,
|
||||||
.read_header = dtshd_read_header,
|
.read_header = dtshd_read_header,
|
||||||
|
|
|
@ -354,7 +354,7 @@ static void read_comm(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||||
* Parse GEOB tag into a ID3v2ExtraMetaGEOB struct.
|
* Parse GEOB tag into a ID3v2ExtraMetaGEOB struct.
|
||||||
*/
|
*/
|
||||||
static void read_geobtag(AVFormatContext *s, AVIOContext *pb, int taglen,
|
static void read_geobtag(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||||
char *tag, ID3v2ExtraMeta **extra_meta)
|
char *tag, ID3v2ExtraMeta **extra_meta, int isv34)
|
||||||
{
|
{
|
||||||
ID3v2ExtraMetaGEOB *geob_data = NULL;
|
ID3v2ExtraMetaGEOB *geob_data = NULL;
|
||||||
ID3v2ExtraMeta *new_extra = NULL;
|
ID3v2ExtraMeta *new_extra = NULL;
|
||||||
|
@ -486,7 +486,7 @@ static void free_apic(void *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||||
char *tag, ID3v2ExtraMeta **extra_meta)
|
char *tag, ID3v2ExtraMeta **extra_meta, int isv34)
|
||||||
{
|
{
|
||||||
int enc, pic_type;
|
int enc, pic_type;
|
||||||
char mimetype[64];
|
char mimetype[64];
|
||||||
|
@ -508,7 +508,12 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||||
taglen--;
|
taglen--;
|
||||||
|
|
||||||
/* mimetype */
|
/* mimetype */
|
||||||
|
if (isv34) {
|
||||||
taglen -= avio_get_str(pb, taglen, mimetype, sizeof(mimetype));
|
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) {
|
while (mime->id != AV_CODEC_ID_NONE) {
|
||||||
if (!av_strncasecmp(mime->str, mimetype, sizeof(mimetype))) {
|
if (!av_strncasecmp(mime->str, mimetype, sizeof(mimetype))) {
|
||||||
id = mime->id;
|
id = mime->id;
|
||||||
|
@ -559,7 +564,7 @@ fail:
|
||||||
avio_seek(pb, end, SEEK_SET);
|
avio_seek(pb, end, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *ttag, ID3v2ExtraMeta **extra_meta)
|
static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *ttag, ID3v2ExtraMeta **extra_meta, int isv34)
|
||||||
{
|
{
|
||||||
AVRational time_base = {1, 1000};
|
AVRational time_base = {1, 1000};
|
||||||
uint32_t start, end;
|
uint32_t start, end;
|
||||||
|
@ -568,6 +573,14 @@ static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *tta
|
||||||
int taglen;
|
int taglen;
|
||||||
char tag[5];
|
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)
|
if (decode_str(s, pb, 0, &dst, &len) < 0)
|
||||||
return;
|
return;
|
||||||
if (len < 16)
|
if (len < 16)
|
||||||
|
@ -585,15 +598,14 @@ static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *tta
|
||||||
|
|
||||||
len -= 16;
|
len -= 16;
|
||||||
while (len > 10) {
|
while (len > 10) {
|
||||||
avio_read(pb, (unsigned char *) tag, 4);
|
if (avio_read(pb, tag, 4) < 4)
|
||||||
|
goto end;
|
||||||
tag[4] = 0;
|
tag[4] = 0;
|
||||||
taglen = avio_rb32(pb);
|
taglen = avio_rb32(pb);
|
||||||
avio_skip(pb, 2);
|
avio_skip(pb, 2);
|
||||||
len -= 10;
|
len -= 10;
|
||||||
if (taglen < 0 || taglen > len) {
|
if (taglen < 0 || taglen > len)
|
||||||
av_free(dst);
|
goto end;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (tag[0] == 'T')
|
if (tag[0] == 'T')
|
||||||
read_ttag(s, pb, taglen, &chapter->metadata, tag);
|
read_ttag(s, pb, taglen, &chapter->metadata, tag);
|
||||||
else
|
else
|
||||||
|
@ -603,14 +615,60 @@ static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *tta
|
||||||
|
|
||||||
ff_metadata_conv(&chapter->metadata, NULL, ff_id3v2_34_metadata_conv);
|
ff_metadata_conv(&chapter->metadata, NULL, ff_id3v2_34_metadata_conv);
|
||||||
ff_metadata_conv(&chapter->metadata, NULL, ff_id3v2_4_metadata_conv);
|
ff_metadata_conv(&chapter->metadata, NULL, ff_id3v2_4_metadata_conv);
|
||||||
|
end:
|
||||||
av_free(dst);
|
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 {
|
typedef struct ID3v2EMFunc {
|
||||||
const char *tag3;
|
const char *tag3;
|
||||||
const char *tag4;
|
const char *tag4;
|
||||||
void (*read)(AVFormatContext *, AVIOContext *, int, char *,
|
void (*read)(AVFormatContext *, AVIOContext *, int, char *,
|
||||||
ID3v2ExtraMeta **);
|
ID3v2ExtraMeta **, int isv34);
|
||||||
void (*free)(void *obj);
|
void (*free)(void *obj);
|
||||||
} ID3v2EMFunc;
|
} ID3v2EMFunc;
|
||||||
|
|
||||||
|
@ -618,6 +676,7 @@ static const ID3v2EMFunc id3v2_extra_meta_funcs[] = {
|
||||||
{ "GEO", "GEOB", read_geobtag, free_geobtag },
|
{ "GEO", "GEOB", read_geobtag, free_geobtag },
|
||||||
{ "PIC", "APIC", read_apic, free_apic },
|
{ "PIC", "APIC", read_apic, free_apic },
|
||||||
{ "CHAP","CHAP", read_chapter, NULL },
|
{ "CHAP","CHAP", read_chapter, NULL },
|
||||||
|
{ "PRIV","PRIV", read_priv, free_priv },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -640,16 +699,17 @@ static const ID3v2EMFunc *get_extra_meta_func(const char *tag, int isv34)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
|
||||||
|
AVFormatContext *s, int len, uint8_t version,
|
||||||
uint8_t flags, ID3v2ExtraMeta **extra_meta)
|
uint8_t flags, ID3v2ExtraMeta **extra_meta)
|
||||||
{
|
{
|
||||||
int isv34, unsync;
|
int isv34, unsync;
|
||||||
unsigned tlen;
|
unsigned tlen;
|
||||||
char tag[5];
|
char tag[5];
|
||||||
int64_t next, end = avio_tell(s->pb) + len;
|
int64_t next, end = avio_tell(pb) + len;
|
||||||
int taghdrlen;
|
int taghdrlen;
|
||||||
const char *reason = NULL;
|
const char *reason = NULL;
|
||||||
AVIOContext pb;
|
AVIOContext pb_local;
|
||||||
AVIOContext *pbx;
|
AVIOContext *pbx;
|
||||||
unsigned char *buffer = NULL;
|
unsigned char *buffer = NULL;
|
||||||
int buffer_size = 0;
|
int buffer_size = 0;
|
||||||
|
@ -683,7 +743,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
unsync = flags & 0x80;
|
unsync = flags & 0x80;
|
||||||
|
|
||||||
if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */
|
if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */
|
||||||
int extlen = get_size(s->pb, 4);
|
int extlen = get_size(pb, 4);
|
||||||
if (version == 4)
|
if (version == 4)
|
||||||
/* In v2.4 the length includes the length field we just read. */
|
/* In v2.4 the length includes the length field we just read. */
|
||||||
extlen -= 4;
|
extlen -= 4;
|
||||||
|
@ -692,7 +752,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
reason = "invalid extended header length";
|
reason = "invalid extended header length";
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
avio_skip(s->pb, extlen);
|
avio_skip(pb, extlen);
|
||||||
len -= extlen + 4;
|
len -= extlen + 4;
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
reason = "extended header too long.";
|
reason = "extended header too long.";
|
||||||
|
@ -708,18 +768,20 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
unsigned long dlen;
|
unsigned long dlen;
|
||||||
|
|
||||||
if (isv34) {
|
if (isv34) {
|
||||||
avio_read(s->pb, (unsigned char *) tag, 4);
|
if (avio_read(pb, tag, 4) < 4)
|
||||||
|
break;
|
||||||
tag[4] = 0;
|
tag[4] = 0;
|
||||||
if (version == 3) {
|
if (version == 3) {
|
||||||
tlen = avio_rb32(s->pb);
|
tlen = avio_rb32(pb);
|
||||||
} else
|
} else
|
||||||
tlen = get_size(s->pb, 4);
|
tlen = get_size(pb, 4);
|
||||||
tflags = avio_rb16(s->pb);
|
tflags = avio_rb16(pb);
|
||||||
tunsync = tflags & ID3v2_FLAG_UNSYNCH;
|
tunsync = tflags & ID3v2_FLAG_UNSYNCH;
|
||||||
} else {
|
} else {
|
||||||
avio_read(s->pb, (unsigned char *) tag, 3);
|
if (avio_read(pb, tag, 3) < 3)
|
||||||
|
break;
|
||||||
tag[3] = 0;
|
tag[3] = 0;
|
||||||
tlen = avio_rb24(s->pb);
|
tlen = avio_rb24(pb);
|
||||||
}
|
}
|
||||||
if (tlen > (1<<28))
|
if (tlen > (1<<28))
|
||||||
break;
|
break;
|
||||||
|
@ -728,7 +790,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
next = avio_tell(s->pb) + tlen;
|
next = avio_tell(pb) + tlen;
|
||||||
|
|
||||||
if (!tlen) {
|
if (!tlen) {
|
||||||
if (tag[0])
|
if (tag[0])
|
||||||
|
@ -740,7 +802,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
if (tflags & ID3v2_FLAG_DATALEN) {
|
if (tflags & ID3v2_FLAG_DATALEN) {
|
||||||
if (tlen < 4)
|
if (tlen < 4)
|
||||||
break;
|
break;
|
||||||
dlen = avio_rb32(s->pb);
|
dlen = avio_rb32(pb);
|
||||||
tlen -= 4;
|
tlen -= 4;
|
||||||
} else
|
} else
|
||||||
dlen = tlen;
|
dlen = tlen;
|
||||||
|
@ -759,38 +821,38 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
type = "encrypted and compressed";
|
type = "encrypted and compressed";
|
||||||
|
|
||||||
av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag);
|
av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag);
|
||||||
avio_skip(s->pb, tlen);
|
avio_skip(pb, tlen);
|
||||||
/* check for text tag or supported special meta tag */
|
/* check for text tag or supported special meta tag */
|
||||||
} else if (tag[0] == 'T' || memcmp(tag, "COMM", 4) == 0 ||
|
} else if (tag[0] == 'T' ||
|
||||||
(extra_meta &&
|
(extra_meta &&
|
||||||
(extra_func = get_extra_meta_func(tag, isv34)))) {
|
(extra_func = get_extra_meta_func(tag, isv34)))) {
|
||||||
pbx = s->pb;
|
pbx = pb;
|
||||||
|
|
||||||
if (unsync || tunsync || tcomp) {
|
if (unsync || tunsync || tcomp) {
|
||||||
av_fast_malloc(&buffer, (unsigned int *) &buffer_size, tlen);
|
av_fast_malloc(&buffer, &buffer_size, tlen);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen);
|
av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen);
|
||||||
goto seek;
|
goto seek;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unsync || tunsync) {
|
if (unsync || tunsync) {
|
||||||
int64_t end = avio_tell(s->pb) + tlen;
|
int64_t end = avio_tell(pb) + tlen;
|
||||||
uint8_t *b;
|
uint8_t *b;
|
||||||
|
|
||||||
b = buffer;
|
b = buffer;
|
||||||
while (avio_tell(s->pb) < end && b - buffer < tlen && !s->pb->eof_reached) {
|
while (avio_tell(pb) < end && b - buffer < tlen && !pb->eof_reached) {
|
||||||
*b++ = avio_r8(s->pb);
|
*b++ = avio_r8(pb);
|
||||||
if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1 &&
|
if (*(b - 1) == 0xff && avio_tell(pb) < end - 1 &&
|
||||||
b - buffer < tlen &&
|
b - buffer < tlen &&
|
||||||
!s->pb->eof_reached ) {
|
!pb->eof_reached ) {
|
||||||
uint8_t val = avio_r8(s->pb);
|
uint8_t val = avio_r8(pb);
|
||||||
*b++ = val ? val : avio_r8(s->pb);
|
*b++ = val ? val : avio_r8(pb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ffio_init_context(&pb, buffer, b - buffer, 0, NULL, NULL, NULL,
|
ffio_init_context(&pb_local, buffer, b - buffer, 0, NULL, NULL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
tlen = b - buffer;
|
tlen = b - buffer;
|
||||||
pbx = &pb; // read from sync buffer
|
pbx = &pb_local; // read from sync buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ZLIB
|
#if CONFIG_ZLIB
|
||||||
|
@ -806,7 +868,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(unsync || tunsync)) {
|
if (!(unsync || tunsync)) {
|
||||||
err = avio_read(s->pb, buffer, tlen);
|
err = avio_read(pb, buffer, tlen);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n");
|
av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n");
|
||||||
goto seek;
|
goto seek;
|
||||||
|
@ -819,28 +881,26 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version,
|
||||||
av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err);
|
av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err);
|
||||||
goto seek;
|
goto seek;
|
||||||
}
|
}
|
||||||
ffio_init_context(&pb, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);
|
ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);
|
||||||
tlen = dlen;
|
tlen = dlen;
|
||||||
pbx = &pb; // read from sync buffer
|
pbx = &pb_local; // read from sync buffer
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (tag[0] == 'T')
|
if (tag[0] == 'T')
|
||||||
/* parse text tag */
|
/* parse text tag */
|
||||||
read_ttag(s, pbx, tlen, &s->metadata, tag);
|
read_ttag(s, pbx, tlen, metadata, tag);
|
||||||
else if (memcmp(tag, "COMM", 4) == 0)
|
|
||||||
read_comm(s, pbx, tlen, &s->metadata);
|
|
||||||
else
|
else
|
||||||
/* parse special meta tag */
|
/* parse special meta tag */
|
||||||
extra_func->read(s, pbx, tlen, tag, extra_meta);
|
extra_func->read(s, pbx, tlen, tag, extra_meta, isv34);
|
||||||
} else if (!tag[0]) {
|
} else if (!tag[0]) {
|
||||||
if (tag[1])
|
if (tag[1])
|
||||||
av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n");
|
av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n");
|
||||||
avio_skip(s->pb, tlen);
|
avio_skip(pb, tlen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Skip to end of tag */
|
/* Skip to end of tag */
|
||||||
seek:
|
seek:
|
||||||
avio_seek(s->pb, next, SEEK_SET);
|
avio_seek(pb, next, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Footer preset, always 10 bytes, skip over it */
|
/* Footer preset, always 10 bytes, skip over it */
|
||||||
|
@ -851,14 +911,15 @@ error:
|
||||||
if (reason)
|
if (reason)
|
||||||
av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n",
|
av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n",
|
||||||
version, reason);
|
version, reason);
|
||||||
avio_seek(s->pb, end, SEEK_SET);
|
avio_seek(pb, end, SEEK_SET);
|
||||||
av_free(buffer);
|
av_free(buffer);
|
||||||
av_free(uncompressed_buffer);
|
av_free(uncompressed_buffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_id3v2_read(AVFormatContext *s, const char *magic,
|
static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
|
||||||
ID3v2ExtraMeta **extra_meta)
|
AVFormatContext *s, const char *magic,
|
||||||
|
ID3v2ExtraMeta **extra_meta)
|
||||||
{
|
{
|
||||||
int len, ret;
|
int len, ret;
|
||||||
uint8_t buf[ID3v2_HEADER_SIZE];
|
uint8_t buf[ID3v2_HEADER_SIZE];
|
||||||
|
@ -867,10 +928,10 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic,
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* save the current offset in case there's nothing to read/skip */
|
/* save the current offset in case there's nothing to read/skip */
|
||||||
off = avio_tell(s->pb);
|
off = avio_tell(pb);
|
||||||
ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
|
ret = avio_read(pb, buf, ID3v2_HEADER_SIZE);
|
||||||
if (ret != ID3v2_HEADER_SIZE) {
|
if (ret != ID3v2_HEADER_SIZE) {
|
||||||
avio_seek(s->pb, off, SEEK_SET);
|
avio_seek(pb, off, SEEK_SET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
found_header = ff_id3v2_match(buf, magic);
|
found_header = ff_id3v2_match(buf, magic);
|
||||||
|
@ -880,15 +941,27 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic,
|
||||||
((buf[7] & 0x7f) << 14) |
|
((buf[7] & 0x7f) << 14) |
|
||||||
((buf[8] & 0x7f) << 7) |
|
((buf[8] & 0x7f) << 7) |
|
||||||
(buf[9] & 0x7f);
|
(buf[9] & 0x7f);
|
||||||
id3v2_parse(s, len, buf[3], buf[5], extra_meta);
|
id3v2_parse(pb, metadata, s, len, buf[3], buf[5], extra_meta);
|
||||||
} else {
|
} else {
|
||||||
avio_seek(s->pb, off, SEEK_SET);
|
avio_seek(pb, off, SEEK_SET);
|
||||||
}
|
}
|
||||||
} while (found_header);
|
} while (found_header);
|
||||||
ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv);
|
ff_metadata_conv(metadata, NULL, ff_id3v2_34_metadata_conv);
|
||||||
ff_metadata_conv(&s->metadata, NULL, id3v2_2_metadata_conv);
|
ff_metadata_conv(metadata, NULL, id3v2_2_metadata_conv);
|
||||||
ff_metadata_conv(&s->metadata, NULL, ff_id3v2_4_metadata_conv);
|
ff_metadata_conv(metadata, NULL, ff_id3v2_4_metadata_conv);
|
||||||
merge_date(&s->metadata);
|
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)
|
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue