mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
* Update libavif (v1.0.0-main) * Update libavif for improved compression and speed * v1.0.0 deprecates usage of min and max-quantizers; we use `quality` and `qualityAlpha` instead * Renamed `maxSpeed` to `MAX_EFFORT` for better readability * Update libavif (v1.0.1-main) * Refactor variable names for clarity * Update libaom (v3.7.0) * Add checks for API return values * Rename variables for readability Changes `cqlevel` to `quality`, and `cqAlphaLevel` to `qualityAlpha` * Minor patches in logic * Minor patches in lossless calculation * Add chroma subsampling options to AVIF * Add skeleton for sharp downsampling param * Try to use libsharpyuv * Encoder working, decoder isnt * Make sure sharpyuv is disabled for decoder * Add AVIF_LOCAL flags for sharp yuv * Get AVIF sharp YUV working * Clean up AVIF makefiles * AVIF: Make sharpyuv conditional on subsample * AVIF: Flags to speed up sharpyuv build * AVIF: Minor refactoring in enc.cpp * AVIF: Minor refactoring & renaming * AVIF: Use smart pointers to prevent memory leaks * AVIF: Minor refactoring * AVIF: Revert defaultoptions logic change --------- Co-authored-by: Surma <surma@surma.dev> Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
86 lines
2.1 KiB
Makefile
86 lines
2.1 KiB
Makefile
# This is a helper Makefile for building LibAVIF + LibAOM with given params.
|
|
#
|
|
# Params that must be supplied by the caller:
|
|
# $(CODEC_DIR)
|
|
# $(LIBAOM_DIR)
|
|
# $(BUILD_DIR)
|
|
# $(OUT_JS)
|
|
# $(OUT_CPP)
|
|
# $(LIBAOM_FLAGS)
|
|
# $(LIBAVIF_FLAGS)
|
|
# $(ENVIRONMENT)
|
|
|
|
# $(OUT_JS) is something like "enc/avif_enc.js" or "enc/avif_enc_mt.js"
|
|
# so $(OUT_BUILD_DIR) will be "node_modules/build/enc/avif_enc[_mt]"
|
|
OUT_BUILD_DIR := $(BUILD_DIR)/$(basename $(OUT_JS))
|
|
|
|
# We're making libavif and libaom for every node_modules/[enc|dec]/
|
|
CODEC_BUILD_DIR := $(OUT_BUILD_DIR)/libavif
|
|
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
|
|
|
|
LIBAOM_BUILD_DIR := $(OUT_BUILD_DIR)/libaom
|
|
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
|
|
|
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
|
OUT_WORKER=$(OUT_JS:.js=.worker.js)
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(OUT_JS)
|
|
|
|
# Only add libsharpyuv as a dependency for encoders.
|
|
# Yes, that if statement is true for encoders.
|
|
ifneq (,$(findstring enc/, $(OUT_JS)))
|
|
$(OUT_JS): $(LIBSHARPYUV)
|
|
$(CODEC_OUT): $(LIBSHARPYUV)
|
|
endif
|
|
|
|
$(OUT_JS): $(OUT_CPP) $(LIBAOM_OUT) $(CODEC_OUT)
|
|
$(CXX) \
|
|
-I $(CODEC_DIR)/include \
|
|
$(CXXFLAGS) \
|
|
$(LDFLAGS) \
|
|
$(OUT_FLAGS) \
|
|
--bind \
|
|
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
|
|
-s ENVIRONMENT=$(ENVIRONMENT) \
|
|
-s EXPORT_ES6=1 \
|
|
-o $@ \
|
|
$+
|
|
|
|
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_OUT)
|
|
emcmake cmake \
|
|
-DCMAKE_LIBRARY_PATH=$(LIBSHARPYUV_BUILD_DIR) \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DBUILD_SHARED_LIBS=0 \
|
|
-DAVIF_CODEC_AOM=1 \
|
|
-DAOM_LIBRARY=$(LIBAOM_OUT) \
|
|
-DAOM_INCLUDE_DIR=$(LIBAOM_DIR) \
|
|
$(LIBAVIF_FLAGS) \
|
|
-B $(CODEC_BUILD_DIR) \
|
|
$(CODEC_DIR) && \
|
|
$(MAKE) -C $(CODEC_BUILD_DIR)
|
|
|
|
$(LIBAOM_OUT): $(LIBAOM_DIR)/CMakeLists.txt
|
|
emcmake cmake \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DENABLE_CCACHE=0 \
|
|
-DAOM_TARGET_CPU=generic \
|
|
-DENABLE_DOCS=0 \
|
|
-DENABLE_TESTS=0 \
|
|
-DENABLE_EXAMPLES=0 \
|
|
-DENABLE_TOOLS=0 \
|
|
-DCONFIG_ACCOUNTING=1 \
|
|
-DCONFIG_INSPECTION=0 \
|
|
-DCONFIG_RUNTIME_CPU_DETECT=0 \
|
|
-DCONFIG_WEBM_IO=0 \
|
|
$(LIBAOM_FLAGS) \
|
|
-B $(LIBAOM_BUILD_DIR) \
|
|
$(LIBAOM_DIR) && \
|
|
$(MAKE) -C $(LIBAOM_BUILD_DIR)
|
|
|
|
clean:
|
|
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
|
|
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
|
$(MAKE) -C $(LIBAOM_BUILD_DIR) clean
|