Skip to content

Commit

Permalink
COM-12575:
Browse files Browse the repository at this point in the history
* Include improvements in mpeg reference decoders building
* Add JSON generation from ISO-MPEG2-AAC decoder in "iso_mpeg2_aac.py" file
* Change ""result":" values of MPEG2_AAC-ADIF.json and MPEG2_AAC-ADTS.json, from reference decoder, .pcm files
  • Loading branch information
rsanchez87 committed Nov 19, 2024
1 parent a6360e9 commit d080509
Show file tree
Hide file tree
Showing 4 changed files with 566 additions and 553 deletions.
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ ifeq ($(wildcard $(CONTRIB_DIR)/C050470e_Electronic_inserts), )
cd $(CONTRIB_DIR) && unzip -oq c050470__ISO_IEC_14496-5_2001_Amd_20_2009_Reference_Software.zip
cd $(CONTRIB_DIR) && rm -f iso_cookies.txt c050470__ISO_IEC_14496-5_2001_Amd_20_2009_Reference_Software.zip

cd $(CONTRIB_DIR) && git clone https://github.com/MPEGGroup/isobmff.git
cd $(CONTRIB_DIR)/isobmff && mkdir build && cd build && cmake .. -DCMAKE_C_FLAGS=-m64 && $(MAKE) libisomediafile
cd $(CONTRIB_DIR) && [ -d isobmff ] && rm -rf isobmff && git clone https://github.com/MPEGGroup/isobmff.git
cd $(CONTRIB_DIR)/isobmff && git checkout tags/v0.2.0 -b v0.2.0
cd $(CONTRIB_DIR)/isobmff && mkdir -p build && cd build && cmake .. -DCMAKE_C_FLAGS=-m64 && $(MAKE) libisomediafile
cd $(CONTRIB_DIR)/isobmff && mv lib/liblibisomediafile.a lib/libisomediafile.a
cd $(CONTRIB_DIR) && cp isobmff/lib/libisomediafile.a C050470e_Electronic_inserts/audio/natural/import/lib/
cd $(CONTRIB_DIR) && cp isobmff/IsoLib/libisomediafile/src/ISOMovies.h C050470e_Electronic_inserts/audio/natural/import/include/
Expand All @@ -132,7 +133,7 @@ endif
cd $(CONTRIB_DIR) && rm -f libtsp-v7r0.tar.gz
cd $(CONTRIB_DIR) && cp libtsp-v7r0/lib/libtsp.a C050470e_Electronic_inserts/audio/natural/import/lib/
cd $(CONTRIB_DIR) && cp libtsp-v7r0/include/libtsp.h C050470e_Electronic_inserts/audio/natural/import/include/
cd $(CONTRIB_DIR) && mkdir C050470e_Electronic_inserts/audio/natural/import/include/libtsp/
cd $(CONTRIB_DIR) && mkdir -p C050470e_Electronic_inserts/audio/natural/import/include/libtsp/
cd $(CONTRIB_DIR) && cp libtsp-v7r0/include/libtsp/AFpar.h C050470e_Electronic_inserts/audio/natural/import/include/libtsp/
cd $(CONTRIB_DIR) && cp libtsp-v7r0/include/libtsp/UTpar.h C050470e_Electronic_inserts/audio/natural/import/include/libtsp/
endif
Expand Down Expand Up @@ -168,12 +169,12 @@ ifeq ($(wildcard $(CONTRIB_DIR)/C039486_Electronic_inserts), )
cd $(CONTRIB_DIR) && unzip -oq c039486_ISO_IEC_13818-5_2005_Reference_Software.zip
cd $(CONTRIB_DIR) && rm -f iso_cookies.txt c039486_ISO_IEC_13818-5_2005_Reference_Software.zip ipmp.zip mpeg2audio.zip systems.zip video.zip

# Unzip and setup MPEG-2 AAC decoder files
cd $(CONTRIB_DIR) && unzip -oq mpeg2aac.zip
cd $(CONTRIB_DIR) && rm -f mpeg2aac.zip

cd $(CONTRIB_DIR) && git clone https://github.com/MPEGGroup/isobmff.git
cd $(CONTRIB_DIR)/isobmff && mkdir build && cd build && cmake .. -DCMAKE_C_FLAGS=-m64 && $(MAKE) libisomediafile
cd $(CONTRIB_DIR) && [ -d isobmff ] && rm -rf isobmff && git clone https://github.com/MPEGGroup/isobmff.git
cd $(CONTRIB_DIR)/isobmff && git checkout tags/v0.2.0 -b v0.2.0
cd $(CONTRIB_DIR)/isobmff && mkdir -p build && cd build && cmake .. -DCMAKE_C_FLAGS=-m64 && $(MAKE) libisomediafile
cd $(CONTRIB_DIR)/isobmff && mv lib/liblibisomediafile.a lib/libisomediafile.a
cd $(CONTRIB_DIR) && cp isobmff/lib/libisomediafile.a mpeg2aac/import/lib/
cd $(CONTRIB_DIR) && cp isobmff/IsoLib/libisomediafile/src/ISOMovies.h mpeg2aac/import/include/
Expand All @@ -190,12 +191,10 @@ endif
cd $(CONTRIB_DIR) && rm -f libtsp-v7r0.tar.gz
cd $(CONTRIB_DIR) && cp libtsp-v7r0/lib/libtsp.a mpeg2aac/import/lib/
cd $(CONTRIB_DIR) && cp libtsp-v7r0/include/libtsp.h mpeg2aac/import/include/
cd $(CONTRIB_DIR) && mkdir mpeg2aac/import/include/libtsp/
cd $(CONTRIB_DIR) && mkdir -p mpeg2aac/import/include/libtsp/
cd $(CONTRIB_DIR) && cp libtsp-v7r0/include/libtsp/AFpar.h mpeg2aac/import/include/libtsp/
cd $(CONTRIB_DIR) && cp libtsp-v7r0/include/libtsp/UTpar.h mpeg2aac/import/include/libtsp/
endif

# Build the MPEG-2 AAC decoder
cd $(CONTRIB_DIR)/mpeg2aac/aacDec && MAKELEVEL=0 $(MAKE) aacdec_mc REFSOFT_INCLUDE_PATH=../import/include REFSOFT_LIBRARY_PATH=../import/lib CFLAGS=-m64 LDFLAGS=-m64
find $(CONTRIB_DIR)/mpeg2aac/bin/mp4mcDec -name "aacdec_mc" -type f -exec cp {} $(DECODERS_DIR) \;

Expand Down
18 changes: 16 additions & 2 deletions fluster/decoders/iso_mpeg2_aac.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
import os

from fluster.codec import Codec, OutputFormat
from fluster.decoder import Decoder, register_decoder
Expand Down Expand Up @@ -42,10 +43,23 @@ def decode(
# pylint: disable=unused-argument
# Addition of .pcm as extension is a must. If it is something else, e.g. ".out" the decoder will output a
# ".wav", which is undesirable.
output_filepath += ".wav"
output_filepath += ".pcm"
run_command(
[self.binary, "-w", input_filepath, output_filepath],
[self.binary, input_filepath, output_filepath],
timeout=timeout,
verbose=verbose,
)

base_output = output_filepath[:-4]
pcm_out_f00_file = f"{base_output}_f00.pcm"

if os.path.exists(pcm_out_f00_file):
return file_checksum(pcm_out_f00_file)

output_files = [f"{base_output}_f{str(i).zfill(2)}.pcm" for i in range(20)]

for pcm_file in output_files:
if os.path.exists(pcm_file):
return file_checksum(pcm_file)

return file_checksum(output_filepath)
Loading

0 comments on commit d080509

Please sign in to comment.