all: default
default:
-SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
- common/frame.c common/dct.c common/cpu.c common/cabac.c \
- common/common.c common/osdep.c common/rectangle.c \
- common/set.c common/quant.c common/deblock.c common/vlc.c \
- common/mvpred.c common/bitstream.c \
- encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
- encoder/set.c encoder/macroblock.c encoder/cabac.c \
- encoder/cavlc.c encoder/encoder.c encoder/lookahead.c
+SRCS = common/osdep.c common/base.c common/cpu.c common/tables.c \
+ encoder/api.c
+
+SRCS_X = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
+ common/frame.c common/dct.c common/cabac.c \
+ common/common.c common/rectangle.c \
+ common/set.c common/quant.c common/deblock.c common/vlc.c \
+ common/mvpred.c common/bitstream.c \
+ encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
+ encoder/set.c encoder/macroblock.c encoder/cabac.c \
+ encoder/cavlc.c encoder/encoder.c encoder/lookahead.c
+
+SRCS_8 =
SRCCLI = x264.c input/input.c input/timecode.c input/raw.c input/y4m.c \
output/raw.c output/matroska.c output/matroska_ebml.c \
output/flv.c output/flv_bytestream.c filters/filters.c \
filters/video/video.c filters/video/source.c filters/video/internal.c \
- filters/video/resize.c filters/video/cache.c filters/video/fix_vfr_pts.c \
- filters/video/select_every.c filters/video/crop.c filters/video/depth.c
+ filters/video/resize.c filters/video/fix_vfr_pts.c \
+ filters/video/select_every.c filters/video/crop.c
+
+SRCCLI_X = filters/video/cache.c filters/video/depth.c
SRCSO =
+
+SRCCHK_X = tools/checkasm.c
+
+SRCEXAMPLE = example.c
+
OBJS =
+OBJASM =
OBJSO =
OBJCLI =
-
-OBJCHK = tools/checkasm.o
-
-OBJEXAMPLE = example.o
+OBJCHK =
+OBJCHK_8 =
+OBJCHK_10 =
+OBJEXAMPLE =
CONFIG := $(shell cat config.h)
endif
ifneq ($(findstring HAVE_THREAD 1, $(CONFIG)),)
-SRCCLI += input/thread.c
-SRCS += common/threadpool.c
+SRCS_X += common/threadpool.c
+SRCCLI_X += input/thread.c
endif
ifneq ($(findstring HAVE_WIN32THREAD 1, $(CONFIG)),)
SRCCLI += output/mp4_lsmash.c
endif
-# MMX/SSE optims
ifneq ($(AS),)
-X86SRC0 = const-a.asm cabac-a.asm dct-a.asm deblock-a.asm mc-a.asm \
- mc-a2.asm pixel-a.asm predict-a.asm quant-a.asm \
- cpu-a.asm dct-32.asm bitstream-a.asm
-ifneq ($(findstring HIGH_BIT_DEPTH, $(CONFIG)),)
-X86SRC0 += sad16-a.asm
-else
-X86SRC0 += sad-a.asm
-endif
-X86SRC = $(X86SRC0:%=common/x86/%)
+# MMX/SSE optims
+SRCASM_X =
ifeq ($(SYS_ARCH),X86)
ARCH_X86 = yes
-ASMSRC = $(X86SRC) common/x86/pixel-32.asm
+SRCASM_X += common/x86/dct-32.asm \
+ common/x86/pixel-32.asm
endif
-
ifeq ($(SYS_ARCH),X86_64)
ARCH_X86 = yes
-ASMSRC = $(X86SRC:-32.asm=-64.asm) common/x86/trellis-64.asm
+SRCASM_X += common/x86/dct-64.asm \
+ common/x86/trellis-64.asm
endif
ifdef ARCH_X86
-SRCS += common/x86/mc-c.c common/x86/predict-c.c
-OBJASM = $(ASMSRC:%.asm=%.o)
-$(OBJASM): common/x86/x86inc.asm common/x86/x86util.asm
-OBJCHK += tools/checkasm-a.o
+SRCASM_X += common/x86/bitstream-a.asm \
+ common/x86/const-a.asm \
+ common/x86/cabac-a.asm \
+ common/x86/dct-a.asm \
+ common/x86/deblock-a.asm \
+ common/x86/mc-a.asm \
+ common/x86/mc-a2.asm \
+ common/x86/pixel-a.asm \
+ common/x86/predict-a.asm \
+ common/x86/quant-a.asm
+SRCS_X += common/x86/mc-c.c \
+ common/x86/predict-c.c
+
+OBJASM += common/x86/cpu-a.o
+ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)
+OBJASM += $(SRCASM_X:%.asm=%-8.o) common/x86/sad-a-8.o
+endif
+ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)
+OBJASM += $(SRCASM_X:%.asm=%-10.o) common/x86/sad16-a-10.o
endif
+
+OBJCHK += tools/checkasm-a.o
endif
# AltiVec optims
ifeq ($(SYS_ARCH),PPC)
-ifneq ($(AS),)
-SRCS += common/ppc/mc.c common/ppc/pixel.c common/ppc/dct.c \
- common/ppc/quant.c common/ppc/deblock.c \
- common/ppc/predict.c
-endif
+SRCS_X += common/ppc/dct.c \
+ common/ppc/deblock.c \
+ common/ppc/mc.c \
+ common/ppc/pixel.c \
+ common/ppc/predict.c \
+ common/ppc/quant.c
endif
# NEON optims
ifeq ($(SYS_ARCH),ARM)
-ifneq ($(AS),)
-ASMSRC += common/arm/cpu-a.S common/arm/pixel-a.S common/arm/mc-a.S \
- common/arm/dct-a.S common/arm/quant-a.S common/arm/deblock-a.S \
- common/arm/predict-a.S common/arm/bitstream-a.S
-SRCS += common/arm/mc-c.c common/arm/predict-c.c
-OBJASM = $(ASMSRC:%.S=%.o)
-OBJCHK += tools/checkasm-arm.o
+SRCASM_X = common/arm/bitstream-a.S \
+ common/arm/dct-a.S \
+ common/arm/deblock-a.S \
+ common/arm/mc-a.S \
+ common/arm/pixel-a.S \
+ common/arm/predict-a.S \
+ common/arm/quant-a.S
+SRCS_X += common/arm/mc-c.c \
+ common/arm/predict-c.c
+
+OBJASM += common/arm/cpu-a.o
+ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)
+OBJASM += $(SRCASM_X:%.S=%-8.o)
endif
+ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)
+OBJASM += $(SRCASM_X:%.S=%-10.o)
+endif
+
+OBJCHK += tools/checkasm-arm.o
endif
# AArch64 NEON optims
ifeq ($(SYS_ARCH),AARCH64)
-ifneq ($(AS),)
-ASMSRC += common/aarch64/bitstream-a.S \
- common/aarch64/cabac-a.S \
- common/aarch64/dct-a.S \
- common/aarch64/deblock-a.S \
- common/aarch64/mc-a.S \
- common/aarch64/pixel-a.S \
- common/aarch64/predict-a.S \
- common/aarch64/quant-a.S
-SRCS += common/aarch64/asm-offsets.c \
- common/aarch64/mc-c.c \
- common/aarch64/predict-c.c
-OBJASM = $(ASMSRC:%.S=%.o)
-OBJCHK += tools/checkasm-aarch64.o
+SRCASM_X = common/aarch64/bitstream-a.S \
+ common/aarch64/cabac-a.S \
+ common/aarch64/dct-a.S \
+ common/aarch64/deblock-a.S \
+ common/aarch64/mc-a.S \
+ common/aarch64/pixel-a.S \
+ common/aarch64/predict-a.S \
+ common/aarch64/quant-a.S
+SRCS_X += common/aarch64/asm-offsets.c \
+ common/aarch64/mc-c.c \
+ common/aarch64/predict-c.c
+
+OBJASM +=
+ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)
+OBJASM += $(SRCASM_X:%.S=%-8.o)
+endif
+ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)
+OBJASM += $(SRCASM_X:%.S=%-10.o)
endif
+
+OBJCHK += tools/checkasm-aarch64.o
endif
# MSA optims
ifeq ($(SYS_ARCH),MIPS)
ifneq ($(findstring HAVE_MSA 1, $(CONFIG)),)
-SRCS += common/mips/mc-c.c common/mips/dct-c.c \
- common/mips/deblock-c.c common/mips/pixel-c.c \
- common/mips/predict-c.c common/mips/quant-c.c
+SRCS_X += common/mips/dct-c.c \
+ common/mips/deblock-c.c \
+ common/mips/mc-c.c \
+ common/mips/pixel-c.c \
+ common/mips/predict-c.c \
+ common/mips/quant-c.c
endif
endif
+endif
+
ifneq ($(HAVE_GETOPT_LONG),1)
SRCCLI += extras/getopt.c
endif
common/oclobj.h: common/opencl/x264-cl.h $(wildcard $(SRCPATH)/common/opencl/*.cl)
cat $^ | $(SRCPATH)/tools/cltostr.sh $@
GENERATED += common/oclobj.h
-SRCS += common/opencl.c encoder/slicetype-cl.c
+SRCS_8 += common/opencl.c encoder/slicetype-cl.c
endif
OBJS += $(SRCS:%.c=%.o)
OBJCLI += $(SRCCLI:%.c=%.o)
OBJSO += $(SRCSO:%.c=%.o)
+OBJEXAMPLE += $(SRCEXAMPLE:%.c=%.o)
-.PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* etags
+ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)
+OBJS += $(SRCS_X:%.c=%-8.o) $(SRCS_8:%.c=%-8.o)
+OBJCLI += $(SRCCLI_X:%.c=%-8.o)
+OBJCHK_8 += $(SRCCHK_X:%.c=%-8.o)
+checkasm: checkasm8$(EXE)
+endif
+ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)
+OBJS += $(SRCS_X:%.c=%-10.o)
+OBJCLI += $(SRCCLI_X:%.c=%-10.o)
+OBJCHK_10 += $(SRCCHK_X:%.c=%-10.o)
+checkasm: checkasm10$(EXE)
+endif
+
+.PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* checkasm etags
cli: x264$(EXE)
lib-static: $(LIBX264)
$(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
ifneq ($(EXE),)
-.PHONY: x264 checkasm example
+.PHONY: x264 checkasm8 checkasm10 example
x264: x264$(EXE)
-checkasm: checkasm$(EXE)
+checkasm8: checkasm8$(EXE)
+checkasm10: checkasm10$(EXE)
example: example$(EXE)
endif
x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264)
$(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
-checkasm$(EXE): $(GENERATED) .depend $(OBJCHK) $(LIBX264)
- $(LD)$@ $(OBJCHK) $(LIBX264) $(LDFLAGS)
+checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_8) $(LIBX264)
+ $(LD)$@ $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LDFLAGS)
+
+checkasm10$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_10) $(LIBX264)
+ $(LD)$@ $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LDFLAGS)
example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264)
$(LD)$@ $(OBJEXAMPLE) $(LIBX264) $(LDFLAGS)
-$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJEXAMPLE): .depend
+$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXAMPLE): .depend
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< $(CC_O)
+
+%-8.o: %.c
+ $(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8
+
+%-10.o: %.c
+ $(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10
%.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
$(AS) $(ASFLAGS) -o $@ $<
-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
+%-8.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
+ $(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=8 -Dprivate_prefix=x264_8
+ -@ $(if $(STRIP), $(STRIP) -x $@)
+
+%-10.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
+ $(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=10 -Dprivate_prefix=x264_10
+ -@ $(if $(STRIP), $(STRIP) -x $@)
+
%.o: %.S
$(AS) $(ASFLAGS) -o $@ $<
-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
+%-8.o: %.S
+ $(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8
+ -@ $(if $(STRIP), $(STRIP) -x $@)
+
+%-10.o: %.S
+ $(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10
+ -@ $(if $(STRIP), $(STRIP) -x $@)
+
%.dll.o: %.rc x264.h
$(RC) $(RCFLAGS)$@ -DDLL $<
@rm -f .depend
@echo 'dependency file generation...'
ifeq ($(COMPILER),CL)
- @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%.o)" 1>> .depend;)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%.o)" 1>> .depend;)
+ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-8.o)" 1>> .depend;)
+endif
+ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-10.o)" 1>> .depend;)
+endif
else
- @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)
+ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-8.o) $(DEPMM) 1>> .depend;)
+endif
+ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-10.o) $(DEPMM) 1>> .depend;)
+endif
endif
config.mak:
include .depend
endif
-SRC2 = $(SRCS) $(SRCCLI)
+OBJPROF = $(OBJS) $(OBJCLI)
# These should cover most of the important codepaths
OPT0 = --crf 30 -b1 -m1 -r1 --me dia --no-cabac --direct temporal --ssim --no-weightb
OPT1 = --crf 16 -b2 -m3 -r3 --me hex --no-8x8dct --direct spatial --no-dct-decimate -t0 --slice-max-mbs 50
# Because Visual Studio timestamps the object files within the PGD, it fails to build if they change - only the executable should be deleted
rm -f x264$(EXE)
else
- rm -f $(SRC2:%.c=%.o)
+ rm -f $(OBJPROF)
endif
$(MAKE) CFLAGS="$(CFLAGS) $(PROF_USE_CC)" LDFLAGS="$(LDFLAGS) $(PROF_USE_LD)"
- rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc
+ rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc
endif
clean:
- rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(SONAME) *.a *.lib *.exp *.pdb x264 x264.exe .depend TAGS
- rm -f checkasm checkasm.exe $(OBJCHK) $(GENERATED) x264_lookahead.clbin
- rm -f example example.exe $(OBJEXAMPLE)
- rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc
+ rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(GENERATED) .depend TAGS
+ rm -f $(SONAME) *.a *.lib *.exp *.pdb x264$(EXE) x264_lookahead.clbin
+ rm -f checkasm8$(EXE) checkasm10$(EXE) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10)
+ rm -f example$(EXE) $(OBJEXAMPLE)
+ rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc
distclean: clean
rm -f config.mak x264_config.h config.h config.log x264.pc x264.def
etags: TAGS
TAGS:
- etags $(SRCS)
+ etags $(SRCS) $(SRCS_X) $(SRCS_8)
#include "config.h"
+#define GLUE(a, b) a ## b
+#define JOIN(a, b) GLUE(a, b)
+
#ifdef PREFIX
-# define EXTERN_ASM _x264_
+# define BASE _x264_
+# define SYM_PREFIX _
+#else
+# define BASE x264_
+# define SYM_PREFIX
+#endif
+
+#ifdef BIT_DEPTH
+# define EXTERN_ASM JOIN(JOIN(BASE, BIT_DEPTH), _)
#else
-# define EXTERN_ASM x264_
+# define EXTERN_ASM BASE
#endif
+#define X(s) JOIN(EXTERN_ASM, s)
+#define X264(s) JOIN(BASE, s)
+#define EXT(s) JOIN(SYM_PREFIX, s)
+
#ifdef __ELF__
# define ELF
#else
#endif
.endm
-#define GLUE(a, b) a ## b
-#define JOIN(a, b) GLUE(a, b)
-#define X(s) JOIN(EXTERN_ASM, s)
-
#define FDEC_STRIDE 32
#define FENC_STRIDE 16
--- /dev/null
+/*****************************************************************************
+ * bitstream.h: aarch64 bitstream functions
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_AARCH64_BITSTREAM_H
+#define X264_AARCH64_BITSTREAM_H
+
+#define x264_nal_escape_neon x264_template(nal_escape_neon)
+uint8_t *x264_nal_escape_neon( uint8_t *dst, uint8_t *src, uint8_t *end );
+
+#endif
// w12 holds x264_cabac_t.i_range
function cabac_encode_decision_asm, export=1
- movrel x8, X(cabac_range_lps)
- movrel x9, X(cabac_transition)
+ movrel x8, X264(cabac_range_lps)
+ movrel x9, X264(cabac_transition)
add w10, w1, #CABAC_STATE
ldrb w3, [x0, x10] // i_state
ldr w12, [x0, #CABAC_I_RANGE]
#ifndef X264_AARCH64_DCT_H
#define X264_AARCH64_DCT_H
+#define x264_dct4x4dc_neon x264_template(dct4x4dc_neon)
void x264_dct4x4dc_neon( int16_t d[16] );
+#define x264_idct4x4dc_neon x264_template(idct4x4dc_neon)
void x264_idct4x4dc_neon( int16_t d[16] );
+#define x264_sub4x4_dct_neon x264_template(sub4x4_dct_neon)
void x264_sub4x4_dct_neon( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_neon x264_template(sub8x8_dct_neon)
void x264_sub8x8_dct_neon( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_neon x264_template(sub16x16_dct_neon)
void x264_sub16x16_dct_neon( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add4x4_idct_neon x264_template(add4x4_idct_neon)
void x264_add4x4_idct_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_add8x8_idct_neon x264_template(add8x8_idct_neon)
void x264_add8x8_idct_neon( uint8_t *p_dst, int16_t dct[4][16] );
+#define x264_add16x16_idct_neon x264_template(add16x16_idct_neon)
void x264_add16x16_idct_neon( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_add8x8_idct_dc_neon x264_template(add8x8_idct_dc_neon)
void x264_add8x8_idct_dc_neon( uint8_t *p_dst, int16_t dct[4] );
+#define x264_add16x16_idct_dc_neon x264_template(add16x16_idct_dc_neon)
void x264_add16x16_idct_dc_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_sub8x8_dct_dc_neon x264_template(sub8x8_dct_dc_neon)
void x264_sub8x8_dct_dc_neon( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_neon x264_template(sub8x16_dct_dc_neon)
void x264_sub8x16_dct_dc_neon( int16_t dct[8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_neon x264_template(sub8x8_dct8_neon)
void x264_sub8x8_dct8_neon( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_neon x264_template(sub16x16_dct8_neon)
void x264_sub16x16_dct8_neon( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add8x8_idct8_neon x264_template(add8x8_idct8_neon)
void x264_add8x8_idct8_neon( uint8_t *p_dst, int16_t dct[64] );
+#define x264_add16x16_idct8_neon x264_template(add16x16_idct8_neon)
void x264_add16x16_idct8_neon( uint8_t *p_dst, int16_t dct[4][64] );
+#define x264_zigzag_scan_4x4_frame_neon x264_template(zigzag_scan_4x4_frame_neon)
void x264_zigzag_scan_4x4_frame_neon( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_field_neon x264_template(zigzag_scan_4x4_field_neon)
void x264_zigzag_scan_4x4_field_neon( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_8x8_frame_neon x264_template(zigzag_scan_8x8_frame_neon)
void x264_zigzag_scan_8x8_frame_neon( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_field_neon x264_template(zigzag_scan_8x8_field_neon)
void x264_zigzag_scan_8x8_field_neon( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_sub_4x4_field_neon x264_template(zigzag_sub_4x4_field_neon)
int x264_zigzag_sub_4x4_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_sub_4x4ac_field_neon x264_template(zigzag_sub_4x4ac_field_neon)
int x264_zigzag_sub_4x4ac_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc );
+#define x264_zigzag_sub_4x4_frame_neon x264_template(zigzag_sub_4x4_frame_neon)
int x264_zigzag_sub_4x4_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_sub_4x4ac_frame_neon x264_template(zigzag_sub_4x4ac_frame_neon)
int x264_zigzag_sub_4x4ac_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc );
+#define x264_zigzag_sub_8x8_field_neon x264_template(zigzag_sub_8x8_field_neon)
int x264_zigzag_sub_8x8_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_sub_8x8_frame_neon x264_template(zigzag_sub_8x8_frame_neon)
int x264_zigzag_sub_8x8_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst );
+#define x264_zigzag_interleave_8x8_cavlc_neon x264_template(zigzag_interleave_8x8_cavlc_neon)
void x264_zigzag_interleave_8x8_cavlc_neon( dctcoef *dst, dctcoef *src, uint8_t *nnz );
#endif
--- /dev/null
+/*****************************************************************************
+ * deblock.h: aarch64 deblocking
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_AARCH64_DEBLOCK_H
+#define X264_AARCH64_DEBLOCK_H
+
+#define x264_deblock_v_luma_neon x264_template(deblock_v_luma_neon)
+void x264_deblock_v_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_neon x264_template(deblock_h_luma_neon)
+void x264_deblock_h_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_chroma_neon x264_template(deblock_v_chroma_neon)
+void x264_deblock_v_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_neon x264_template(deblock_h_chroma_neon)
+void x264_deblock_h_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_strength_neon x264_template(deblock_strength_neon)
+void x264_deblock_strength_neon( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+#define x264_deblock_h_chroma_422_neon x264_template(deblock_h_chroma_422_neon)
+void x264_deblock_h_chroma_422_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_mbaff_neon x264_template(deblock_h_chroma_mbaff_neon)
+void x264_deblock_h_chroma_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_intra_mbaff_neon x264_template(deblock_h_chroma_intra_mbaff_neon)
+void x264_deblock_h_chroma_intra_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_neon x264_template(deblock_h_chroma_intra_neon)
+void x264_deblock_h_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_422_intra_neon x264_template(deblock_h_chroma_422_intra_neon)
+void x264_deblock_h_chroma_422_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_neon x264_template(deblock_v_chroma_intra_neon)
+void x264_deblock_v_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_luma_intra_neon x264_template(deblock_h_luma_intra_neon)
+void x264_deblock_h_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_luma_intra_neon x264_template(deblock_v_luma_intra_neon)
+void x264_deblock_v_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+
+#endif
#include "common/common.h"
#include "mc.h"
+#define x264_prefetch_ref_aarch64 x264_template(prefetch_ref_aarch64)
void x264_prefetch_ref_aarch64( uint8_t *, intptr_t, int );
+#define x264_prefetch_fenc_420_aarch64 x264_template(prefetch_fenc_420_aarch64)
void x264_prefetch_fenc_420_aarch64( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_prefetch_fenc_422_aarch64 x264_template(prefetch_fenc_422_aarch64)
void x264_prefetch_fenc_422_aarch64( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_memcpy_aligned_neon x264_template(memcpy_aligned_neon)
void *x264_memcpy_aligned_neon( void *dst, const void *src, size_t n );
+#define x264_memzero_aligned_neon x264_template(memzero_aligned_neon)
void x264_memzero_aligned_neon( void *dst, size_t n );
+#define x264_pixel_avg_16x16_neon x264_template(pixel_avg_16x16_neon)
void x264_pixel_avg_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_16x8_neon x264_template(pixel_avg_16x8_neon)
void x264_pixel_avg_16x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x16_neon x264_template(pixel_avg_8x16_neon)
void x264_pixel_avg_8x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x8_neon x264_template(pixel_avg_8x8_neon)
void x264_pixel_avg_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x4_neon x264_template(pixel_avg_8x4_neon)
void x264_pixel_avg_8x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x16_neon x264_template(pixel_avg_4x16_neon)
void x264_pixel_avg_4x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x8_neon x264_template(pixel_avg_4x8_neon)
void x264_pixel_avg_4x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x4_neon x264_template(pixel_avg_4x4_neon)
void x264_pixel_avg_4x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x2_neon x264_template(pixel_avg_4x2_neon)
void x264_pixel_avg_4x2_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg2_w4_neon x264_template(pixel_avg2_w4_neon)
void x264_pixel_avg2_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w8_neon x264_template(pixel_avg2_w8_neon)
void x264_pixel_avg2_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w16_neon x264_template(pixel_avg2_w16_neon)
void x264_pixel_avg2_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w20_neon x264_template(pixel_avg2_w20_neon)
void x264_pixel_avg2_w20_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_plane_copy_core_neon x264_template(plane_copy_core_neon)
void x264_plane_copy_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_swap_core_neon x264_template(plane_copy_swap_core_neon)
void x264_plane_copy_swap_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_neon x264_template(plane_copy_deinterleave_neon)
void x264_plane_copy_deinterleave_neon( pixel *dstu, intptr_t i_dstu,
pixel *dstv, intptr_t i_dstv,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_neon x264_template(plane_copy_deinterleave_rgb_neon)
void x264_plane_copy_deinterleave_rgb_neon( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_interleave_core_neon x264_template(plane_copy_interleave_core_neon)
void x264_plane_copy_interleave_core_neon( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_store_interleave_chroma_neon x264_template(store_interleave_chroma_neon)
void x264_store_interleave_chroma_neon( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_load_deinterleave_chroma_fdec_neon x264_template(load_deinterleave_chroma_fdec_neon)
void x264_load_deinterleave_chroma_fdec_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_neon x264_template(load_deinterleave_chroma_fenc_neon)
void x264_load_deinterleave_chroma_fenc_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_mc_weight_w16_neon x264_template(mc_weight_w16_neon)
+#define x264_mc_weight_w16_nodenom_neon x264_template(mc_weight_w16_nodenom_neon)
+#define x264_mc_weight_w16_offsetadd_neon x264_template(mc_weight_w16_offsetadd_neon)
+#define x264_mc_weight_w16_offsetsub_neon x264_template(mc_weight_w16_offsetsub_neon)
+#define x264_mc_weight_w20_neon x264_template(mc_weight_w20_neon)
+#define x264_mc_weight_w20_nodenom_neon x264_template(mc_weight_w20_nodenom_neon)
+#define x264_mc_weight_w20_offsetadd_neon x264_template(mc_weight_w20_offsetadd_neon)
+#define x264_mc_weight_w20_offsetsub_neon x264_template(mc_weight_w20_offsetsub_neon)
+#define x264_mc_weight_w4_neon x264_template(mc_weight_w4_neon)
+#define x264_mc_weight_w4_nodenom_neon x264_template(mc_weight_w4_nodenom_neon)
+#define x264_mc_weight_w4_offsetadd_neon x264_template(mc_weight_w4_offsetadd_neon)
+#define x264_mc_weight_w4_offsetsub_neon x264_template(mc_weight_w4_offsetsub_neon)
+#define x264_mc_weight_w8_neon x264_template(mc_weight_w8_neon)
+#define x264_mc_weight_w8_nodenom_neon x264_template(mc_weight_w8_nodenom_neon)
+#define x264_mc_weight_w8_offsetadd_neon x264_template(mc_weight_w8_offsetadd_neon)
+#define x264_mc_weight_w8_offsetsub_neon x264_template(mc_weight_w8_offsetsub_neon)
#define MC_WEIGHT(func)\
void x264_mc_weight_w20##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
void x264_mc_weight_w16##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
x264_mc_weight_w20##func##_neon,\
};
+#if !HIGH_BIT_DEPTH
MC_WEIGHT()
MC_WEIGHT(_nodenom)
MC_WEIGHT(_offsetadd)
MC_WEIGHT(_offsetsub)
+#endif
+#define x264_mc_copy_w4_neon x264_template(mc_copy_w4_neon)
void x264_mc_copy_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w8_neon x264_template(mc_copy_w8_neon)
void x264_mc_copy_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w16_neon x264_template(mc_copy_w16_neon)
void x264_mc_copy_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_chroma_neon x264_template(mc_chroma_neon)
void x264_mc_chroma_neon( uint8_t *, uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, int, int );
+#define x264_integral_init4h_neon x264_template(integral_init4h_neon)
void x264_integral_init4h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init4v_neon x264_template(integral_init4v_neon)
void x264_integral_init4v_neon( uint16_t *, uint16_t *, intptr_t );
+#define x264_integral_init8h_neon x264_template(integral_init8h_neon)
void x264_integral_init8h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init8v_neon x264_template(integral_init8v_neon)
void x264_integral_init8v_neon( uint16_t *, intptr_t );
+#define x264_frame_init_lowres_core_neon x264_template(frame_init_lowres_core_neon)
void x264_frame_init_lowres_core_neon( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, intptr_t, int, int );
+#define x264_mbtree_propagate_cost_neon x264_template(mbtree_propagate_cost_neon)
void x264_mbtree_propagate_cost_neon( int16_t *, uint16_t *, uint16_t *, uint16_t *, uint16_t *, float *, int );
+#define x264_mbtree_fix8_pack_neon x264_template(mbtree_fix8_pack_neon)
void x264_mbtree_fix8_pack_neon( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_unpack_neon x264_template(mbtree_fix8_unpack_neon)
void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count );
#if !HIGH_BIT_DEPTH
}
}
+#define x264_hpel_filter_neon x264_template(hpel_filter_neon)
void x264_hpel_filter_neon( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc,
uint8_t *src, intptr_t stride, int width,
int height, int16_t *buf );
PLANE_COPY(16, neon)
PLANE_COPY_SWAP(16, neon)
PLANE_INTERLEAVE(neon)
-#endif // !HIGH_BIT_DEPTH
-
PROPAGATE_LIST(neon)
+#endif // !HIGH_BIT_DEPTH
void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf )
{
#ifndef X264_AARCH64_MC_H
#define X264_AARCH64_MC_H
+#define x264_mc_init_aarch64 x264_template(mc_init_aarch64)
void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf );
#endif
#ifndef X264_AARCH64_PIXEL_H
#define X264_AARCH64_PIXEL_H
+#define x264_pixel_sad_16x16_neon x264_template(pixel_sad_16x16_neon)
+#define x264_pixel_sad_16x8_neon x264_template(pixel_sad_16x8_neon)
+#define x264_pixel_sad_4x16_neon x264_template(pixel_sad_4x16_neon)
+#define x264_pixel_sad_4x4_neon x264_template(pixel_sad_4x4_neon)
+#define x264_pixel_sad_4x8_neon x264_template(pixel_sad_4x8_neon)
+#define x264_pixel_sad_8x16_neon x264_template(pixel_sad_8x16_neon)
+#define x264_pixel_sad_8x4_neon x264_template(pixel_sad_8x4_neon)
+#define x264_pixel_sad_8x8_neon x264_template(pixel_sad_8x8_neon)
+#define x264_pixel_sad_x3_16x16_neon x264_template(pixel_sad_x3_16x16_neon)
+#define x264_pixel_sad_x3_16x8_neon x264_template(pixel_sad_x3_16x8_neon)
+#define x264_pixel_sad_x3_4x4_neon x264_template(pixel_sad_x3_4x4_neon)
+#define x264_pixel_sad_x3_4x8_neon x264_template(pixel_sad_x3_4x8_neon)
+#define x264_pixel_sad_x3_8x16_neon x264_template(pixel_sad_x3_8x16_neon)
+#define x264_pixel_sad_x3_8x4_neon x264_template(pixel_sad_x3_8x4_neon)
+#define x264_pixel_sad_x3_8x8_neon x264_template(pixel_sad_x3_8x8_neon)
+#define x264_pixel_sad_x4_16x16_neon x264_template(pixel_sad_x4_16x16_neon)
+#define x264_pixel_sad_x4_16x8_neon x264_template(pixel_sad_x4_16x8_neon)
+#define x264_pixel_sad_x4_4x4_neon x264_template(pixel_sad_x4_4x4_neon)
+#define x264_pixel_sad_x4_4x8_neon x264_template(pixel_sad_x4_4x8_neon)
+#define x264_pixel_sad_x4_8x16_neon x264_template(pixel_sad_x4_8x16_neon)
+#define x264_pixel_sad_x4_8x4_neon x264_template(pixel_sad_x4_8x4_neon)
+#define x264_pixel_sad_x4_8x8_neon x264_template(pixel_sad_x4_8x8_neon)
+#define x264_pixel_satd_16x16_neon x264_template(pixel_satd_16x16_neon)
+#define x264_pixel_satd_16x8_neon x264_template(pixel_satd_16x8_neon)
+#define x264_pixel_satd_4x16_neon x264_template(pixel_satd_4x16_neon)
+#define x264_pixel_satd_4x4_neon x264_template(pixel_satd_4x4_neon)
+#define x264_pixel_satd_4x8_neon x264_template(pixel_satd_4x8_neon)
+#define x264_pixel_satd_8x16_neon x264_template(pixel_satd_8x16_neon)
+#define x264_pixel_satd_8x4_neon x264_template(pixel_satd_8x4_neon)
+#define x264_pixel_satd_8x8_neon x264_template(pixel_satd_8x8_neon)
+#define x264_pixel_ssd_16x16_neon x264_template(pixel_ssd_16x16_neon)
+#define x264_pixel_ssd_16x8_neon x264_template(pixel_ssd_16x8_neon)
+#define x264_pixel_ssd_4x16_neon x264_template(pixel_ssd_4x16_neon)
+#define x264_pixel_ssd_4x4_neon x264_template(pixel_ssd_4x4_neon)
+#define x264_pixel_ssd_4x8_neon x264_template(pixel_ssd_4x8_neon)
+#define x264_pixel_ssd_8x16_neon x264_template(pixel_ssd_8x16_neon)
+#define x264_pixel_ssd_8x4_neon x264_template(pixel_ssd_8x4_neon)
+#define x264_pixel_ssd_8x8_neon x264_template(pixel_ssd_8x8_neon)
#define DECL_PIXELS( ret, name, suffix, args ) \
ret x264_pixel_##name##_16x16_##suffix args;\
ret x264_pixel_##name##_16x8_##suffix args;\
DECL_X1( ssd, neon )
+#define x264_pixel_ssd_nv12_core_neon x264_template(pixel_ssd_nv12_core_neon)
void x264_pixel_ssd_nv12_core_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, uint64_t *, uint64_t * );
+#define x264_pixel_vsad_neon x264_template(pixel_vsad_neon)
int x264_pixel_vsad_neon( uint8_t *, intptr_t, int );
+#define x264_pixel_sa8d_8x8_neon x264_template(pixel_sa8d_8x8_neon)
int x264_pixel_sa8d_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_16x16_neon x264_template(pixel_sa8d_16x16_neon)
int x264_pixel_sa8d_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_satd_16x16_neon x264_template(pixel_sa8d_satd_16x16_neon)
uint64_t x264_pixel_sa8d_satd_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_var_8x8_neon x264_template(pixel_var_8x8_neon)
uint64_t x264_pixel_var_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_8x16_neon x264_template(pixel_var_8x16_neon)
uint64_t x264_pixel_var_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_16x16_neon x264_template(pixel_var_16x16_neon)
uint64_t x264_pixel_var_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_var2_8x8_neon x264_template(pixel_var2_8x8_neon)
int x264_pixel_var2_8x8_neon ( uint8_t *, uint8_t *, int * );
+#define x264_pixel_var2_8x16_neon x264_template(pixel_var2_8x16_neon)
int x264_pixel_var2_8x16_neon( uint8_t *, uint8_t *, int * );
+#define x264_pixel_hadamard_ac_8x8_neon x264_template(pixel_hadamard_ac_8x8_neon)
uint64_t x264_pixel_hadamard_ac_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_8x16_neon x264_template(pixel_hadamard_ac_8x16_neon)
uint64_t x264_pixel_hadamard_ac_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x8_neon x264_template(pixel_hadamard_ac_16x8_neon)
uint64_t x264_pixel_hadamard_ac_16x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x16_neon x264_template(pixel_hadamard_ac_16x16_neon)
uint64_t x264_pixel_hadamard_ac_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_ssim_4x4x2_core_neon x264_template(pixel_ssim_4x4x2_core_neon)
void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t,
const uint8_t *, intptr_t,
int sums[2][4] );
+#define x264_pixel_ssim_end4_neon x264_template(pixel_ssim_end4_neon)
float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_asd8_neon x264_template(pixel_asd8_neon)
int x264_pixel_asd8_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
#endif
#include "predict.h"
#include "pixel.h"
-void x264_predict_4x4_dc_top_neon( uint8_t *src );
-void x264_predict_4x4_ddr_neon( uint8_t *src );
-void x264_predict_4x4_ddl_neon( uint8_t *src );
-
-void x264_predict_8x8c_dc_top_neon( uint8_t *src );
-void x264_predict_8x8c_dc_left_neon( uint8_t *src );
-void x264_predict_8x8c_p_neon( uint8_t *src );
-
-void x264_predict_8x16c_dc_left_neon( uint8_t *src );
-void x264_predict_8x16c_dc_top_neon( uint8_t *src );
-void x264_predict_8x16c_p_neon( uint8_t *src );
-
-void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
-void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
-
-void x264_predict_16x16_dc_top_neon( uint8_t *src );
-void x264_predict_16x16_dc_left_neon( uint8_t *src );
-void x264_predict_16x16_p_neon( uint8_t *src );
-
void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] )
{
#if !HIGH_BIT_DEPTH
#ifndef X264_AARCH64_PREDICT_H
#define X264_AARCH64_PREDICT_H
+#define x264_predict_4x4_h_aarch64 x264_template(predict_4x4_h_aarch64)
void x264_predict_4x4_h_aarch64( uint8_t *src );
+#define x264_predict_4x4_v_aarch64 x264_template(predict_4x4_v_aarch64)
void x264_predict_4x4_v_aarch64( uint8_t *src );
+#define x264_predict_8x8c_v_aarch64 x264_template(predict_8x8c_v_aarch64)
void x264_predict_8x8c_v_aarch64( uint8_t *src );
// for the merged 4x4 intra sad/satd which expects unified suffix
#define x264_predict_4x4_v_neon x264_predict_4x4_v_aarch64
#define x264_predict_8x8c_v_neon x264_predict_8x8c_v_aarch64
+#define x264_predict_4x4_dc_top_neon x264_template(predict_4x4_dc_top_neon)
+void x264_predict_4x4_dc_top_neon( uint8_t *src );
+#define x264_predict_4x4_ddr_neon x264_template(predict_4x4_ddr_neon)
+void x264_predict_4x4_ddr_neon( uint8_t *src );
+#define x264_predict_4x4_ddl_neon x264_template(predict_4x4_ddl_neon)
+void x264_predict_4x4_ddl_neon( uint8_t *src );
+
+#define x264_predict_8x8c_dc_top_neon x264_template(predict_8x8c_dc_top_neon)
+void x264_predict_8x8c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_left_neon x264_template(predict_8x8c_dc_left_neon)
+void x264_predict_8x8c_dc_left_neon( uint8_t *src );
+#define x264_predict_8x8c_p_neon x264_template(predict_8x8c_p_neon)
+void x264_predict_8x8c_p_neon( uint8_t *src );
+
+#define x264_predict_8x16c_dc_left_neon x264_template(predict_8x16c_dc_left_neon)
+void x264_predict_8x16c_dc_left_neon( uint8_t *src );
+#define x264_predict_8x16c_dc_top_neon x264_template(predict_8x16c_dc_top_neon)
+void x264_predict_8x16c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x16c_p_neon x264_template(predict_8x16c_p_neon)
+void x264_predict_8x16c_p_neon( uint8_t *src );
+
+#define x264_predict_8x8_ddl_neon x264_template(predict_8x8_ddl_neon)
+void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddr_neon x264_template(predict_8x8_ddr_neon)
+void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vl_neon x264_template(predict_8x8_vl_neon)
+void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_neon x264_template(predict_8x8_vr_neon)
+void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hd_neon x264_template(predict_8x8_hd_neon)
+void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hu_neon x264_template(predict_8x8_hu_neon)
+void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
+
+#define x264_predict_16x16_dc_top_neon x264_template(predict_16x16_dc_top_neon)
+void x264_predict_16x16_dc_top_neon( uint8_t *src );
+#define x264_predict_16x16_dc_left_neon x264_template(predict_16x16_dc_left_neon)
+void x264_predict_16x16_dc_left_neon( uint8_t *src );
+#define x264_predict_16x16_p_neon x264_template(predict_16x16_p_neon)
+void x264_predict_16x16_p_neon( uint8_t *src );
+
+#define x264_predict_4x4_dc_neon x264_template(predict_4x4_dc_neon)
void x264_predict_4x4_dc_neon( uint8_t *src );
+#define x264_predict_8x8_v_neon x264_template(predict_8x8_v_neon)
void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_h_neon x264_template(predict_8x8_h_neon)
void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_neon x264_template(predict_8x8_dc_neon)
void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8c_dc_neon x264_template(predict_8x8c_dc_neon)
void x264_predict_8x8c_dc_neon( uint8_t *src );
+#define x264_predict_8x8c_h_neon x264_template(predict_8x8c_h_neon)
void x264_predict_8x8c_h_neon( uint8_t *src );
+#define x264_predict_8x16c_v_neon x264_template(predict_8x16c_v_neon)
void x264_predict_8x16c_v_neon( uint8_t *src );
+#define x264_predict_8x16c_h_neon x264_template(predict_8x16c_h_neon)
void x264_predict_8x16c_h_neon( uint8_t *src );
+#define x264_predict_8x16c_dc_neon x264_template(predict_8x16c_dc_neon)
void x264_predict_8x16c_dc_neon( uint8_t *src );
+#define x264_predict_16x16_v_neon x264_template(predict_16x16_v_neon)
void x264_predict_16x16_v_neon( uint8_t *src );
+#define x264_predict_16x16_h_neon x264_template(predict_16x16_h_neon)
void x264_predict_16x16_h_neon( uint8_t *src );
+#define x264_predict_16x16_dc_neon x264_template(predict_16x16_dc_neon)
void x264_predict_16x16_dc_neon( uint8_t *src );
+#define x264_predict_4x4_init_aarch64 x264_template(predict_4x4_init_aarch64)
void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init_aarch64 x264_template(predict_8x8_init_aarch64)
void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
+#define x264_predict_8x8c_init_aarch64 x264_template(predict_8x8c_init_aarch64)
void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init_aarch64 x264_template(predict_8x16c_init_aarch64)
void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] );
+#define x264_predict_16x16_init_aarch64 x264_template(predict_16x16_init_aarch64)
void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] );
#endif /* X264_AARCH64_PREDICT_H */
.macro decimate_score_1x size
function decimate_score\size\()_neon, export=1
ld1 {v0.8h,v1.8h}, [x0]
- movrel x5, X(decimate_table4)
+ movrel x5, X264(decimate_table4)
movi v3.16b, #0x01
sqxtn v0.8b, v0.8h
sqxtn2 v0.16b, v1.8h
mvn x1, x1
mov w0, #0
cbz x1, 0f
- movrel x5, X(decimate_table8)
+ movrel x5, X264(decimate_table8)
1:
clz x3, x1
lsl x1, x1, x3
#ifndef X264_AARCH64_QUANT_H
#define X264_AARCH64_QUANT_H
+#define x264_quant_2x2_dc_aarch64 x264_template(quant_2x2_dc_aarch64)
int x264_quant_2x2_dc_aarch64( int16_t dct[4], int mf, int bias );
+#define x264_quant_2x2_dc_neon x264_template(quant_2x2_dc_neon)
int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_neon x264_template(quant_4x4_dc_neon)
int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias );
+#define x264_quant_4x4_neon x264_template(quant_4x4_neon)
int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_4x4x4_neon x264_template(quant_4x4x4_neon)
int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_8x8_neon x264_template(quant_8x8_neon)
int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] );
+#define x264_dequant_4x4_dc_neon x264_template(dequant_4x4_dc_neon)
void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4_neon x264_template(dequant_4x4_neon)
void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_neon x264_template(dequant_8x8_neon)
void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_decimate_score15_neon x264_template(decimate_score15_neon)
int x264_decimate_score15_neon( int16_t * );
+#define x264_decimate_score16_neon x264_template(decimate_score16_neon)
int x264_decimate_score16_neon( int16_t * );
+#define x264_decimate_score64_neon x264_template(decimate_score64_neon)
int x264_decimate_score64_neon( int16_t * );
+#define x264_coeff_last4_aarch64 x264_template(coeff_last4_aarch64)
int x264_coeff_last4_aarch64( int16_t * );
+#define x264_coeff_last8_aarch64 x264_template(coeff_last8_aarch64)
int x264_coeff_last8_aarch64( int16_t * );
+#define x264_coeff_last15_neon x264_template(coeff_last15_neon)
int x264_coeff_last15_neon( int16_t * );
+#define x264_coeff_last16_neon x264_template(coeff_last16_neon)
int x264_coeff_last16_neon( int16_t * );
+#define x264_coeff_last64_neon x264_template(coeff_last64_neon)
int x264_coeff_last64_neon( int16_t * );
+#define x264_coeff_level_run4_aarch64 x264_template(coeff_level_run4_aarch64)
int x264_coeff_level_run4_aarch64( int16_t *, x264_run_level_t * );
+#define x264_coeff_level_run8_neon x264_template(coeff_level_run8_neon)
int x264_coeff_level_run8_neon( int16_t *, x264_run_level_t * );
+#define x264_coeff_level_run15_neon x264_template(coeff_level_run15_neon)
int x264_coeff_level_run15_neon( int16_t *, x264_run_level_t * );
+#define x264_coeff_level_run16_neon x264_template(coeff_level_run16_neon)
int x264_coeff_level_run16_neon( int16_t *, x264_run_level_t * );
+#define x264_denoise_dct_neon x264_template(denoise_dct_neon)
void x264_denoise_dct_neon( dctcoef *, uint32_t *, udctcoef *, int );
#endif
.fpu neon
#endif
+#define GLUE(a, b) a ## b
+#define JOIN(a, b) GLUE(a, b)
+
#ifdef PREFIX
-# define EXTERN_ASM _x264_
+# define BASE _x264_
+# define SYM_PREFIX _
+#else
+# define BASE x264_
+# define SYM_PREFIX
+#endif
+
+#ifdef BIT_DEPTH
+# define EXTERN_ASM JOIN(JOIN(BASE, BIT_DEPTH), _)
#else
-# define EXTERN_ASM x264_
+# define EXTERN_ASM BASE
#endif
+#define X(s) JOIN(EXTERN_ASM, s)
+#define X264(s) JOIN(BASE, s)
+#define EXT(s) JOIN(SYM_PREFIX, s)
+
#ifdef __ELF__
# define ELF
#else
#endif
.endm
-#define GLUE(a, b) a ## b
-#define JOIN(a, b) GLUE(a, b)
-#define X(s) JOIN(EXTERN_ASM, s)
-
#define FENC_STRIDE 16
#define FDEC_STRIDE 32
--- /dev/null
+/*****************************************************************************
+ * bitstream.h: arm bitstream functions
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_ARM_BITSTREAM_H
+#define X264_ARM_BITSTREAM_H
+
+#define x264_nal_escape_neon x264_template(nal_escape_neon)
+uint8_t *x264_nal_escape_neon( uint8_t *dst, uint8_t *src, uint8_t *end );
+
+#endif
#ifndef X264_ARM_DCT_H
#define X264_ARM_DCT_H
+#define x264_dct4x4dc_neon x264_template(dct4x4dc_neon)
void x264_dct4x4dc_neon( int16_t d[16] );
+#define x264_idct4x4dc_neon x264_template(idct4x4dc_neon)
void x264_idct4x4dc_neon( int16_t d[16] );
+#define x264_sub4x4_dct_neon x264_template(sub4x4_dct_neon)
void x264_sub4x4_dct_neon( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_neon x264_template(sub8x8_dct_neon)
void x264_sub8x8_dct_neon( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_neon x264_template(sub16x16_dct_neon)
void x264_sub16x16_dct_neon( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add4x4_idct_neon x264_template(add4x4_idct_neon)
void x264_add4x4_idct_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_add8x8_idct_neon x264_template(add8x8_idct_neon)
void x264_add8x8_idct_neon( uint8_t *p_dst, int16_t dct[4][16] );
+#define x264_add16x16_idct_neon x264_template(add16x16_idct_neon)
void x264_add16x16_idct_neon( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_add8x8_idct_dc_neon x264_template(add8x8_idct_dc_neon)
void x264_add8x8_idct_dc_neon( uint8_t *p_dst, int16_t dct[4] );
+#define x264_add16x16_idct_dc_neon x264_template(add16x16_idct_dc_neon)
void x264_add16x16_idct_dc_neon( uint8_t *p_dst, int16_t dct[16] );
+#define x264_sub8x8_dct_dc_neon x264_template(sub8x8_dct_dc_neon)
void x264_sub8x8_dct_dc_neon( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_neon x264_template(sub8x16_dct_dc_neon)
void x264_sub8x16_dct_dc_neon( int16_t dct[8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_neon x264_template(sub8x8_dct8_neon)
void x264_sub8x8_dct8_neon( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_neon x264_template(sub16x16_dct8_neon)
void x264_sub16x16_dct8_neon( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add8x8_idct8_neon x264_template(add8x8_idct8_neon)
void x264_add8x8_idct8_neon( uint8_t *p_dst, int16_t dct[64] );
+#define x264_add16x16_idct8_neon x264_template(add16x16_idct8_neon)
void x264_add16x16_idct8_neon( uint8_t *p_dst, int16_t dct[4][64] );
+#define x264_zigzag_scan_4x4_frame_neon x264_template(zigzag_scan_4x4_frame_neon)
void x264_zigzag_scan_4x4_frame_neon( int16_t level[16], int16_t dct[16] );
#endif
--- /dev/null
+/*****************************************************************************
+ * deblock.h: arm deblocking
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_ARM_DEBLOCK_H
+#define X264_ARM_DEBLOCK_H
+
+#define x264_deblock_v_luma_neon x264_template(deblock_v_luma_neon)
+void x264_deblock_v_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_neon x264_template(deblock_h_luma_neon)
+void x264_deblock_h_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_chroma_neon x264_template(deblock_v_chroma_neon)
+void x264_deblock_v_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_neon x264_template(deblock_h_chroma_neon)
+void x264_deblock_h_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_strength_neon x264_template(deblock_strength_neon)
+void x264_deblock_strength_neon( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+#define x264_deblock_h_chroma_422_neon x264_template(deblock_h_chroma_422_neon)
+void x264_deblock_h_chroma_422_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_mbaff_neon x264_template(deblock_h_chroma_mbaff_neon)
+void x264_deblock_h_chroma_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_intra_mbaff_neon x264_template(deblock_h_chroma_intra_mbaff_neon)
+void x264_deblock_h_chroma_intra_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_neon x264_template(deblock_h_chroma_intra_neon)
+void x264_deblock_h_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_422_intra_neon x264_template(deblock_h_chroma_422_intra_neon)
+void x264_deblock_h_chroma_422_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_neon x264_template(deblock_v_chroma_intra_neon)
+void x264_deblock_v_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_luma_intra_neon x264_template(deblock_h_luma_intra_neon)
+void x264_deblock_h_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_luma_intra_neon x264_template(deblock_v_luma_intra_neon)
+void x264_deblock_v_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+
+#endif
#include "common/common.h"
#include "mc.h"
+#define x264_prefetch_ref_arm x264_template(prefetch_ref_arm)
void x264_prefetch_ref_arm( uint8_t *, intptr_t, int );
+#define x264_prefetch_fenc_arm x264_template(prefetch_fenc_arm)
void x264_prefetch_fenc_arm( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_memcpy_aligned_neon x264_template(memcpy_aligned_neon)
void *x264_memcpy_aligned_neon( void *dst, const void *src, size_t n );
+#define x264_memzero_aligned_neon x264_template(memzero_aligned_neon)
void x264_memzero_aligned_neon( void *dst, size_t n );
+#define x264_pixel_avg_16x16_neon x264_template(pixel_avg_16x16_neon)
void x264_pixel_avg_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_16x8_neon x264_template(pixel_avg_16x8_neon)
void x264_pixel_avg_16x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x16_neon x264_template(pixel_avg_8x16_neon)
void x264_pixel_avg_8x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x8_neon x264_template(pixel_avg_8x8_neon)
void x264_pixel_avg_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_8x4_neon x264_template(pixel_avg_8x4_neon)
void x264_pixel_avg_8x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x16_neon x264_template(pixel_avg_4x16_neon)
void x264_pixel_avg_4x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x8_neon x264_template(pixel_avg_4x8_neon)
void x264_pixel_avg_4x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x4_neon x264_template(pixel_avg_4x4_neon)
void x264_pixel_avg_4x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg_4x2_neon x264_template(pixel_avg_4x2_neon)
void x264_pixel_avg_4x2_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_pixel_avg2_w4_neon x264_template(pixel_avg2_w4_neon)
void x264_pixel_avg2_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w8_neon x264_template(pixel_avg2_w8_neon)
void x264_pixel_avg2_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w16_neon x264_template(pixel_avg2_w16_neon)
void x264_pixel_avg2_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_pixel_avg2_w20_neon x264_template(pixel_avg2_w20_neon)
void x264_pixel_avg2_w20_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int );
+#define x264_plane_copy_core_neon x264_template(plane_copy_core_neon)
void x264_plane_copy_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_neon x264_template(plane_copy_deinterleave_neon)
void x264_plane_copy_deinterleave_neon( pixel *dstu, intptr_t i_dstu,
pixel *dstv, intptr_t i_dstv,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_neon x264_template(plane_copy_deinterleave_rgb_neon)
void x264_plane_copy_deinterleave_rgb_neon( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_interleave_core_neon x264_template(plane_copy_interleave_core_neon)
void x264_plane_copy_interleave_core_neon( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_swap_core_neon x264_template(plane_copy_swap_core_neon)
void x264_plane_copy_swap_core_neon( pixel *dst, intptr_t i_dst,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_store_interleave_chroma_neon x264_template(store_interleave_chroma_neon)
void x264_store_interleave_chroma_neon( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_load_deinterleave_chroma_fdec_neon x264_template(load_deinterleave_chroma_fdec_neon)
void x264_load_deinterleave_chroma_fdec_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_neon x264_template(load_deinterleave_chroma_fenc_neon)
void x264_load_deinterleave_chroma_fenc_neon( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_mc_weight_w16_neon x264_template(mc_weight_w16_neon)
+#define x264_mc_weight_w16_nodenom_neon x264_template(mc_weight_w16_nodenom_neon)
+#define x264_mc_weight_w16_offsetadd_neon x264_template(mc_weight_w16_offsetadd_neon)
+#define x264_mc_weight_w16_offsetsub_neon x264_template(mc_weight_w16_offsetsub_neon)
+#define x264_mc_weight_w20_neon x264_template(mc_weight_w20_neon)
+#define x264_mc_weight_w20_nodenom_neon x264_template(mc_weight_w20_nodenom_neon)
+#define x264_mc_weight_w20_offsetadd_neon x264_template(mc_weight_w20_offsetadd_neon)
+#define x264_mc_weight_w20_offsetsub_neon x264_template(mc_weight_w20_offsetsub_neon)
+#define x264_mc_weight_w4_neon x264_template(mc_weight_w4_neon)
+#define x264_mc_weight_w4_nodenom_neon x264_template(mc_weight_w4_nodenom_neon)
+#define x264_mc_weight_w4_offsetadd_neon x264_template(mc_weight_w4_offsetadd_neon)
+#define x264_mc_weight_w4_offsetsub_neon x264_template(mc_weight_w4_offsetsub_neon)
+#define x264_mc_weight_w8_neon x264_template(mc_weight_w8_neon)
+#define x264_mc_weight_w8_nodenom_neon x264_template(mc_weight_w8_nodenom_neon)
+#define x264_mc_weight_w8_offsetadd_neon x264_template(mc_weight_w8_offsetadd_neon)
+#define x264_mc_weight_w8_offsetsub_neon x264_template(mc_weight_w8_offsetsub_neon)
#if !HIGH_BIT_DEPTH
#define MC_WEIGHT(func)\
void x264_mc_weight_w20##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\
MC_WEIGHT(_offsetsub)
#endif
+#define x264_mc_copy_w4_neon x264_template(mc_copy_w4_neon)
void x264_mc_copy_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w8_neon x264_template(mc_copy_w8_neon)
void x264_mc_copy_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w16_neon x264_template(mc_copy_w16_neon)
void x264_mc_copy_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_copy_w16_aligned_neon x264_template(mc_copy_w16_aligned_neon)
void x264_mc_copy_w16_aligned_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
+#define x264_mc_chroma_neon x264_template(mc_chroma_neon)
void x264_mc_chroma_neon( uint8_t *, uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, int, int );
+#define x264_frame_init_lowres_core_neon x264_template(frame_init_lowres_core_neon)
void x264_frame_init_lowres_core_neon( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, intptr_t, int, int );
+#define x264_hpel_filter_v_neon x264_template(hpel_filter_v_neon)
void x264_hpel_filter_v_neon( uint8_t *, uint8_t *, int16_t *, intptr_t, int );
+#define x264_hpel_filter_c_neon x264_template(hpel_filter_c_neon)
void x264_hpel_filter_c_neon( uint8_t *, int16_t *, int );
+#define x264_hpel_filter_h_neon x264_template(hpel_filter_h_neon)
void x264_hpel_filter_h_neon( uint8_t *, uint8_t *, int );
+#define x264_integral_init4h_neon x264_template(integral_init4h_neon)
void x264_integral_init4h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init4v_neon x264_template(integral_init4v_neon)
void x264_integral_init4v_neon( uint16_t *, uint16_t *, intptr_t );
+#define x264_integral_init8h_neon x264_template(integral_init8h_neon)
void x264_integral_init8h_neon( uint16_t *, uint8_t *, intptr_t );
+#define x264_integral_init8v_neon x264_template(integral_init8v_neon)
void x264_integral_init8v_neon( uint16_t *, intptr_t );
+#define x264_mbtree_propagate_cost_neon x264_template(mbtree_propagate_cost_neon)
void x264_mbtree_propagate_cost_neon( int16_t *, uint16_t *, uint16_t *, uint16_t *, uint16_t *, float *, int );
+#define x264_mbtree_fix8_pack_neon x264_template(mbtree_fix8_pack_neon)
void x264_mbtree_fix8_pack_neon( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_unpack_neon x264_template(mbtree_fix8_unpack_neon)
void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count );
#if !HIGH_BIT_DEPTH
PLANE_COPY(16, neon)
PLANE_COPY_SWAP(16, neon)
PLANE_INTERLEAVE(neon)
-#endif // !HIGH_BIT_DEPTH
-
PROPAGATE_LIST(neon)
+#endif // !HIGH_BIT_DEPTH
void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf )
{
#ifndef X264_ARM_MC_H
#define X264_ARM_MC_H
+#define x264_mc_init_arm x264_template(mc_init_arm)
void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf );
#endif
#ifndef X264_ARM_PIXEL_H
#define X264_ARM_PIXEL_H
+#define x264_pixel_avg2_w16_neon x264_template(pixel_avg2_w16_neon)
+#define x264_pixel_avg2_w20_neon x264_template(pixel_avg2_w20_neon)
+#define x264_pixel_avg2_w4_neon x264_template(pixel_avg2_w4_neon)
+#define x264_pixel_avg2_w8_neon x264_template(pixel_avg2_w8_neon)
+#define x264_pixel_avg_16x16_neon x264_template(pixel_avg_16x16_neon)
+#define x264_pixel_avg_16x8_neon x264_template(pixel_avg_16x8_neon)
+#define x264_pixel_avg_4x16_neon x264_template(pixel_avg_4x16_neon)
+#define x264_pixel_avg_4x2_neon x264_template(pixel_avg_4x2_neon)
+#define x264_pixel_avg_4x4_neon x264_template(pixel_avg_4x4_neon)
+#define x264_pixel_avg_4x8_neon x264_template(pixel_avg_4x8_neon)
+#define x264_pixel_avg_8x16_neon x264_template(pixel_avg_8x16_neon)
+#define x264_pixel_avg_8x4_neon x264_template(pixel_avg_8x4_neon)
+#define x264_pixel_avg_8x8_neon x264_template(pixel_avg_8x8_neon)
+#define x264_pixel_sad_16x16_neon x264_template(pixel_sad_16x16_neon)
+#define x264_pixel_sad_16x8_neon x264_template(pixel_sad_16x8_neon)
+#define x264_pixel_sad_4x4_armv6 x264_template(pixel_sad_4x4_armv6)
+#define x264_pixel_sad_4x4_neon x264_template(pixel_sad_4x4_neon)
+#define x264_pixel_sad_4x8_armv6 x264_template(pixel_sad_4x8_armv6)
+#define x264_pixel_sad_4x8_neon x264_template(pixel_sad_4x8_neon)
+#define x264_pixel_sad_8x16_neon x264_template(pixel_sad_8x16_neon)
+#define x264_pixel_sad_8x4_neon x264_template(pixel_sad_8x4_neon)
+#define x264_pixel_sad_8x8_neon x264_template(pixel_sad_8x8_neon)
+#define x264_pixel_sad_aligned_16x16_neon x264_template(pixel_sad_aligned_16x16_neon)
+#define x264_pixel_sad_aligned_16x16_neon_dual x264_template(pixel_sad_aligned_16x16_neon_dual)
+#define x264_pixel_sad_aligned_16x8_neon x264_template(pixel_sad_aligned_16x8_neon)
+#define x264_pixel_sad_aligned_16x8_neon_dual x264_template(pixel_sad_aligned_16x8_neon_dual)
+#define x264_pixel_sad_aligned_4x4_neon x264_template(pixel_sad_aligned_4x4_neon)
+#define x264_pixel_sad_aligned_4x8_neon x264_template(pixel_sad_aligned_4x8_neon)
+#define x264_pixel_sad_aligned_8x16_neon x264_template(pixel_sad_aligned_8x16_neon)
+#define x264_pixel_sad_aligned_8x16_neon_dual x264_template(pixel_sad_aligned_8x16_neon_dual)
+#define x264_pixel_sad_aligned_8x4_neon x264_template(pixel_sad_aligned_8x4_neon)
+#define x264_pixel_sad_aligned_8x4_neon_dual x264_template(pixel_sad_aligned_8x4_neon_dual)
+#define x264_pixel_sad_aligned_8x8_neon x264_template(pixel_sad_aligned_8x8_neon)
+#define x264_pixel_sad_aligned_8x8_neon_dual x264_template(pixel_sad_aligned_8x8_neon_dual)
+#define x264_pixel_sad_x3_16x16_neon x264_template(pixel_sad_x3_16x16_neon)
+#define x264_pixel_sad_x3_16x8_neon x264_template(pixel_sad_x3_16x8_neon)
+#define x264_pixel_sad_x3_4x4_neon x264_template(pixel_sad_x3_4x4_neon)
+#define x264_pixel_sad_x3_4x8_neon x264_template(pixel_sad_x3_4x8_neon)
+#define x264_pixel_sad_x3_8x16_neon x264_template(pixel_sad_x3_8x16_neon)
+#define x264_pixel_sad_x3_8x4_neon x264_template(pixel_sad_x3_8x4_neon)
+#define x264_pixel_sad_x3_8x8_neon x264_template(pixel_sad_x3_8x8_neon)
+#define x264_pixel_sad_x4_16x16_neon x264_template(pixel_sad_x4_16x16_neon)
+#define x264_pixel_sad_x4_16x8_neon x264_template(pixel_sad_x4_16x8_neon)
+#define x264_pixel_sad_x4_4x4_neon x264_template(pixel_sad_x4_4x4_neon)
+#define x264_pixel_sad_x4_4x8_neon x264_template(pixel_sad_x4_4x8_neon)
+#define x264_pixel_sad_x4_8x16_neon x264_template(pixel_sad_x4_8x16_neon)
+#define x264_pixel_sad_x4_8x4_neon x264_template(pixel_sad_x4_8x4_neon)
+#define x264_pixel_sad_x4_8x8_neon x264_template(pixel_sad_x4_8x8_neon)
+#define x264_pixel_satd_16x16_neon x264_template(pixel_satd_16x16_neon)
+#define x264_pixel_satd_16x8_neon x264_template(pixel_satd_16x8_neon)
+#define x264_pixel_satd_4x4_neon x264_template(pixel_satd_4x4_neon)
+#define x264_pixel_satd_4x8_neon x264_template(pixel_satd_4x8_neon)
+#define x264_pixel_satd_8x16_neon x264_template(pixel_satd_8x16_neon)
+#define x264_pixel_satd_8x4_neon x264_template(pixel_satd_8x4_neon)
+#define x264_pixel_satd_8x8_neon x264_template(pixel_satd_8x8_neon)
+#define x264_pixel_ssd_16x16_neon x264_template(pixel_ssd_16x16_neon)
+#define x264_pixel_ssd_16x8_neon x264_template(pixel_ssd_16x8_neon)
+#define x264_pixel_ssd_4x4_neon x264_template(pixel_ssd_4x4_neon)
+#define x264_pixel_ssd_4x8_neon x264_template(pixel_ssd_4x8_neon)
+#define x264_pixel_ssd_8x16_neon x264_template(pixel_ssd_8x16_neon)
+#define x264_pixel_ssd_8x4_neon x264_template(pixel_ssd_8x4_neon)
+#define x264_pixel_ssd_8x8_neon x264_template(pixel_ssd_8x8_neon)
#define DECL_PIXELS( ret, name, suffix, args ) \
ret x264_pixel_##name##_16x16_##suffix args;\
ret x264_pixel_##name##_16x8_##suffix args;\
DECL_X1( satd, neon )
DECL_X1( ssd, neon )
+#define x264_pixel_ssd_nv12_core_neon x264_template(pixel_ssd_nv12_core_neon)
void x264_pixel_ssd_nv12_core_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, uint64_t *, uint64_t * );
+#define x264_pixel_vsad_neon x264_template(pixel_vsad_neon)
int x264_pixel_vsad_neon( uint8_t *, intptr_t, int );
+#define x264_pixel_sa8d_8x8_neon x264_template(pixel_sa8d_8x8_neon)
int x264_pixel_sa8d_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_16x16_neon x264_template(pixel_sa8d_16x16_neon)
int x264_pixel_sa8d_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_sa8d_satd_16x16_neon x264_template(pixel_sa8d_satd_16x16_neon)
uint64_t x264_pixel_sa8d_satd_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t );
+#define x264_pixel_var_8x8_neon x264_template(pixel_var_8x8_neon)
uint64_t x264_pixel_var_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_8x16_neon x264_template(pixel_var_8x16_neon)
uint64_t x264_pixel_var_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_var_16x16_neon x264_template(pixel_var_16x16_neon)
uint64_t x264_pixel_var_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_var2_8x8_neon x264_template(pixel_var2_8x8_neon)
int x264_pixel_var2_8x8_neon ( uint8_t *, uint8_t *, int * );
+#define x264_pixel_var2_8x16_neon x264_template(pixel_var2_8x16_neon)
int x264_pixel_var2_8x16_neon( uint8_t *, uint8_t *, int * );
+#define x264_pixel_hadamard_ac_8x8_neon x264_template(pixel_hadamard_ac_8x8_neon)
uint64_t x264_pixel_hadamard_ac_8x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_8x16_neon x264_template(pixel_hadamard_ac_8x16_neon)
uint64_t x264_pixel_hadamard_ac_8x16_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x8_neon x264_template(pixel_hadamard_ac_16x8_neon)
uint64_t x264_pixel_hadamard_ac_16x8_neon ( uint8_t *, intptr_t );
+#define x264_pixel_hadamard_ac_16x16_neon x264_template(pixel_hadamard_ac_16x16_neon)
uint64_t x264_pixel_hadamard_ac_16x16_neon( uint8_t *, intptr_t );
+#define x264_pixel_ssim_4x4x2_core_neon x264_template(pixel_ssim_4x4x2_core_neon)
void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t,
const uint8_t *, intptr_t,
int sums[2][4] );
+#define x264_pixel_ssim_end4_neon x264_template(pixel_ssim_end4_neon)
float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_asd8_neon x264_template(pixel_asd8_neon)
int x264_pixel_asd8_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int );
#endif
#ifndef X264_ARM_PREDICT_H
#define X264_ARM_PREDICT_H
+#define x264_predict_4x4_dc_armv6 x264_template(predict_4x4_dc_armv6)
void x264_predict_4x4_dc_armv6( uint8_t *src );
+#define x264_predict_4x4_dc_top_neon x264_template(predict_4x4_dc_top_neon)
void x264_predict_4x4_dc_top_neon( uint8_t *src );
+#define x264_predict_4x4_v_armv6 x264_template(predict_4x4_v_armv6)
void x264_predict_4x4_v_armv6( uint8_t *src );
+#define x264_predict_4x4_h_armv6 x264_template(predict_4x4_h_armv6)
void x264_predict_4x4_h_armv6( uint8_t *src );
+#define x264_predict_4x4_ddr_armv6 x264_template(predict_4x4_ddr_armv6)
void x264_predict_4x4_ddr_armv6( uint8_t *src );
+#define x264_predict_4x4_ddl_neon x264_template(predict_4x4_ddl_neon)
void x264_predict_4x4_ddl_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_neon x264_template(predict_8x8c_dc_neon)
void x264_predict_8x8c_dc_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_top_neon x264_template(predict_8x8c_dc_top_neon)
void x264_predict_8x8c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x8c_dc_left_neon x264_template(predict_8x8c_dc_left_neon)
void x264_predict_8x8c_dc_left_neon( uint8_t *src );
+#define x264_predict_8x8c_h_neon x264_template(predict_8x8c_h_neon)
void x264_predict_8x8c_h_neon( uint8_t *src );
+#define x264_predict_8x8c_v_neon x264_template(predict_8x8c_v_neon)
void x264_predict_8x8c_v_neon( uint8_t *src );
+#define x264_predict_8x8c_p_neon x264_template(predict_8x8c_p_neon)
void x264_predict_8x8c_p_neon( uint8_t *src );
+#define x264_predict_8x16c_h_neon x264_template(predict_8x16c_h_neon)
void x264_predict_8x16c_h_neon( uint8_t *src );
+#define x264_predict_8x16c_dc_top_neon x264_template(predict_8x16c_dc_top_neon)
void x264_predict_8x16c_dc_top_neon( uint8_t *src );
+#define x264_predict_8x16c_p_neon x264_template(predict_8x16c_p_neon)
void x264_predict_8x16c_p_neon( uint8_t *src );
+#define x264_predict_8x8_dc_neon x264_template(predict_8x8_dc_neon)
void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddl_neon x264_template(predict_8x8_ddl_neon)
void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddr_neon x264_template(predict_8x8_ddr_neon)
void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vl_neon x264_template(predict_8x8_vl_neon)
void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_neon x264_template(predict_8x8_vr_neon)
void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_v_neon x264_template(predict_8x8_v_neon)
void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_h_neon x264_template(predict_8x8_h_neon)
void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hd_neon x264_template(predict_8x8_hd_neon)
void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hu_neon x264_template(predict_8x8_hu_neon)
void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_16x16_dc_neon x264_template(predict_16x16_dc_neon)
void x264_predict_16x16_dc_neon( uint8_t *src );
+#define x264_predict_16x16_dc_top_neon x264_template(predict_16x16_dc_top_neon)
void x264_predict_16x16_dc_top_neon( uint8_t *src );
+#define x264_predict_16x16_dc_left_neon x264_template(predict_16x16_dc_left_neon)
void x264_predict_16x16_dc_left_neon( uint8_t *src );
+#define x264_predict_16x16_h_neon x264_template(predict_16x16_h_neon)
void x264_predict_16x16_h_neon( uint8_t *src );
+#define x264_predict_16x16_v_neon x264_template(predict_16x16_v_neon)
void x264_predict_16x16_v_neon( uint8_t *src );
+#define x264_predict_16x16_p_neon x264_template(predict_16x16_p_neon)
void x264_predict_16x16_p_neon( uint8_t *src );
+#define x264_predict_4x4_init_arm x264_template(predict_4x4_init_arm)
void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init_arm x264_template(predict_8x8_init_arm)
void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
+#define x264_predict_8x8c_init_arm x264_template(predict_8x8c_init_arm)
void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init_arm x264_template(predict_8x16c_init_arm)
void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] );
+#define x264_predict_16x16_init_arm x264_template(predict_16x16_init_arm)
void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] );
#endif
lsr r1, r1, #2
.endif
rbit r1, r1
- movrelx r3, X(decimate_table4), r2
+ movrelx r3, X264(decimate_table4), r2
1:
clz r2, r1
lsl r1, r1, r2
mvn r12, r12
mov r0, #0
mov lr, #32
- movrelx r3, X(decimate_table8), r2
+ movrelx r3, X264(decimate_table8), r2
beq 2f
1:
clz r2, r1
#ifndef X264_ARM_QUANT_H
#define X264_ARM_QUANT_H
+#define x264_quant_2x2_dc_armv6 x264_template(quant_2x2_dc_armv6)
int x264_quant_2x2_dc_armv6( int16_t dct[4], int mf, int bias );
+#define x264_quant_2x2_dc_neon x264_template(quant_2x2_dc_neon)
int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_neon x264_template(quant_4x4_dc_neon)
int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias );
+#define x264_quant_4x4_neon x264_template(quant_4x4_neon)
int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_4x4x4_neon x264_template(quant_4x4x4_neon)
int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_8x8_neon x264_template(quant_8x8_neon)
int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] );
+#define x264_dequant_4x4_dc_neon x264_template(dequant_4x4_dc_neon)
void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4_neon x264_template(dequant_4x4_neon)
void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_neon x264_template(dequant_8x8_neon)
void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_decimate_score15_neon x264_template(decimate_score15_neon)
int x264_decimate_score15_neon( int16_t * );
+#define x264_decimate_score16_neon x264_template(decimate_score16_neon)
int x264_decimate_score16_neon( int16_t * );
+#define x264_decimate_score64_neon x264_template(decimate_score64_neon)
int x264_decimate_score64_neon( int16_t * );
+#define x264_coeff_last4_arm x264_template(coeff_last4_arm)
int x264_coeff_last4_arm( int16_t * );
+#define x264_coeff_last8_arm x264_template(coeff_last8_arm)
int x264_coeff_last8_arm( int16_t * );
+#define x264_coeff_last15_neon x264_template(coeff_last15_neon)
int x264_coeff_last15_neon( int16_t * );
+#define x264_coeff_last16_neon x264_template(coeff_last16_neon)
int x264_coeff_last16_neon( int16_t * );
+#define x264_coeff_last64_neon x264_template(coeff_last64_neon)
int x264_coeff_last64_neon( int16_t * );
+#define x264_denoise_dct_neon x264_template(denoise_dct_neon)
void x264_denoise_dct_neon( dctcoef *, uint32_t *, udctcoef *, int );
#endif
--- /dev/null
+/*****************************************************************************
+ * base.c: misc common functions (bit depth independent)
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Loren Merritt <lorenm@u.washington.edu>
+ * Laurent Aimar <fenrir@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#include "base.h"
+
+#include <ctype.h>
+
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_THP
+#include <sys/mman.h>
+#endif
+
+/****************************************************************************
+ * x264_reduce_fraction:
+ ****************************************************************************/
+#define REDUCE_FRACTION( name, type )\
+void name( type *n, type *d )\
+{ \
+ type a = *n; \
+ type b = *d; \
+ type c; \
+ if( !a || !b ) \
+ return; \
+ c = a % b; \
+ while( c ) \
+ { \
+ a = b; \
+ b = c; \
+ c = a % b; \
+ } \
+ *n /= b; \
+ *d /= b; \
+}
+
+REDUCE_FRACTION( x264_reduce_fraction , uint32_t )
+REDUCE_FRACTION( x264_reduce_fraction64, uint64_t )
+
+/****************************************************************************
+ * x264_log:
+ ****************************************************************************/
+void x264_log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg )
+{
+ char *psz_prefix;
+ switch( i_level )
+ {
+ case X264_LOG_ERROR:
+ psz_prefix = "error";
+ break;
+ case X264_LOG_WARNING:
+ psz_prefix = "warning";
+ break;
+ case X264_LOG_INFO:
+ psz_prefix = "info";
+ break;
+ case X264_LOG_DEBUG:
+ psz_prefix = "debug";
+ break;
+ default:
+ psz_prefix = "unknown";
+ break;
+ }
+ fprintf( stderr, "x264 [%s]: ", psz_prefix );
+ x264_vfprintf( stderr, psz_fmt, arg );
+}
+
+void x264_log_internal( int i_level, const char *psz_fmt, ... )
+{
+ va_list arg;
+ va_start( arg, psz_fmt );
+ x264_log_default( NULL, i_level, psz_fmt, arg );
+ va_end( arg );
+}
+
+/****************************************************************************
+ * x264_malloc:
+ ****************************************************************************/
+void *x264_malloc( int i_size )
+{
+ uint8_t *align_buf = NULL;
+#if HAVE_MALLOC_H
+#if HAVE_THP
+#define HUGE_PAGE_SIZE 2*1024*1024
+#define HUGE_PAGE_THRESHOLD HUGE_PAGE_SIZE*7/8 /* FIXME: Is this optimal? */
+ /* Attempt to allocate huge pages to reduce TLB misses. */
+ if( i_size >= HUGE_PAGE_THRESHOLD )
+ {
+ align_buf = memalign( HUGE_PAGE_SIZE, i_size );
+ if( align_buf )
+ {
+ /* Round up to the next huge page boundary if we are close enough. */
+ size_t madv_size = (i_size + HUGE_PAGE_SIZE - HUGE_PAGE_THRESHOLD) & ~(HUGE_PAGE_SIZE-1);
+ madvise( align_buf, madv_size, MADV_HUGEPAGE );
+ }
+ }
+ else
+#undef HUGE_PAGE_SIZE
+#undef HUGE_PAGE_THRESHOLD
+#endif
+ align_buf = memalign( NATIVE_ALIGN, i_size );
+#else
+ uint8_t *buf = malloc( i_size + (NATIVE_ALIGN-1) + sizeof(void **) );
+ if( buf )
+ {
+ align_buf = buf + (NATIVE_ALIGN-1) + sizeof(void **);
+ align_buf -= (intptr_t) align_buf & (NATIVE_ALIGN-1);
+ *( (void **) ( align_buf - sizeof(void **) ) ) = buf;
+ }
+#endif
+ if( !align_buf )
+ x264_log_internal( X264_LOG_ERROR, "malloc of size %d failed\n", i_size );
+ return align_buf;
+}
+
+/****************************************************************************
+ * x264_free:
+ ****************************************************************************/
+void x264_free( void *p )
+{
+ if( p )
+ {
+#if HAVE_MALLOC_H
+ free( p );
+#else
+ free( *( ( ( void **) p ) - 1 ) );
+#endif
+ }
+}
+
+/****************************************************************************
+ * x264_slurp_file:
+ ****************************************************************************/
+char *x264_slurp_file( const char *filename )
+{
+ int b_error = 0;
+ int64_t i_size;
+ char *buf;
+ FILE *fh = x264_fopen( filename, "rb" );
+ if( !fh )
+ return NULL;
+
+ b_error |= fseek( fh, 0, SEEK_END ) < 0;
+ b_error |= ( i_size = ftell( fh ) ) <= 0;
+ if( WORD_SIZE == 4 )
+ b_error |= i_size > INT32_MAX;
+ b_error |= fseek( fh, 0, SEEK_SET ) < 0;
+ if( b_error )
+ goto error;
+
+ buf = x264_malloc( i_size+2 );
+ if( !buf )
+ goto error;
+
+ b_error |= fread( buf, 1, i_size, fh ) != i_size;
+ fclose( fh );
+ if( b_error )
+ {
+ x264_free( buf );
+ return NULL;
+ }
+
+ if( buf[i_size-1] != '\n' )
+ buf[i_size++] = '\n';
+ buf[i_size] = '\0';
+
+ return buf;
+error:
+ fclose( fh );
+ return NULL;
+}
+
+/****************************************************************************
+ * x264_picture_init:
+ ****************************************************************************/
+void x264_picture_init( x264_picture_t *pic )
+{
+ memset( pic, 0, sizeof( x264_picture_t ) );
+ pic->i_type = X264_TYPE_AUTO;
+ pic->i_qpplus1 = X264_QP_AUTO;
+ pic->i_pic_struct = PIC_STRUCT_AUTO;
+}
+
+/****************************************************************************
+ * x264_picture_alloc:
+ ****************************************************************************/
+int x264_picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height )
+{
+ typedef struct
+ {
+ int planes;
+ int width_fix8[3];
+ int height_fix8[3];
+ } x264_csp_tab_t;
+
+ static const x264_csp_tab_t csp_tab[] =
+ {
+ [X264_CSP_I420] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
+ [X264_CSP_YV12] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
+ [X264_CSP_NV12] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, },
+ [X264_CSP_NV21] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, },
+ [X264_CSP_I422] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } },
+ [X264_CSP_YV16] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } },
+ [X264_CSP_NV16] = { 2, { 256*1, 256*1 }, { 256*1, 256*1 }, },
+ [X264_CSP_YUYV] = { 1, { 256*2 }, { 256*1 }, },
+ [X264_CSP_UYVY] = { 1, { 256*2 }, { 256*1 }, },
+ [X264_CSP_I444] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } },
+ [X264_CSP_YV24] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } },
+ [X264_CSP_BGR] = { 1, { 256*3 }, { 256*1 }, },
+ [X264_CSP_BGRA] = { 1, { 256*4 }, { 256*1 }, },
+ [X264_CSP_RGB] = { 1, { 256*3 }, { 256*1 }, },
+ };
+
+ int csp = i_csp & X264_CSP_MASK;
+ if( csp <= X264_CSP_NONE || csp >= X264_CSP_MAX || csp == X264_CSP_V210 )
+ return -1;
+ x264_picture_init( pic );
+ pic->img.i_csp = i_csp;
+ pic->img.i_plane = csp_tab[csp].planes;
+ int depth_factor = i_csp & X264_CSP_HIGH_DEPTH ? 2 : 1;
+ int plane_offset[3] = {0};
+ int frame_size = 0;
+ for( int i = 0; i < pic->img.i_plane; i++ )
+ {
+ int stride = (((int64_t)i_width * csp_tab[csp].width_fix8[i]) >> 8) * depth_factor;
+ int plane_size = (((int64_t)i_height * csp_tab[csp].height_fix8[i]) >> 8) * stride;
+ pic->img.i_stride[i] = stride;
+ plane_offset[i] = frame_size;
+ frame_size += plane_size;
+ }
+ pic->img.plane[0] = x264_malloc( frame_size );
+ if( !pic->img.plane[0] )
+ return -1;
+ for( int i = 1; i < pic->img.i_plane; i++ )
+ pic->img.plane[i] = pic->img.plane[0] + plane_offset[i];
+ return 0;
+}
+
+/****************************************************************************
+ * x264_picture_clean:
+ ****************************************************************************/
+void x264_picture_clean( x264_picture_t *pic )
+{
+ x264_free( pic->img.plane[0] );
+
+ /* just to be safe */
+ memset( pic, 0, sizeof( x264_picture_t ) );
+}
+
+/****************************************************************************
+ * x264_param_default:
+ ****************************************************************************/
+void x264_param_default( x264_param_t *param )
+{
+ /* */
+ memset( param, 0, sizeof( x264_param_t ) );
+
+ /* CPU autodetect */
+ param->cpu = x264_cpu_detect();
+ param->i_threads = X264_THREADS_AUTO;
+ param->i_lookahead_threads = X264_THREADS_AUTO;
+ param->b_deterministic = 1;
+ param->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
+
+ /* Video properties */
+ param->i_csp = X264_CHROMA_FORMAT ? X264_CHROMA_FORMAT : X264_CSP_I420;
+ param->i_width = 0;
+ param->i_height = 0;
+ param->vui.i_sar_width = 0;
+ param->vui.i_sar_height= 0;
+ param->vui.i_overscan = 0; /* undef */
+ param->vui.i_vidformat = 5; /* undef */
+ param->vui.b_fullrange = -1; /* default depends on input */
+ param->vui.i_colorprim = 2; /* undef */
+ param->vui.i_transfer = 2; /* undef */
+ param->vui.i_colmatrix = -1; /* default depends on input */
+ param->vui.i_chroma_loc= 0; /* left center */
+ param->i_fps_num = 25;
+ param->i_fps_den = 1;
+ param->i_level_idc = -1;
+ param->i_slice_max_size = 0;
+ param->i_slice_max_mbs = 0;
+ param->i_slice_count = 0;
+#if HAVE_BITDEPTH8
+ param->i_bitdepth = 8;
+#elif HAVE_BITDEPTH10
+ param->i_bitdepth = 10;
+#else
+ param->i_bitdepth = 8;
+#endif
+
+ /* Encoder parameters */
+ param->i_frame_reference = 3;
+ param->i_keyint_max = 250;
+ param->i_keyint_min = X264_KEYINT_MIN_AUTO;
+ param->i_bframe = 3;
+ param->i_scenecut_threshold = 40;
+ param->i_bframe_adaptive = X264_B_ADAPT_FAST;
+ param->i_bframe_bias = 0;
+ param->i_bframe_pyramid = X264_B_PYRAMID_NORMAL;
+ param->b_interlaced = 0;
+ param->b_constrained_intra = 0;
+
+ param->b_deblocking_filter = 1;
+ param->i_deblocking_filter_alphac0 = 0;
+ param->i_deblocking_filter_beta = 0;
+
+ param->b_cabac = 1;
+ param->i_cabac_init_idc = 0;
+
+ param->rc.i_rc_method = X264_RC_CRF;
+ param->rc.i_bitrate = 0;
+ param->rc.f_rate_tolerance = 1.0;
+ param->rc.i_vbv_max_bitrate = 0;
+ param->rc.i_vbv_buffer_size = 0;
+ param->rc.f_vbv_buffer_init = 0.9;
+ param->rc.i_qp_constant = -1;
+ param->rc.f_rf_constant = 23;
+ param->rc.i_qp_min = 0;
+ param->rc.i_qp_max = INT_MAX;
+ param->rc.i_qp_step = 4;
+ param->rc.f_ip_factor = 1.4;
+ param->rc.f_pb_factor = 1.3;
+ param->rc.i_aq_mode = X264_AQ_VARIANCE;
+ param->rc.f_aq_strength = 1.0;
+ param->rc.i_lookahead = 40;
+
+ param->rc.b_stat_write = 0;
+ param->rc.psz_stat_out = "x264_2pass.log";
+ param->rc.b_stat_read = 0;
+ param->rc.psz_stat_in = "x264_2pass.log";
+ param->rc.f_qcompress = 0.6;
+ param->rc.f_qblur = 0.5;
+ param->rc.f_complexity_blur = 20;
+ param->rc.i_zones = 0;
+ param->rc.b_mb_tree = 1;
+
+ /* Log */
+ param->pf_log = x264_log_default;
+ param->p_log_private = NULL;
+ param->i_log_level = X264_LOG_INFO;
+
+ /* */
+ param->analyse.intra = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8;
+ param->analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8
+ | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_BSUB16x16;
+ param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
+ param->analyse.i_me_method = X264_ME_HEX;
+ param->analyse.f_psy_rd = 1.0;
+ param->analyse.b_psy = 1;
+ param->analyse.f_psy_trellis = 0;
+ param->analyse.i_me_range = 16;
+ param->analyse.i_subpel_refine = 7;
+ param->analyse.b_mixed_references = 1;
+ param->analyse.b_chroma_me = 1;
+ param->analyse.i_mv_range_thread = -1;
+ param->analyse.i_mv_range = -1; // set from level_idc
+ param->analyse.i_chroma_qp_offset = 0;
+ param->analyse.b_fast_pskip = 1;
+ param->analyse.b_weighted_bipred = 1;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_SMART;
+ param->analyse.b_dct_decimate = 1;
+ param->analyse.b_transform_8x8 = 1;
+ param->analyse.i_trellis = 1;
+ param->analyse.i_luma_deadzone[0] = 21;
+ param->analyse.i_luma_deadzone[1] = 11;
+ param->analyse.b_psnr = 0;
+ param->analyse.b_ssim = 0;
+
+ param->i_cqm_preset = X264_CQM_FLAT;
+ memset( param->cqm_4iy, 16, sizeof( param->cqm_4iy ) );
+ memset( param->cqm_4py, 16, sizeof( param->cqm_4py ) );
+ memset( param->cqm_4ic, 16, sizeof( param->cqm_4ic ) );
+ memset( param->cqm_4pc, 16, sizeof( param->cqm_4pc ) );
+ memset( param->cqm_8iy, 16, sizeof( param->cqm_8iy ) );
+ memset( param->cqm_8py, 16, sizeof( param->cqm_8py ) );
+ memset( param->cqm_8ic, 16, sizeof( param->cqm_8ic ) );
+ memset( param->cqm_8pc, 16, sizeof( param->cqm_8pc ) );
+
+ param->b_repeat_headers = 1;
+ param->b_annexb = 1;
+ param->b_aud = 0;
+ param->b_vfr_input = 1;
+ param->i_nal_hrd = X264_NAL_HRD_NONE;
+ param->b_tff = 1;
+ param->b_pic_struct = 0;
+ param->b_fake_interlaced = 0;
+ param->i_frame_packing = -1;
+ param->b_opencl = 0;
+ param->i_opencl_device = 0;
+ param->opencl_device_id = NULL;
+ param->psz_clbin_file = NULL;
+}
+
+static int param_apply_preset( x264_param_t *param, const char *preset )
+{
+ char *end;
+ int i = strtol( preset, &end, 10 );
+ if( *end == 0 && i >= 0 && i < sizeof(x264_preset_names)/sizeof(*x264_preset_names)-1 )
+ preset = x264_preset_names[i];
+
+ if( !strcasecmp( preset, "ultrafast" ) )
+ {
+ param->i_frame_reference = 1;
+ param->i_scenecut_threshold = 0;
+ param->b_deblocking_filter = 0;
+ param->b_cabac = 0;
+ param->i_bframe = 0;
+ param->analyse.intra = 0;
+ param->analyse.inter = 0;
+ param->analyse.b_transform_8x8 = 0;
+ param->analyse.i_me_method = X264_ME_DIA;
+ param->analyse.i_subpel_refine = 0;
+ param->rc.i_aq_mode = 0;
+ param->analyse.b_mixed_references = 0;
+ param->i_bframe_adaptive = X264_B_ADAPT_NONE;
+ param->rc.b_mb_tree = 0;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
+ param->analyse.b_weighted_bipred = 0;
+ param->rc.i_lookahead = 0;
+ }
+ else if( !strcasecmp( preset, "superfast" ) )
+ {
+ param->analyse.inter = X264_ANALYSE_I8x8|X264_ANALYSE_I4x4;
+ param->analyse.i_me_method = X264_ME_DIA;
+ param->analyse.i_subpel_refine = 1;
+ param->i_frame_reference = 1;
+ param->analyse.b_mixed_references = 0;
+ param->analyse.i_trellis = 0;
+ param->rc.b_mb_tree = 0;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
+ param->rc.i_lookahead = 0;
+ }
+ else if( !strcasecmp( preset, "veryfast" ) )
+ {
+ param->analyse.i_subpel_refine = 2;
+ param->i_frame_reference = 1;
+ param->analyse.b_mixed_references = 0;
+ param->analyse.i_trellis = 0;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
+ param->rc.i_lookahead = 10;
+ }
+ else if( !strcasecmp( preset, "faster" ) )
+ {
+ param->analyse.b_mixed_references = 0;
+ param->i_frame_reference = 2;
+ param->analyse.i_subpel_refine = 4;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
+ param->rc.i_lookahead = 20;
+ }
+ else if( !strcasecmp( preset, "fast" ) )
+ {
+ param->i_frame_reference = 2;
+ param->analyse.i_subpel_refine = 6;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
+ param->rc.i_lookahead = 30;
+ }
+ else if( !strcasecmp( preset, "medium" ) )
+ {
+ /* Default is medium */
+ }
+ else if( !strcasecmp( preset, "slow" ) )
+ {
+ param->analyse.i_subpel_refine = 8;
+ param->i_frame_reference = 5;
+ param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
+ param->analyse.i_trellis = 2;
+ param->rc.i_lookahead = 50;
+ }
+ else if( !strcasecmp( preset, "slower" ) )
+ {
+ param->analyse.i_me_method = X264_ME_UMH;
+ param->analyse.i_subpel_refine = 9;
+ param->i_frame_reference = 8;
+ param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
+ param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
+ param->analyse.inter |= X264_ANALYSE_PSUB8x8;
+ param->analyse.i_trellis = 2;
+ param->rc.i_lookahead = 60;
+ }
+ else if( !strcasecmp( preset, "veryslow" ) )
+ {
+ param->analyse.i_me_method = X264_ME_UMH;
+ param->analyse.i_subpel_refine = 10;
+ param->analyse.i_me_range = 24;
+ param->i_frame_reference = 16;
+ param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
+ param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
+ param->analyse.inter |= X264_ANALYSE_PSUB8x8;
+ param->analyse.i_trellis = 2;
+ param->i_bframe = 8;
+ param->rc.i_lookahead = 60;
+ }
+ else if( !strcasecmp( preset, "placebo" ) )
+ {
+ param->analyse.i_me_method = X264_ME_TESA;
+ param->analyse.i_subpel_refine = 11;
+ param->analyse.i_me_range = 24;
+ param->i_frame_reference = 16;
+ param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
+ param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
+ param->analyse.inter |= X264_ANALYSE_PSUB8x8;
+ param->analyse.b_fast_pskip = 0;
+ param->analyse.i_trellis = 2;
+ param->i_bframe = 16;
+ param->rc.i_lookahead = 60;
+ }
+ else
+ {
+ x264_log_internal( X264_LOG_ERROR, "invalid preset '%s'\n", preset );
+ return -1;
+ }
+ return 0;
+}
+
+static int param_apply_tune( x264_param_t *param, const char *tune )
+{
+ char *tmp = x264_malloc( strlen( tune ) + 1 );
+ if( !tmp )
+ return -1;
+ tmp = strcpy( tmp, tune );
+ char *s = strtok( tmp, ",./-+" );
+ int psy_tuning_used = 0;
+ while( s )
+ {
+ if( !strncasecmp( s, "film", 4 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->i_deblocking_filter_alphac0 = -1;
+ param->i_deblocking_filter_beta = -1;
+ param->analyse.f_psy_trellis = 0.15;
+ }
+ else if( !strncasecmp( s, "animation", 9 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1;
+ param->i_deblocking_filter_alphac0 = 1;
+ param->i_deblocking_filter_beta = 1;
+ param->analyse.f_psy_rd = 0.4;
+ param->rc.f_aq_strength = 0.6;
+ param->i_bframe += 2;
+ }
+ else if( !strncasecmp( s, "grain", 5 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->i_deblocking_filter_alphac0 = -2;
+ param->i_deblocking_filter_beta = -2;
+ param->analyse.f_psy_trellis = 0.25;
+ param->analyse.b_dct_decimate = 0;
+ param->rc.f_pb_factor = 1.1;
+ param->rc.f_ip_factor = 1.1;
+ param->rc.f_aq_strength = 0.5;
+ param->analyse.i_luma_deadzone[0] = 6;
+ param->analyse.i_luma_deadzone[1] = 6;
+ param->rc.f_qcompress = 0.8;
+ }
+ else if( !strncasecmp( s, "stillimage", 10 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->i_deblocking_filter_alphac0 = -3;
+ param->i_deblocking_filter_beta = -3;
+ param->analyse.f_psy_rd = 2.0;
+ param->analyse.f_psy_trellis = 0.7;
+ param->rc.f_aq_strength = 1.2;
+ }
+ else if( !strncasecmp( s, "psnr", 4 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->rc.i_aq_mode = X264_AQ_NONE;
+ param->analyse.b_psy = 0;
+ }
+ else if( !strncasecmp( s, "ssim", 4 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->rc.i_aq_mode = X264_AQ_AUTOVARIANCE;
+ param->analyse.b_psy = 0;
+ }
+ else if( !strncasecmp( s, "fastdecode", 10 ) )
+ {
+ param->b_deblocking_filter = 0;
+ param->b_cabac = 0;
+ param->analyse.b_weighted_bipred = 0;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
+ }
+ else if( !strncasecmp( s, "zerolatency", 11 ) )
+ {
+ param->rc.i_lookahead = 0;
+ param->i_sync_lookahead = 0;
+ param->i_bframe = 0;
+ param->b_sliced_threads = 1;
+ param->b_vfr_input = 0;
+ param->rc.b_mb_tree = 0;
+ }
+ else if( !strncasecmp( s, "touhou", 6 ) )
+ {
+ if( psy_tuning_used++ ) goto psy_failure;
+ param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1;
+ param->i_deblocking_filter_alphac0 = -1;
+ param->i_deblocking_filter_beta = -1;
+ param->analyse.f_psy_trellis = 0.2;
+ param->rc.f_aq_strength = 1.3;
+ if( param->analyse.inter & X264_ANALYSE_PSUB16x16 )
+ param->analyse.inter |= X264_ANALYSE_PSUB8x8;
+ }
+ else
+ {
+ x264_log_internal( X264_LOG_ERROR, "invalid tune '%s'\n", s );
+ x264_free( tmp );
+ return -1;
+ }
+ if( 0 )
+ {
+ psy_failure:
+ x264_log_internal( X264_LOG_WARNING, "only 1 psy tuning can be used: ignoring tune %s\n", s );
+ }
+ s = strtok( NULL, ",./-+" );
+ }
+ x264_free( tmp );
+ return 0;
+}
+
+int x264_param_default_preset( x264_param_t *param, const char *preset, const char *tune )
+{
+ x264_param_default( param );
+
+ if( preset && param_apply_preset( param, preset ) < 0 )
+ return -1;
+ if( tune && param_apply_tune( param, tune ) < 0 )
+ return -1;
+ return 0;
+}
+
+void x264_param_apply_fastfirstpass( x264_param_t *param )
+{
+ /* Set faster options in case of turbo firstpass. */
+ if( param->rc.b_stat_write && !param->rc.b_stat_read )
+ {
+ param->i_frame_reference = 1;
+ param->analyse.b_transform_8x8 = 0;
+ param->analyse.inter = 0;
+ param->analyse.i_me_method = X264_ME_DIA;
+ param->analyse.i_subpel_refine = X264_MIN( 2, param->analyse.i_subpel_refine );
+ param->analyse.i_trellis = 0;
+ param->analyse.b_fast_pskip = 1;
+ }
+}
+
+static int profile_string_to_int( const char *str )
+{
+ if( !strcasecmp( str, "baseline" ) )
+ return PROFILE_BASELINE;
+ if( !strcasecmp( str, "main" ) )
+ return PROFILE_MAIN;
+ if( !strcasecmp( str, "high" ) )
+ return PROFILE_HIGH;
+ if( !strcasecmp( str, "high10" ) )
+ return PROFILE_HIGH10;
+ if( !strcasecmp( str, "high422" ) )
+ return PROFILE_HIGH422;
+ if( !strcasecmp( str, "high444" ) )
+ return PROFILE_HIGH444_PREDICTIVE;
+ return -1;
+}
+
+int x264_param_apply_profile( x264_param_t *param, const char *profile )
+{
+ if( !profile )
+ return 0;
+
+ const int qp_bd_offset = 6 * (param->i_bitdepth-8);
+ int p = profile_string_to_int( profile );
+ if( p < 0 )
+ {
+ x264_log_internal( X264_LOG_ERROR, "invalid profile: %s\n", profile );
+ return -1;
+ }
+ if( p < PROFILE_HIGH444_PREDICTIVE && ((param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant <= 0) ||
+ (param->rc.i_rc_method == X264_RC_CRF && (int)(param->rc.f_rf_constant + qp_bd_offset) <= 0)) )
+ {
+ x264_log_internal( X264_LOG_ERROR, "%s profile doesn't support lossless\n", profile );
+ return -1;
+ }
+ if( p < PROFILE_HIGH444_PREDICTIVE && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I444 )
+ {
+ x264_log_internal( X264_LOG_ERROR, "%s profile doesn't support 4:4:4\n", profile );
+ return -1;
+ }
+ if( p < PROFILE_HIGH422 && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I422 )
+ {
+ x264_log_internal( X264_LOG_ERROR, "%s profile doesn't support 4:2:2\n", profile );
+ return -1;
+ }
+ if( p < PROFILE_HIGH10 && param->i_bitdepth > 8 )
+ {
+ x264_log_internal( X264_LOG_ERROR, "%s profile doesn't support a bit depth of %d\n", profile, param->i_bitdepth );
+ return -1;
+ }
+
+ if( p == PROFILE_BASELINE )
+ {
+ param->analyse.b_transform_8x8 = 0;
+ param->b_cabac = 0;
+ param->i_cqm_preset = X264_CQM_FLAT;
+ param->psz_cqm_file = NULL;
+ param->i_bframe = 0;
+ param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
+ if( param->b_interlaced )
+ {
+ x264_log_internal( X264_LOG_ERROR, "baseline profile doesn't support interlacing\n" );
+ return -1;
+ }
+ if( param->b_fake_interlaced )
+ {
+ x264_log_internal( X264_LOG_ERROR, "baseline profile doesn't support fake interlacing\n" );
+ return -1;
+ }
+ }
+ else if( p == PROFILE_MAIN )
+ {
+ param->analyse.b_transform_8x8 = 0;
+ param->i_cqm_preset = X264_CQM_FLAT;
+ param->psz_cqm_file = NULL;
+ }
+ return 0;
+}
+
+static int parse_enum( const char *arg, const char * const *names, int *dst )
+{
+ for( int i = 0; names[i]; i++ )
+ if( !strcasecmp( arg, names[i] ) )
+ {
+ *dst = i;
+ return 0;
+ }
+ return -1;
+}
+
+static int parse_cqm( const char *str, uint8_t *cqm, int length )
+{
+ int i = 0;
+ do {
+ int coef;
+ if( !sscanf( str, "%d", &coef ) || coef < 1 || coef > 255 )
+ return -1;
+ cqm[i++] = coef;
+ } while( i < length && (str = strchr( str, ',' )) && str++ );
+ return (i == length) ? 0 : -1;
+}
+
+static int atobool_internal( const char *str, int *b_error )
+{
+ if( !strcmp(str, "1") ||
+ !strcasecmp(str, "true") ||
+ !strcasecmp(str, "yes") )
+ return 1;
+ if( !strcmp(str, "0") ||
+ !strcasecmp(str, "false") ||
+ !strcasecmp(str, "no") )
+ return 0;
+ *b_error = 1;
+ return 0;
+}
+
+static int atoi_internal( const char *str, int *b_error )
+{
+ char *end;
+ int v = strtol( str, &end, 0 );
+ if( end == str || *end != '\0' )
+ *b_error = 1;
+ return v;
+}
+
+static double atof_internal( const char *str, int *b_error )
+{
+ char *end;
+ double v = strtod( str, &end );
+ if( end == str || *end != '\0' )
+ *b_error = 1;
+ return v;
+}
+
+#define atobool(str) ( name_was_bool = 1, atobool_internal( str, &b_error ) )
+#undef atoi
+#undef atof
+#define atoi(str) atoi_internal( str, &b_error )
+#define atof(str) atof_internal( str, &b_error )
+
+int x264_param_parse( x264_param_t *p, const char *name, const char *value )
+{
+ char *name_buf = NULL;
+ int b_error = 0;
+ int errortype = X264_PARAM_BAD_VALUE;
+ int name_was_bool;
+ int value_was_null = !value;
+
+ if( !name )
+ return X264_PARAM_BAD_NAME;
+ if( !value )
+ value = "true";
+
+ if( value[0] == '=' )
+ value++;
+
+ if( strchr( name, '_' ) ) // s/_/-/g
+ {
+ char *c;
+ name_buf = strdup(name);
+ if( !name_buf )
+ return X264_PARAM_BAD_NAME;
+ while( (c = strchr( name_buf, '_' )) )
+ *c = '-';
+ name = name_buf;
+ }
+
+ if( !strncmp( name, "no", 2 ) )
+ {
+ name += 2;
+ if( name[0] == '-' )
+ name++;
+ value = atobool(value) ? "false" : "true";
+ }
+ name_was_bool = 0;
+
+#define OPT(STR) else if( !strcmp( name, STR ) )
+#define OPT2(STR0, STR1) else if( !strcmp( name, STR0 ) || !strcmp( name, STR1 ) )
+ if( 0 );
+ OPT("asm")
+ {
+ p->cpu = isdigit(value[0]) ? atoi(value) :
+ !strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
+ if( b_error )
+ {
+ char *buf = strdup( value );
+ if( buf )
+ {
+ char *tok, UNUSED *saveptr=NULL, *init;
+ b_error = 0;
+ p->cpu = 0;
+ for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL )
+ {
+ int i = 0;
+ while( x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name) )
+ i++;
+ p->cpu |= x264_cpu_names[i].flags;
+ if( !x264_cpu_names[i].flags )
+ b_error = 1;
+ }
+ free( buf );
+ if( (p->cpu&X264_CPU_SSSE3) && !(p->cpu&X264_CPU_SSE2_IS_SLOW) )
+ p->cpu |= X264_CPU_SSE2_IS_FAST;
+ }
+ }
+ }
+ OPT("threads")
+ {
+ if( !strcasecmp(value, "auto") )
+ p->i_threads = X264_THREADS_AUTO;
+ else
+ p->i_threads = atoi(value);
+ }
+ OPT("lookahead-threads")
+ {
+ if( !strcasecmp(value, "auto") )
+ p->i_lookahead_threads = X264_THREADS_AUTO;
+ else
+ p->i_lookahead_threads = atoi(value);
+ }
+ OPT("sliced-threads")
+ p->b_sliced_threads = atobool(value);
+ OPT("sync-lookahead")
+ {
+ if( !strcasecmp(value, "auto") )
+ p->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
+ else
+ p->i_sync_lookahead = atoi(value);
+ }
+ OPT2("deterministic", "n-deterministic")
+ p->b_deterministic = atobool(value);
+ OPT("cpu-independent")
+ p->b_cpu_independent = atobool(value);
+ OPT2("level", "level-idc")
+ {
+ if( !strcmp(value, "1b") )
+ p->i_level_idc = 9;
+ else if( atof(value) < 7 )
+ p->i_level_idc = (int)(10*atof(value)+.5);
+ else
+ p->i_level_idc = atoi(value);
+ }
+ OPT("bluray-compat")
+ p->b_bluray_compat = atobool(value);
+ OPT("avcintra-class")
+ p->i_avcintra_class = atoi(value);
+ OPT("sar")
+ {
+ b_error = ( 2 != sscanf( value, "%d:%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) &&
+ 2 != sscanf( value, "%d/%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) );
+ }
+ OPT("overscan")
+ b_error |= parse_enum( value, x264_overscan_names, &p->vui.i_overscan );
+ OPT("videoformat")
+ b_error |= parse_enum( value, x264_vidformat_names, &p->vui.i_vidformat );
+ OPT("fullrange")
+ b_error |= parse_enum( value, x264_fullrange_names, &p->vui.b_fullrange );
+ OPT("colorprim")
+ b_error |= parse_enum( value, x264_colorprim_names, &p->vui.i_colorprim );
+ OPT("transfer")
+ b_error |= parse_enum( value, x264_transfer_names, &p->vui.i_transfer );
+ OPT("colormatrix")
+ b_error |= parse_enum( value, x264_colmatrix_names, &p->vui.i_colmatrix );
+ OPT("chromaloc")
+ {
+ p->vui.i_chroma_loc = atoi(value);
+ b_error = ( p->vui.i_chroma_loc < 0 || p->vui.i_chroma_loc > 5 );
+ }
+ OPT("fps")
+ {
+ if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 )
+ {
+ double fps = atof(value);
+ if( fps > 0.0 && fps <= INT_MAX/1000.0 )
+ {
+ p->i_fps_num = (int)(fps * 1000.0 + .5);
+ p->i_fps_den = 1000;
+ }
+ else
+ {
+ p->i_fps_num = atoi(value);
+ p->i_fps_den = 1;
+ }
+ }
+ }
+ OPT2("ref", "frameref")
+ p->i_frame_reference = atoi(value);
+ OPT("dpb-size")
+ p->i_dpb_size = atoi(value);
+ OPT("keyint")
+ {
+ if( strstr( value, "infinite" ) )
+ p->i_keyint_max = X264_KEYINT_MAX_INFINITE;
+ else
+ p->i_keyint_max = atoi(value);
+ }
+ OPT2("min-keyint", "keyint-min")
+ {
+ p->i_keyint_min = atoi(value);
+ if( p->i_keyint_max < p->i_keyint_min )
+ p->i_keyint_max = p->i_keyint_min;
+ }
+ OPT("scenecut")
+ {
+ p->i_scenecut_threshold = atobool(value);
+ if( b_error || p->i_scenecut_threshold )
+ {
+ b_error = 0;
+ p->i_scenecut_threshold = atoi(value);
+ }
+ }
+ OPT("intra-refresh")
+ p->b_intra_refresh = atobool(value);
+ OPT("bframes")
+ p->i_bframe = atoi(value);
+ OPT("b-adapt")
+ {
+ p->i_bframe_adaptive = atobool(value);
+ if( b_error )
+ {
+ b_error = 0;
+ p->i_bframe_adaptive = atoi(value);
+ }
+ }
+ OPT("b-bias")
+ p->i_bframe_bias = atoi(value);
+ OPT("b-pyramid")
+ {
+ b_error |= parse_enum( value, x264_b_pyramid_names, &p->i_bframe_pyramid );
+ if( b_error )
+ {
+ b_error = 0;
+ p->i_bframe_pyramid = atoi(value);
+ }
+ }
+ OPT("open-gop")
+ p->b_open_gop = atobool(value);
+ OPT("nf")
+ p->b_deblocking_filter = !atobool(value);
+ OPT2("filter", "deblock")
+ {
+ if( 2 == sscanf( value, "%d:%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) ||
+ 2 == sscanf( value, "%d,%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) )
+ {
+ p->b_deblocking_filter = 1;
+ }
+ else if( sscanf( value, "%d", &p->i_deblocking_filter_alphac0 ) )
+ {
+ p->b_deblocking_filter = 1;
+ p->i_deblocking_filter_beta = p->i_deblocking_filter_alphac0;
+ }
+ else
+ p->b_deblocking_filter = atobool(value);
+ }
+ OPT("slice-max-size")
+ p->i_slice_max_size = atoi(value);
+ OPT("slice-max-mbs")
+ p->i_slice_max_mbs = atoi(value);
+ OPT("slice-min-mbs")
+ p->i_slice_min_mbs = atoi(value);
+ OPT("slices")
+ p->i_slice_count = atoi(value);
+ OPT("slices-max")
+ p->i_slice_count_max = atoi(value);
+ OPT("cabac")
+ p->b_cabac = atobool(value);
+ OPT("cabac-idc")
+ p->i_cabac_init_idc = atoi(value);
+ OPT("interlaced")
+ p->b_interlaced = atobool(value);
+ OPT("tff")
+ p->b_interlaced = p->b_tff = atobool(value);
+ OPT("bff")
+ {
+ p->b_interlaced = atobool(value);
+ p->b_tff = !p->b_interlaced;
+ }
+ OPT("constrained-intra")
+ p->b_constrained_intra = atobool(value);
+ OPT("cqm")
+ {
+ if( strstr( value, "flat" ) )
+ p->i_cqm_preset = X264_CQM_FLAT;
+ else if( strstr( value, "jvt" ) )
+ p->i_cqm_preset = X264_CQM_JVT;
+ else
+ p->psz_cqm_file = strdup(value);
+ }
+ OPT("cqmfile")
+ p->psz_cqm_file = strdup(value);
+ OPT("cqm4")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4iy, 16 );
+ b_error |= parse_cqm( value, p->cqm_4py, 16 );
+ b_error |= parse_cqm( value, p->cqm_4ic, 16 );
+ b_error |= parse_cqm( value, p->cqm_4pc, 16 );
+ }
+ OPT("cqm8")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_8iy, 64 );
+ b_error |= parse_cqm( value, p->cqm_8py, 64 );
+ b_error |= parse_cqm( value, p->cqm_8ic, 64 );
+ b_error |= parse_cqm( value, p->cqm_8pc, 64 );
+ }
+ OPT("cqm4i")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4iy, 16 );
+ b_error |= parse_cqm( value, p->cqm_4ic, 16 );
+ }
+ OPT("cqm4p")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4py, 16 );
+ b_error |= parse_cqm( value, p->cqm_4pc, 16 );
+ }
+ OPT("cqm4iy")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4iy, 16 );
+ }
+ OPT("cqm4ic")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4ic, 16 );
+ }
+ OPT("cqm4py")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4py, 16 );
+ }
+ OPT("cqm4pc")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_4pc, 16 );
+ }
+ OPT("cqm8i")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_8iy, 64 );
+ b_error |= parse_cqm( value, p->cqm_8ic, 64 );
+ }
+ OPT("cqm8p")
+ {
+ p->i_cqm_preset = X264_CQM_CUSTOM;
+ b_error |= parse_cqm( value, p->cqm_8py, 64 );
+ b_error |= parse_cqm( value, p->cqm_8pc, 64 );
+ }
+ OPT("log")
+ p->i_log_level = atoi(value);
+ OPT("dump-yuv")
+ p->psz_dump_yuv = strdup(value);
+ OPT2("analyse", "partitions")
+ {
+ p->analyse.inter = 0;
+ if( strstr( value, "none" ) ) p->analyse.inter = 0;
+ if( strstr( value, "all" ) ) p->analyse.inter = ~0;
+
+ if( strstr( value, "i4x4" ) ) p->analyse.inter |= X264_ANALYSE_I4x4;
+ if( strstr( value, "i8x8" ) ) p->analyse.inter |= X264_ANALYSE_I8x8;
+ if( strstr( value, "p8x8" ) ) p->analyse.inter |= X264_ANALYSE_PSUB16x16;
+ if( strstr( value, "p4x4" ) ) p->analyse.inter |= X264_ANALYSE_PSUB8x8;
+ if( strstr( value, "b8x8" ) ) p->analyse.inter |= X264_ANALYSE_BSUB16x16;
+ }
+ OPT("8x8dct")
+ p->analyse.b_transform_8x8 = atobool(value);
+ OPT2("weightb", "weight-b")
+ p->analyse.b_weighted_bipred = atobool(value);
+ OPT("weightp")
+ p->analyse.i_weighted_pred = atoi(value);
+ OPT2("direct", "direct-pred")
+ b_error |= parse_enum( value, x264_direct_pred_names, &p->analyse.i_direct_mv_pred );
+ OPT("chroma-qp-offset")
+ p->analyse.i_chroma_qp_offset = atoi(value);
+ OPT("me")
+ b_error |= parse_enum( value, x264_motion_est_names, &p->analyse.i_me_method );
+ OPT2("merange", "me-range")
+ p->analyse.i_me_range = atoi(value);
+ OPT2("mvrange", "mv-range")
+ p->analyse.i_mv_range = atoi(value);
+ OPT2("mvrange-thread", "mv-range-thread")
+ p->analyse.i_mv_range_thread = atoi(value);
+ OPT2("subme", "subq")
+ p->analyse.i_subpel_refine = atoi(value);
+ OPT("psy-rd")
+ {
+ if( 2 == sscanf( value, "%f:%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) ||
+ 2 == sscanf( value, "%f,%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) ||
+ 2 == sscanf( value, "%f|%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ))
+ { }
+ else if( sscanf( value, "%f", &p->analyse.f_psy_rd ) )
+ {
+ p->analyse.f_psy_trellis = 0;
+ }
+ else
+ {
+ p->analyse.f_psy_rd = 0;
+ p->analyse.f_psy_trellis = 0;
+ }
+ }
+ OPT("psy")
+ p->analyse.b_psy = atobool(value);
+ OPT("chroma-me")
+ p->analyse.b_chroma_me = atobool(value);
+ OPT("mixed-refs")
+ p->analyse.b_mixed_references = atobool(value);
+ OPT("trellis")
+ p->analyse.i_trellis = atoi(value);
+ OPT("fast-pskip")
+ p->analyse.b_fast_pskip = atobool(value);
+ OPT("dct-decimate")
+ p->analyse.b_dct_decimate = atobool(value);
+ OPT("deadzone-inter")
+ p->analyse.i_luma_deadzone[0] = atoi(value);
+ OPT("deadzone-intra")
+ p->analyse.i_luma_deadzone[1] = atoi(value);
+ OPT("nr")
+ p->analyse.i_noise_reduction = atoi(value);
+ OPT("bitrate")
+ {
+ p->rc.i_bitrate = atoi(value);
+ p->rc.i_rc_method = X264_RC_ABR;
+ }
+ OPT2("qp", "qp_constant")
+ {
+ p->rc.i_qp_constant = atoi(value);
+ p->rc.i_rc_method = X264_RC_CQP;
+ }
+ OPT("crf")
+ {
+ p->rc.f_rf_constant = atof(value);
+ p->rc.i_rc_method = X264_RC_CRF;
+ }
+ OPT("crf-max")
+ p->rc.f_rf_constant_max = atof(value);
+ OPT("rc-lookahead")
+ p->rc.i_lookahead = atoi(value);
+ OPT2("qpmin", "qp-min")
+ p->rc.i_qp_min = atoi(value);
+ OPT2("qpmax", "qp-max")
+ p->rc.i_qp_max = atoi(value);
+ OPT2("qpstep", "qp-step")
+ p->rc.i_qp_step = atoi(value);
+ OPT("ratetol")
+ p->rc.f_rate_tolerance = !strncmp("inf", value, 3) ? 1e9 : atof(value);
+ OPT("vbv-maxrate")
+ p->rc.i_vbv_max_bitrate = atoi(value);
+ OPT("vbv-bufsize")
+ p->rc.i_vbv_buffer_size = atoi(value);
+ OPT("vbv-init")
+ p->rc.f_vbv_buffer_init = atof(value);
+ OPT2("ipratio", "ip-factor")
+ p->rc.f_ip_factor = atof(value);
+ OPT2("pbratio", "pb-factor")
+ p->rc.f_pb_factor = atof(value);
+ OPT("aq-mode")
+ p->rc.i_aq_mode = atoi(value);
+ OPT("aq-strength")
+ p->rc.f_aq_strength = atof(value);
+ OPT("pass")
+ {
+ int pass = x264_clip3( atoi(value), 0, 3 );
+ p->rc.b_stat_write = pass & 1;
+ p->rc.b_stat_read = pass & 2;
+ }
+ OPT("stats")
+ {
+ p->rc.psz_stat_in = strdup(value);
+ p->rc.psz_stat_out = strdup(value);
+ }
+ OPT("qcomp")
+ p->rc.f_qcompress = atof(value);
+ OPT("mbtree")
+ p->rc.b_mb_tree = atobool(value);
+ OPT("qblur")
+ p->rc.f_qblur = atof(value);
+ OPT2("cplxblur", "cplx-blur")
+ p->rc.f_complexity_blur = atof(value);
+ OPT("zones")
+ p->rc.psz_zones = strdup(value);
+ OPT("crop-rect")
+ b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top,
+ &p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4;
+ OPT("psnr")
+ p->analyse.b_psnr = atobool(value);
+ OPT("ssim")
+ p->analyse.b_ssim = atobool(value);
+ OPT("aud")
+ p->b_aud = atobool(value);
+ OPT("sps-id")
+ p->i_sps_id = atoi(value);
+ OPT("global-header")
+ p->b_repeat_headers = !atobool(value);
+ OPT("repeat-headers")
+ p->b_repeat_headers = atobool(value);
+ OPT("annexb")
+ p->b_annexb = atobool(value);
+ OPT("force-cfr")
+ p->b_vfr_input = !atobool(value);
+ OPT("nal-hrd")
+ b_error |= parse_enum( value, x264_nal_hrd_names, &p->i_nal_hrd );
+ OPT("filler")
+ p->rc.b_filler = atobool(value);
+ OPT("pic-struct")
+ p->b_pic_struct = atobool(value);
+ OPT("fake-interlaced")
+ p->b_fake_interlaced = atobool(value);
+ OPT("frame-packing")
+ p->i_frame_packing = atoi(value);
+ OPT("stitchable")
+ p->b_stitchable = atobool(value);
+ OPT("opencl")
+ p->b_opencl = atobool( value );
+ OPT("opencl-clbin")
+ p->psz_clbin_file = strdup( value );
+ OPT("opencl-device")
+ p->i_opencl_device = atoi( value );
+ else
+ {
+ b_error = 1;
+ errortype = X264_PARAM_BAD_NAME;
+ }
+#undef OPT
+#undef OPT2
+#undef atobool
+#undef atoi
+#undef atof
+
+ if( name_buf )
+ free( name_buf );
+
+ b_error |= value_was_null && !name_was_bool;
+ return b_error ? errortype : 0;
+}
+
+/****************************************************************************
+ * x264_param2string:
+ ****************************************************************************/
+char *x264_param2string( x264_param_t *p, int b_res )
+{
+ int len = 1000;
+ char *buf, *s;
+ if( p->rc.psz_zones )
+ len += strlen(p->rc.psz_zones);
+ buf = s = x264_malloc( len );
+ if( !buf )
+ return NULL;
+
+ if( b_res )
+ {
+ s += sprintf( s, "%dx%d ", p->i_width, p->i_height );
+ s += sprintf( s, "fps=%u/%u ", p->i_fps_num, p->i_fps_den );
+ s += sprintf( s, "timebase=%u/%u ", p->i_timebase_num, p->i_timebase_den );
+ s += sprintf( s, "bitdepth=%d ", p->i_bitdepth );
+ }
+
+ if( p->b_opencl )
+ s += sprintf( s, "opencl=%d ", p->b_opencl );
+ s += sprintf( s, "cabac=%d", p->b_cabac );
+ s += sprintf( s, " ref=%d", p->i_frame_reference );
+ s += sprintf( s, " deblock=%d:%d:%d", p->b_deblocking_filter,
+ p->i_deblocking_filter_alphac0, p->i_deblocking_filter_beta );
+ s += sprintf( s, " analyse=%#x:%#x", p->analyse.intra, p->analyse.inter );
+ s += sprintf( s, " me=%s", x264_motion_est_names[ p->analyse.i_me_method ] );
+ s += sprintf( s, " subme=%d", p->analyse.i_subpel_refine );
+ s += sprintf( s, " psy=%d", p->analyse.b_psy );
+ if( p->analyse.b_psy )
+ s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis );
+ s += sprintf( s, " mixed_ref=%d", p->analyse.b_mixed_references );
+ s += sprintf( s, " me_range=%d", p->analyse.i_me_range );
+ s += sprintf( s, " chroma_me=%d", p->analyse.b_chroma_me );
+ s += sprintf( s, " trellis=%d", p->analyse.i_trellis );
+ s += sprintf( s, " 8x8dct=%d", p->analyse.b_transform_8x8 );
+ s += sprintf( s, " cqm=%d", p->i_cqm_preset );
+ s += sprintf( s, " deadzone=%d,%d", p->analyse.i_luma_deadzone[0], p->analyse.i_luma_deadzone[1] );
+ s += sprintf( s, " fast_pskip=%d", p->analyse.b_fast_pskip );
+ s += sprintf( s, " chroma_qp_offset=%d", p->analyse.i_chroma_qp_offset );
+ s += sprintf( s, " threads=%d", p->i_threads );
+ s += sprintf( s, " lookahead_threads=%d", p->i_lookahead_threads );
+ s += sprintf( s, " sliced_threads=%d", p->b_sliced_threads );
+ if( p->i_slice_count )
+ s += sprintf( s, " slices=%d", p->i_slice_count );
+ if( p->i_slice_count_max )
+ s += sprintf( s, " slices_max=%d", p->i_slice_count_max );
+ if( p->i_slice_max_size )
+ s += sprintf( s, " slice_max_size=%d", p->i_slice_max_size );
+ if( p->i_slice_max_mbs )
+ s += sprintf( s, " slice_max_mbs=%d", p->i_slice_max_mbs );
+ if( p->i_slice_min_mbs )
+ s += sprintf( s, " slice_min_mbs=%d", p->i_slice_min_mbs );
+ s += sprintf( s, " nr=%d", p->analyse.i_noise_reduction );
+ s += sprintf( s, " decimate=%d", p->analyse.b_dct_decimate );
+ s += sprintf( s, " interlaced=%s", p->b_interlaced ? p->b_tff ? "tff" : "bff" : p->b_fake_interlaced ? "fake" : "0" );
+ s += sprintf( s, " bluray_compat=%d", p->b_bluray_compat );
+ if( p->b_stitchable )
+ s += sprintf( s, " stitchable=%d", p->b_stitchable );
+
+ s += sprintf( s, " constrained_intra=%d", p->b_constrained_intra );
+
+ s += sprintf( s, " bframes=%d", p->i_bframe );
+ if( p->i_bframe )
+ {
+ s += sprintf( s, " b_pyramid=%d b_adapt=%d b_bias=%d direct=%d weightb=%d open_gop=%d",
+ p->i_bframe_pyramid, p->i_bframe_adaptive, p->i_bframe_bias,
+ p->analyse.i_direct_mv_pred, p->analyse.b_weighted_bipred, p->b_open_gop );
+ }
+ s += sprintf( s, " weightp=%d", p->analyse.i_weighted_pred > 0 ? p->analyse.i_weighted_pred : 0 );
+
+ if( p->i_keyint_max == X264_KEYINT_MAX_INFINITE )
+ s += sprintf( s, " keyint=infinite" );
+ else
+ s += sprintf( s, " keyint=%d", p->i_keyint_max );
+ s += sprintf( s, " keyint_min=%d scenecut=%d intra_refresh=%d",
+ p->i_keyint_min, p->i_scenecut_threshold, p->b_intra_refresh );
+
+ if( p->rc.b_mb_tree || p->rc.i_vbv_buffer_size )
+ s += sprintf( s, " rc_lookahead=%d", p->rc.i_lookahead );
+
+ s += sprintf( s, " rc=%s mbtree=%d", p->rc.i_rc_method == X264_RC_ABR ?
+ ( p->rc.b_stat_read ? "2pass" : p->rc.i_vbv_max_bitrate == p->rc.i_bitrate ? "cbr" : "abr" )
+ : p->rc.i_rc_method == X264_RC_CRF ? "crf" : "cqp", p->rc.b_mb_tree );
+ if( p->rc.i_rc_method == X264_RC_ABR || p->rc.i_rc_method == X264_RC_CRF )
+ {
+ if( p->rc.i_rc_method == X264_RC_CRF )
+ s += sprintf( s, " crf=%.1f", p->rc.f_rf_constant );
+ else
+ s += sprintf( s, " bitrate=%d ratetol=%.1f",
+ p->rc.i_bitrate, p->rc.f_rate_tolerance );
+ s += sprintf( s, " qcomp=%.2f qpmin=%d qpmax=%d qpstep=%d",
+ p->rc.f_qcompress, p->rc.i_qp_min, p->rc.i_qp_max, p->rc.i_qp_step );
+ if( p->rc.b_stat_read )
+ s += sprintf( s, " cplxblur=%.1f qblur=%.1f",
+ p->rc.f_complexity_blur, p->rc.f_qblur );
+ if( p->rc.i_vbv_buffer_size )
+ {
+ s += sprintf( s, " vbv_maxrate=%d vbv_bufsize=%d",
+ p->rc.i_vbv_max_bitrate, p->rc.i_vbv_buffer_size );
+ if( p->rc.i_rc_method == X264_RC_CRF )
+ s += sprintf( s, " crf_max=%.1f", p->rc.f_rf_constant_max );
+ }
+ }
+ else if( p->rc.i_rc_method == X264_RC_CQP )
+ s += sprintf( s, " qp=%d", p->rc.i_qp_constant );
+
+ if( p->rc.i_vbv_buffer_size )
+ s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler );
+ if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom )
+ s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top,
+ p->crop_rect.i_right, p->crop_rect.i_bottom );
+ if( p->i_frame_packing >= 0 )
+ s += sprintf( s, " frame-packing=%d", p->i_frame_packing );
+
+ if( !(p->rc.i_rc_method == X264_RC_CQP && p->rc.i_qp_constant == 0) )
+ {
+ s += sprintf( s, " ip_ratio=%.2f", p->rc.f_ip_factor );
+ if( p->i_bframe && !p->rc.b_mb_tree )
+ s += sprintf( s, " pb_ratio=%.2f", p->rc.f_pb_factor );
+ s += sprintf( s, " aq=%d", p->rc.i_aq_mode );
+ if( p->rc.i_aq_mode )
+ s += sprintf( s, ":%.2f", p->rc.f_aq_strength );
+ if( p->rc.psz_zones )
+ s += sprintf( s, " zones=%s", p->rc.psz_zones );
+ else if( p->rc.i_zones )
+ s += sprintf( s, " zones" );
+ }
+
+ return buf;
+}
--- /dev/null
+/*****************************************************************************
+ * base.h: misc common functions (bit depth independent)
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Laurent Aimar <fenrir@via.ecp.fr>
+ * Loren Merritt <lorenm@u.washington.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_BASE_H
+#define X264_BASE_H
+
+/****************************************************************************
+ * Macros (can be used in osdep.h)
+ ****************************************************************************/
+#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
+#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
+#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c)))
+#define X264_MAX3(a,b,c) X264_MAX((a),X264_MAX((b),(c)))
+#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d)))
+#define X264_MAX4(a,b,c,d) X264_MAX((a),X264_MAX3((b),(c),(d)))
+
+/****************************************************************************
+ * System includes
+ ****************************************************************************/
+#include "osdep.h"
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include "x264.h"
+
+/****************************************************************************
+ * Macros
+ ****************************************************************************/
+#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 )
+#define FIX8(f) ((int)(f*(1<<8)+.5))
+#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0])))
+#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
+#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
+#define IS_DISPOSABLE(type) ( type == X264_TYPE_B )
+
+/* Unions for type-punning.
+ * Mn: load or store n bits, aligned, native-endian
+ * CPn: copy n bits, aligned, native-endian
+ * we don't use memcpy for CPn because memcpy's args aren't assumed to be aligned */
+typedef union { uint16_t i; uint8_t c[2]; } MAY_ALIAS x264_union16_t;
+typedef union { uint32_t i; uint16_t b[2]; uint8_t c[4]; } MAY_ALIAS x264_union32_t;
+typedef union { uint64_t i; uint32_t a[2]; uint16_t b[4]; uint8_t c[8]; } MAY_ALIAS x264_union64_t;
+typedef struct { uint64_t i[2]; } x264_uint128_t;
+typedef union { x264_uint128_t i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_t;
+#define M16(src) (((x264_union16_t*)(src))->i)
+#define M32(src) (((x264_union32_t*)(src))->i)
+#define M64(src) (((x264_union64_t*)(src))->i)
+#define M128(src) (((x264_union128_t*)(src))->i)
+#define M128_ZERO ((x264_uint128_t){{0,0}})
+#define CP16(dst,src) M16(dst) = M16(src)
+#define CP32(dst,src) M32(dst) = M32(src)
+#define CP64(dst,src) M64(dst) = M64(src)
+#define CP128(dst,src) M128(dst) = M128(src)
+
+/****************************************************************************
+ * Constants
+ ****************************************************************************/
+enum profile_e
+{
+ PROFILE_BASELINE = 66,
+ PROFILE_MAIN = 77,
+ PROFILE_HIGH = 100,
+ PROFILE_HIGH10 = 110,
+ PROFILE_HIGH422 = 122,
+ PROFILE_HIGH444_PREDICTIVE = 244,
+};
+
+enum chroma_format_e
+{
+ CHROMA_400 = 0,
+ CHROMA_420 = 1,
+ CHROMA_422 = 2,
+ CHROMA_444 = 3,
+};
+
+enum slice_type_e
+{
+ SLICE_TYPE_P = 0,
+ SLICE_TYPE_B = 1,
+ SLICE_TYPE_I = 2,
+};
+
+static const char slice_type_to_char[] = { 'P', 'B', 'I' };
+
+enum sei_payload_type_e
+{
+ SEI_BUFFERING_PERIOD = 0,
+ SEI_PIC_TIMING = 1,
+ SEI_PAN_SCAN_RECT = 2,
+ SEI_FILLER = 3,
+ SEI_USER_DATA_REGISTERED = 4,
+ SEI_USER_DATA_UNREGISTERED = 5,
+ SEI_RECOVERY_POINT = 6,
+ SEI_DEC_REF_PIC_MARKING = 7,
+ SEI_FRAME_PACKING = 45,
+};
+
+#define X264_BFRAME_MAX 16
+#define X264_REF_MAX 16
+#define X264_THREAD_MAX 128
+#define X264_LOOKAHEAD_THREAD_MAX 16
+#define X264_LOOKAHEAD_MAX 250
+
+// number of pixels (per thread) in progress at any given time.
+// 16 for the macroblock in progress + 3 for deblocking + 3 for motion compensation filter + 2 for extra safety
+#define X264_THREAD_HEIGHT 24
+
+/* WEIGHTP_FAKE is set when mb_tree & psy are enabled, but normal weightp is disabled
+ * (such as in baseline). It checks for fades in lookahead and adjusts qp accordingly
+ * to increase quality. Defined as (-1) so that if(i_weighted_pred > 0) is true only when
+ * real weights are being used. */
+
+#define X264_WEIGHTP_FAKE (-1)
+
+#define X264_SCAN8_LUMA_SIZE (5*8)
+#define X264_SCAN8_SIZE (X264_SCAN8_LUMA_SIZE*3)
+#define X264_SCAN8_0 (4+1*8)
+
+/* Scan8 organization:
+ * 0 1 2 3 4 5 6 7
+ * 0 DY y y y y y
+ * 1 y Y Y Y Y
+ * 2 y Y Y Y Y
+ * 3 y Y Y Y Y
+ * 4 y Y Y Y Y
+ * 5 DU u u u u u
+ * 6 u U U U U
+ * 7 u U U U U
+ * 8 u U U U U
+ * 9 u U U U U
+ * 10 DV v v v v v
+ * 11 v V V V V
+ * 12 v V V V V
+ * 13 v V V V V
+ * 14 v V V V V
+ * DY/DU/DV are for luma/chroma DC.
+ */
+
+#define LUMA_DC 48
+#define CHROMA_DC 49
+
+static const uint8_t x264_scan8[16*3 + 3] =
+{
+ 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8,
+ 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8,
+ 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8,
+ 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8,
+ 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8,
+ 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8,
+ 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8,
+ 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8,
+ 4+11*8, 5+11*8, 4+12*8, 5+12*8,
+ 6+11*8, 7+11*8, 6+12*8, 7+12*8,
+ 4+13*8, 5+13*8, 4+14*8, 5+14*8,
+ 6+13*8, 7+13*8, 6+14*8, 7+14*8,
+ 0+ 0*8, 0+ 5*8, 0+10*8
+};
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+#include "cpu.h"
+#include "tables.h"
+
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+static ALWAYS_INLINE int x264_clip3( int v, int i_min, int i_max )
+{
+ return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v );
+}
+
+static ALWAYS_INLINE double x264_clip3f( double v, double f_min, double f_max )
+{
+ return ( (v < f_min) ? f_min : (v > f_max) ? f_max : v );
+}
+
+/* Not a general-purpose function; multiplies input by -1/6 to convert
+ * qp to qscale. */
+static ALWAYS_INLINE int x264_exp2fix8( float x )
+{
+ int i = x*(-64.f/6.f) + 512.5f;
+ if( i < 0 ) return 0;
+ if( i > 1023 ) return 0xffff;
+ return (x264_exp2_lut[i&63]+256) << (i>>6) >> 8;
+}
+
+static ALWAYS_INLINE float x264_log2( uint32_t x )
+{
+ int lz = x264_clz( x );
+ return x264_log2_lut[(x<<lz>>24)&0x7f] + x264_log2_lz_lut[lz];
+}
+
+static ALWAYS_INLINE int x264_median( int a, int b, int c )
+{
+ int t = (a-b)&((a-b)>>31);
+ a -= t;
+ b += t;
+ b -= (b-c)&((b-c)>>31);
+ b += (a-b)&((a-b)>>31);
+ return b;
+}
+
+static ALWAYS_INLINE void x264_median_mv( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
+{
+ dst[0] = x264_median( a[0], b[0], c[0] );
+ dst[1] = x264_median( a[1], b[1], c[1] );
+}
+
+static ALWAYS_INLINE int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc )
+{
+ int sum = 0;
+ for( int i = 0; i < i_mvc-1; i++ )
+ {
+ sum += abs( mvc[i][0] - mvc[i+1][0] )
+ + abs( mvc[i][1] - mvc[i+1][1] );
+ }
+ return sum;
+}
+
+static ALWAYS_INLINE uint16_t x264_cabac_mvd_sum( uint8_t *mvdleft, uint8_t *mvdtop )
+{
+ int amvd0 = mvdleft[0] + mvdtop[0];
+ int amvd1 = mvdleft[1] + mvdtop[1];
+ amvd0 = (amvd0 > 2) + (amvd0 > 32);
+ amvd1 = (amvd1 > 2) + (amvd1 > 32);
+ return amvd0 + (amvd1<<8);
+}
+
+/****************************************************************************
+ * General functions
+ ****************************************************************************/
+void x264_reduce_fraction( uint32_t *n, uint32_t *d );
+void x264_reduce_fraction64( uint64_t *n, uint64_t *d );
+
+void x264_log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg );
+void x264_log_internal( int i_level, const char *psz_fmt, ... );
+
+/* x264_malloc : will do or emulate a memalign
+ * you have to use x264_free for buffers allocated with x264_malloc */
+void *x264_malloc( int );
+void x264_free( void * );
+
+/* x264_slurp_file: malloc space for the whole file and read it */
+char *x264_slurp_file( const char *filename );
+
+/* x264_param2string: return a (malloced) string containing most of
+ * the encoding options */
+char *x264_param2string( x264_param_t *p, int b_res );
+
+/****************************************************************************
+ * Macros
+ ****************************************************************************/
+#define CHECKED_MALLOC( var, size )\
+do {\
+ var = x264_malloc( size );\
+ if( !var )\
+ goto fail;\
+} while( 0 )
+#define CHECKED_MALLOCZERO( var, size )\
+do {\
+ CHECKED_MALLOC( var, size );\
+ memset( var, 0, size );\
+} while( 0 )
+
+/* Macros for merging multiple allocations into a single large malloc, for improved
+ * use with huge pages. */
+
+/* Needs to be enough to contain any set of buffers that use combined allocations */
+#define PREALLOC_BUF_SIZE 1024
+
+#define PREALLOC_INIT\
+ int prealloc_idx = 0;\
+ size_t prealloc_size = 0;\
+ uint8_t **preallocs[PREALLOC_BUF_SIZE];
+
+#define PREALLOC( var, size )\
+do {\
+ var = (void*)prealloc_size;\
+ preallocs[prealloc_idx++] = (uint8_t**)&var;\
+ prealloc_size += ALIGN(size, NATIVE_ALIGN);\
+} while( 0 )
+
+#define PREALLOC_END( ptr )\
+do {\
+ CHECKED_MALLOC( ptr, prealloc_size );\
+ while( prealloc_idx-- )\
+ *preallocs[prealloc_idx] += (intptr_t)ptr;\
+} while( 0 )
+
+#endif
return dst;
}
-uint8_t *x264_nal_escape_mmx2( uint8_t *dst, uint8_t *src, uint8_t *end );
-uint8_t *x264_nal_escape_sse2( uint8_t *dst, uint8_t *src, uint8_t *end );
-uint8_t *x264_nal_escape_avx2( uint8_t *dst, uint8_t *src, uint8_t *end );
-void x264_cabac_block_residual_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_8x8_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_avx2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-void x264_cabac_block_residual_internal_avx512( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
-
-uint8_t *x264_nal_escape_neon( uint8_t *dst, uint8_t *src, uint8_t *end );
+#if HAVE_MMX
+#include "x86/bitstream.h"
+#endif
+#if HAVE_ARMV6
+#include "arm/bitstream.h"
+#endif
+#if ARCH_AARCH64
+#include "aarch64/bitstream.h"
+#endif
/****************************************************************************
* x264_nal_encode:
#ifndef X264_BS_H
#define X264_BS_H
-typedef struct
-{
- uint8_t i_bits;
- uint8_t i_size;
-} vlc_t;
-
typedef struct
{
uint16_t i_bits;
ALIGNED_16( dctcoef level[18] );
} x264_run_level_t;
-extern const vlc_t x264_coeff0_token[6];
-extern const vlc_t x264_coeff_token[6][16][4];
-extern const vlc_t x264_total_zeros[15][16];
-extern const vlc_t x264_total_zeros_2x2_dc[3][4];
-extern const vlc_t x264_total_zeros_2x4_dc[7][8];
-
typedef struct
{
uint8_t *(*nal_escape)( uint8_t *dst, uint8_t *src, uint8_t *end );
intptr_t ctx_block_cat, x264_cabac_t *cb );
} x264_bitstream_function_t;
+#define x264_bitstream_init x264_template(bitstream_init)
void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf );
/* A larger level table size theoretically could help a bit at extremely
* This size appears to be optimal for QP18 encoding on a Nehalem CPU.
* FIXME: Do further testing? */
#define LEVEL_TABLE_SIZE 128
+#define x264_level_token x264_template(level_token)
extern vlc_large_t x264_level_token[7][LEVEL_TABLE_SIZE];
/* The longest possible set of zero run codes sums to 25 bits. This leaves
* plenty of room for both the code (25 bits) and size (5 bits) in a uint32_t. */
+#define x264_run_before x264_template(run_before)
extern uint32_t x264_run_before[1<<16];
static inline void bs_init( bs_t *s, void *p_data, int i_data )
#include "common.h"
-
-static const int8_t cabac_context_init_I[1024][2] =
-{
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28,127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 unused for I */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 },
-
- /* 24- 39 */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
-
- /* 40 - 53 */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 },
-
- /* 54 - 59 */
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 -> 87 */
- { 0, 11 }, { 1, 55 }, { 0, 69 }, { -17, 127 },
- { -13, 102 },{ 0, 82 }, { -7, 74 }, { -21, 107 },
- { -27, 127 },{ -31, 127 },{ -24, 127 }, { -18, 95 },
- { -27, 127 },{ -21, 114 },{ -30, 127 }, { -17, 123 },
- { -12, 115 },{ -16, 122 },
-
- /* 88 -> 104 */
- { -11, 115 },{ -12, 63 }, { -2, 68 }, { -15, 84 },
- { -13, 104 },{ -3, 70 }, { -8, 93 }, { -10, 90 },
- { -30, 127 },{ -1, 74 }, { -6, 97 }, { -7, 91 },
- { -20, 127 },{ -4, 56 }, { -5, 82 }, { -7, 76 },
- { -22, 125 },
-
- /* 105 -> 135 */
- { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
- { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
- { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
- { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
- { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
- { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
- { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 },{ -15, 100 },
-
- /* 136 -> 165 */
- { -13, 101 },{ -13, 91 }, { -12, 94 }, { -10, 88 },
- { -16, 84 }, { -10, 86 }, { -7, 83 }, { -13, 87 },
- { -19, 94 }, { 1, 70 }, { 0, 72 }, { -5, 74 },
- { 18, 59 }, { -8, 102 }, { -15, 100 }, { 0, 95 },
- { -4, 75 }, { 2, 72 }, { -11, 75 }, { -3, 71 },
- { 15, 46 }, { -13, 69 }, { 0, 62 }, { 0, 65 },
- { 21, 37 }, { -15, 72 }, { 9, 57 }, { 16, 54 },
- { 0, 62 }, { 12, 72 },
-
- /* 166 -> 196 */
- { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
- { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
- { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
- { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
- { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
- { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
- { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
- { 0, 89 }, { 26, -19 }, { 22, -17 },
-
- /* 197 -> 226 */
- { 26, -17 }, { 30, -25 }, { 28, -20 }, { 33, -23 },
- { 37, -27 }, { 33, -23 }, { 40, -28 }, { 38, -17 },
- { 33, -11 }, { 40, -15 }, { 41, -6 }, { 38, 1 },
- { 41, 17 }, { 30, -6 }, { 27, 3 }, { 26, 22 },
- { 37, -16 }, { 35, -4 }, { 38, -8 }, { 38, -3 },
- { 37, 3 }, { 38, 5 }, { 42, 0 }, { 35, 16 },
- { 39, 22 }, { 14, 48 }, { 27, 37 }, { 21, 60 },
- { 12, 68 }, { 2, 97 },
-
- /* 227 -> 251 */
- { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
- { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
- { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
- { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
- { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
- { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
- { -4, 65 },
-
- /* 252 -> 275 */
- { -12, 73 }, { -8, 76 }, { -7, 80 }, { -9, 88 },
- { -17, 110 },{ -11, 97 }, { -20, 84 }, { -11, 79 },
- { -6, 73 }, { -4, 74 }, { -13, 86 }, { -13, 96 },
- { -11, 97 }, { -19, 117 },{ -8, 78 }, { -5, 33 },
- { -4, 48 }, { -2, 53 }, { -3, 62 }, { -13, 71 },
- { -10, 79 }, { -12, 86 }, { -13, 90 }, { -14, 97 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 -> 307 */
- { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
- { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
- { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
- { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
- { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
- { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
- { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 },{ -11, 97 },
-
- /* 308 -> 337 */
- { -16, 96 }, { -7, 88 }, { -8, 85 }, { -7, 85 },
- { -9, 85 }, { -13, 88 }, { 4, 66 }, { -3, 77 },
- { -3, 76 }, { -6, 76 }, { 10, 58 }, { -1, 76 },
- { -1, 83 }, { -7, 99 }, { -14, 95 }, { 2, 95 },
- { 0, 76 }, { -5, 74 }, { 0, 70 }, { -11, 75 },
- { 1, 68 }, { 0, 65 }, { -14, 73 }, { 3, 62 },
- { 4, 62 }, { -1, 68 }, { -13, 75 }, { 11, 55 },
- { 5, 64 }, { 12, 70 },
-
- /* 338 -> 368 */
- { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
- { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
- { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
- { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
- { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
- { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
- { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 },{ 36, -35 }, { 36, -34 },
-
- /* 369 -> 398 */
- { 32, -26 }, { 37, -30 }, { 44, -32 }, { 34, -18 },
- { 34, -15 }, { 40, -15 }, { 33, -7 }, { 35, -5 },
- { 33, 0 }, { 38, 2 }, { 33, 13 }, { 23, 35 },
- { 13, 58 }, { 29, -3 }, { 26, 0 }, { 22, 30 },
- { 31, -7 }, { 35, -15 }, { 34, -3 }, { 34, 3 },
- { 36, -1 }, { 34, 5 }, { 32, 11 }, { 35, 5 },
- { 34, 12 }, { 39, 11 }, { 30, 29 }, { 34, 26 },
- { 29, 39 }, { 19, 66 },
-
- /* 399 -> 435 */
- { 31, 21 }, { 31, 31 }, { 25, 50 },
- { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
- { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
- { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
- { -23, 68 }, { -24, 50 }, { -11, 74 }, { 23, -13 },
- { 26, -13 }, { 40, -15 }, { 49, -14 }, { 44, 3 },
- { 45, 6 }, { 44, 34 }, { 33, 54 }, { 19, 82 },
- { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
- { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
- { 0, 68 }, { -9, 92 },
-
- /* 436 -> 459 */
- { -14, 106 }, { -13, 97 }, { -15, 90 }, { -12, 90 },
- { -18, 88 }, { -10, 73 }, { -9, 79 }, { -14, 86 },
- { -10, 73 }, { -10, 70 }, { -10, 69 }, { -5, 66 },
- { -9, 64 }, { -5, 58 }, { 2, 59 }, { 21, -10 },
- { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
- { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
-
- /* 460 -> 1024 */
- { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
- { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
- { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
- { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
- { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
- { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
- { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
- { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
- { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
- { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
- { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
- { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
- { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
- { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
- { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
- { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
- { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
- { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
- { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
- { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
- { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
- { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
- { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
- { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
- { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
- { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
- { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
- { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
- { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
- { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
- { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
- { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
- { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
- { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
- { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
- { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
- { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
- { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
- { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
- { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
- { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
- { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
- { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
- { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
- { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
- { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
- { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
- { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
- { -23, 68 }, { -24, 50 }, { -11, 74 }, { -14, 106 },
- { -13, 97 }, { -15, 90 }, { -12, 90 }, { -18, 88 },
- { -10, 73 }, { -9, 79 }, { -14, 86 }, { -10, 73 },
- { -10, 70 }, { -10, 69 }, { -5, 66 }, { -9, 64 },
- { -5, 58 }, { 2, 59 }, { 23, -13 }, { 26, -13 },
- { 40, -15 }, { 49, -14 }, { 44, 3 }, { 45, 6 },
- { 44, 34 }, { 33, 54 }, { 19, 82 }, { 21, -10 },
- { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
- { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
- { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
- { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
- { 0, 68 }, { -9, 92 }, { -17, 120 }, { -20, 112 },
- { -18, 114 }, { -11, 85 }, { -15, 92 }, { -14, 89 },
- { -26, 71 }, { -15, 81 }, { -14, 80 }, { 0, 68 },
- { -14, 70 }, { -24, 56 }, { -23, 68 }, { -24, 50 },
- { -11, 74 }, { -14, 106 }, { -13, 97 }, { -15, 90 },
- { -12, 90 }, { -18, 88 }, { -10, 73 }, { -9, 79 },
- { -14, 86 }, { -10, 73 }, { -10, 70 }, { -10, 69 },
- { -5, 66 }, { -9, 64 }, { -5, 58 }, { 2, 59 },
- { 23, -13 }, { 26, -13 }, { 40, -15 }, { 49, -14 },
- { 44, 3 }, { 45, 6 }, { 44, 34 }, { 33, 54 },
- { 19, 82 }, { 21, -10 }, { 24, -11 }, { 28, -8 },
- { 28, -1 }, { 29, 3 }, { 29, 9 }, { 35, 20 },
- { 29, 36 }, { 14, 67 }, { -3, 75 }, { -1, 23 },
- { 1, 34 }, { 1, 43 }, { 0, 54 }, { -2, 55 },
- { 0, 61 }, { 1, 64 }, { 0, 68 }, { -9, 92 },
- { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
- { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
- { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
- { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
- { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
- { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
- { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
- { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
- { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
- { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
- { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
- { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
- { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
- { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
- { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
- { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
- { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
- { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
- { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
- { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
- { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
- { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
- { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
- { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
- { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
- { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
- { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
- { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
- { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
- { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
- { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
- { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
- { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
- { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
- { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
- { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
- { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
- { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
- { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
- { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
- { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
- { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
- { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
- { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
- { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
- { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
- { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
- { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
- { -4, 65 }, { -12, 73 }, { -8, 76 }, { -7, 80 },
- { -9, 88 }, { -17, 110 }, { -3, 71 }, { -6, 42 },
- { -5, 50 }, { -3, 54 }, { -2, 62 }, { 0, 58 },
- { 1, 63 }, { -2, 72 }, { -1, 74 }, { -9, 91 },
- { -5, 67 }, { -5, 27 }, { -3, 39 }, { -2, 44 },
- { 0, 46 }, { -16, 64 }, { -8, 68 }, { -10, 78 },
- { -6, 77 }, { -10, 86 }, { -12, 92 }, { -15, 55 },
- { -10, 60 }, { -6, 62 }, { -4, 65 }, { -12, 73 },
- { -8, 76 }, { -7, 80 }, { -9, 88 }, { -17, 110 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
- { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }
-};
-
-static const int8_t cabac_context_init_PB[3][1024][2] =
-{
- /* i_cabac_init_idc == 0 */
- {
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 */
- { 23, 33 }, { 23, 2 }, { 21, 0 }, { 1, 9 },
- { 0, 49 }, { -37, 118 }, { 5, 57 }, { -13, 78 },
- { -11, 65 }, { 1, 62 }, { 12, 49 }, { -4, 73 },
- { 17, 50 },
-
- /* 24 - 39 */
- { 18, 64 }, { 9, 43 }, { 29, 0 }, { 26, 67 },
- { 16, 90 }, { 9, 104 }, { -46, 127 }, { -20, 104 },
- { 1, 67 }, { -13, 78 }, { -11, 65 }, { 1, 62 },
- { -6, 86 }, { -17, 95 }, { -6, 61 }, { 9, 45 },
-
- /* 40 - 53 */
- { -3, 69 }, { -6, 81 }, { -11, 96 }, { 6, 55 },
- { 7, 67 }, { -5, 86 }, { 2, 88 }, { 0, 58 },
- { -3, 76 }, { -10, 94 }, { 5, 54 }, { 4, 69 },
- { -3, 81 }, { 0, 88 },
-
- /* 54 - 59 */
- { -7, 67 }, { -5, 74 }, { -4, 74 }, { -5, 80 },
- { -7, 72 }, { 1, 58 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 - 87 */
- { 0, 45 }, { -4, 78 }, { -3, 96 }, { -27, 126 },
- { -28, 98 }, { -25, 101 }, { -23, 67 }, { -28, 82 },
- { -20, 94 }, { -16, 83 }, { -22, 110 }, { -21, 91 },
- { -18, 102 }, { -13, 93 }, { -29, 127 }, { -7, 92 },
- { -5, 89 }, { -7, 96 }, { -13, 108 }, { -3, 46 },
- { -1, 65 }, { -1, 57 }, { -9, 93 }, { -3, 74 },
- { -9, 92 }, { -8, 87 }, { -23, 126 }, { 5, 54 },
- { 6, 60 }, { 6, 59 }, { 6, 69 }, { -1, 48 },
- { 0, 68 }, { -4, 69 }, { -8, 88 },
-
- /* 105 -> 165 */
- { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
- { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
- { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
- { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
- { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
- { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
- { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
- { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
- { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
- { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
- { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
- { 3, 64 }, { 1, 61 }, { 9, 63 }, { 7, 50 },
- { 16, 39 }, { 5, 44 }, { 4, 52 }, { 11, 48 },
- { -5, 60 }, { -1, 59 }, { 0, 59 }, { 22, 33 },
- { 5, 44 }, { 14, 43 }, { -1, 78 }, { 0, 60 },
- { 9, 69 },
-
- /* 166 - 226 */
- { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
- { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
- { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
- { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
- { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
- { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
- { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
- { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
- { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
- { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
- { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
- { 1, 67 }, { 5, 59 }, { 9, 67 }, { 16, 30 },
- { 18, 32 }, { 18, 35 }, { 22, 29 }, { 24, 31 },
- { 23, 38 }, { 18, 43 }, { 20, 41 }, { 11, 63 },
- { 9, 59 }, { 9, 64 }, { -1, 94 }, { -2, 89 },
- { -9, 108 },
-
- /* 227 - 275 */
- { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
- { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
- { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
- { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
- { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
- { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
- { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
- { -3, 74 }, { -10, 90 }, { 0, 70 }, { -4, 29 },
- { 5, 31 }, { 7, 42 }, { 1, 59 }, { -2, 58 },
- { -3, 72 }, { -3, 81 }, { -11, 97 }, { 0, 58 },
- { 8, 5 }, { 10, 14 }, { 14, 18 }, { 13, 27 },
- { 2, 40 }, { 0, 58 }, { -3, 70 }, { -6, 79 },
- { -8, 85 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 - 337 */
- { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
- { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
- { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
- { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
- { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
- { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
- { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
- { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
- { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
- { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
- { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
- { -2, 69 }, { -2, 59 }, { 6, 70 }, { 10, 44 },
- { 9, 31 }, { 12, 43 }, { 3, 53 }, { 14, 34 },
- { 10, 38 }, { -3, 52 }, { 13, 40 }, { 17, 32 },
- { 7, 44 }, { 7, 38 }, { 13, 50 }, { 10, 57 },
- { 26, 43 },
-
- /* 338 - 398 */
- { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
- { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
- { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
- { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
- { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
- { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
- { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
- { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
- { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
- { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
- { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
- { 8, 60 }, { 6, 63 }, { 17, 65 }, { 21, 24 },
- { 23, 20 }, { 26, 23 }, { 27, 32 }, { 28, 23 },
- { 28, 24 }, { 23, 40 }, { 24, 32 }, { 28, 29 },
- { 23, 42 }, { 19, 57 }, { 22, 53 }, { 22, 61 },
- { 11, 86 },
-
- /* 399 -> 435 */
- { 12, 40 }, { 11, 51 }, { 14, 59 },
- { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
- { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
- { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
- { -16, 66 }, { -22, 65 }, { -20, 63 }, { 9, -2 },
- { 26, -9 }, { 33, -9 }, { 39, -7 }, { 41, -2 },
- { 45, 3 }, { 49, 9 }, { 45, 27 }, { 36, 59 },
- { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
- { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
- { -8, 66 }, { -8, 76 },
-
- /* 436 -> 459 */
- { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
- { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
- { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
- { -14, 66 }, { 0, 59 }, { 2, 59 }, { 21, -13 },
- { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
- { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
-
- /* 460 - 1024 */
- { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
- { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
- { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
- { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
- { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
- { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
- { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
- { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
- { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
- { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
- { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
- { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
- { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
- { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
- { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
- { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
- { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
- { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
- { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
- { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
- { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
- { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
- { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
- { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
- { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
- { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
- { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
- { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
- { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
- { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
- { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
- { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
- { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
- { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
- { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
- { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
- { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
- { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
- { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
- { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
- { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
- { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
- { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
- { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
- { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
- { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
- { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
- { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
- { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
- { -16, 66 }, { -22, 65 }, { -20, 63 }, { -5, 85 },
- { -6, 81 }, { -10, 77 }, { -7, 81 }, { -17, 80 },
- { -18, 73 }, { -4, 74 }, { -10, 83 }, { -9, 71 },
- { -9, 67 }, { -1, 61 }, { -8, 66 }, { -14, 66 },
- { 0, 59 }, { 2, 59 }, { 9, -2 }, { 26, -9 },
- { 33, -9 }, { 39, -7 }, { 41, -2 }, { 45, 3 },
- { 49, 9 }, { 45, 27 }, { 36, 59 }, { 21, -13 },
- { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
- { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
- { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
- { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
- { -8, 66 }, { -8, 76 }, { -4, 79 }, { -7, 71 },
- { -5, 69 }, { -9, 70 }, { -8, 66 }, { -10, 68 },
- { -19, 73 }, { -12, 69 }, { -16, 70 }, { -15, 67 },
- { -20, 62 }, { -19, 70 }, { -16, 66 }, { -22, 65 },
- { -20, 63 }, { -5, 85 }, { -6, 81 }, { -10, 77 },
- { -7, 81 }, { -17, 80 }, { -18, 73 }, { -4, 74 },
- { -10, 83 }, { -9, 71 }, { -9, 67 }, { -1, 61 },
- { -8, 66 }, { -14, 66 }, { 0, 59 }, { 2, 59 },
- { 9, -2 }, { 26, -9 }, { 33, -9 }, { 39, -7 },
- { 41, -2 }, { 45, 3 }, { 49, 9 }, { 45, 27 },
- { 36, 59 }, { 21, -13 }, { 33, -14 }, { 39, -7 },
- { 46, -2 }, { 51, 2 }, { 60, 6 }, { 61, 17 },
- { 55, 34 }, { 42, 62 }, { -6, 66 }, { -7, 35 },
- { -7, 42 }, { -8, 45 }, { -5, 48 }, { -12, 56 },
- { -6, 60 }, { -5, 62 }, { -8, 66 }, { -8, 76 },
- { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
- { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
- { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
- { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
- { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
- { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
- { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
- { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
- { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
- { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
- { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
- { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
- { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
- { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
- { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
- { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
- { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
- { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
- { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
- { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
- { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
- { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
- { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
- { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
- { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
- { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
- { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
- { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
- { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
- { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
- { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
- { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
- { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
- { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
- { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
- { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
- { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
- { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
- { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
- { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
- { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
- { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
- { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
- { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
- { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
- { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
- { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
- { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
- { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
- { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
- { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
- { -3, 74 }, { -10, 90 }, { -6, 76 }, { -2, 44 },
- { 0, 45 }, { 0, 52 }, { -3, 64 }, { -2, 59 },
- { -4, 70 }, { -4, 75 }, { -8, 82 }, { -17, 102 },
- { -9, 77 }, { 3, 24 }, { 0, 42 }, { 0, 48 },
- { 0, 55 }, { -6, 59 }, { -7, 71 }, { -12, 83 },
- { -11, 87 }, { -30, 119 }, { 1, 58 }, { -3, 29 },
- { -1, 36 }, { 1, 38 }, { 2, 43 }, { -6, 55 },
- { 0, 58 }, { 0, 64 }, { -3, 74 }, { -10, 90 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
- { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }
- },
-
- /* i_cabac_init_idc == 1 */
- {
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 */
- { 22, 25 }, { 34, 0 }, { 16, 0 }, { -2, 9 },
- { 4, 41 }, { -29, 118 }, { 2, 65 }, { -6, 71 },
- { -13, 79 }, { 5, 52 }, { 9, 50 }, { -3, 70 },
- { 10, 54 },
-
- /* 24 - 39 */
- { 26, 34 }, { 19, 22 }, { 40, 0 }, { 57, 2 },
- { 41, 36 }, { 26, 69 }, { -45, 127 }, { -15, 101 },
- { -4, 76 }, { -6, 71 }, { -13, 79 }, { 5, 52 },
- { 6, 69 }, { -13, 90 }, { 0, 52 }, { 8, 43 },
-
- /* 40 - 53 */
- { -2, 69 },{ -5, 82 },{ -10, 96 },{ 2, 59 },
- { 2, 75 },{ -3, 87 },{ -3, 100 },{ 1, 56 },
- { -3, 74 },{ -6, 85 },{ 0, 59 },{ -3, 81 },
- { -7, 86 },{ -5, 95 },
-
- /* 54 - 59 */
- { -1, 66 },{ -1, 77 },{ 1, 70 },{ -2, 86 },
- { -5, 72 },{ 0, 61 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 - 104 */
- { 13, 15 }, { 7, 51 }, { 2, 80 }, { -39, 127 },
- { -18, 91 }, { -17, 96 }, { -26, 81 }, { -35, 98 },
- { -24, 102 }, { -23, 97 }, { -27, 119 }, { -24, 99 },
- { -21, 110 }, { -18, 102 }, { -36, 127 }, { 0, 80 },
- { -5, 89 }, { -7, 94 }, { -4, 92 }, { 0, 39 },
- { 0, 65 }, { -15, 84 }, { -35, 127 }, { -2, 73 },
- { -12, 104 }, { -9, 91 }, { -31, 127 }, { 3, 55 },
- { 7, 56 }, { 7, 55 }, { 8, 61 }, { -3, 53 },
- { 0, 68 }, { -7, 74 }, { -9, 88 },
-
- /* 105 -> 165 */
- { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
- { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
- { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
- { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
- { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
- { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
- { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
- { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
- { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
- { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
- { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
- { -4, 71 }, { 0, 58 }, { 7, 61 }, { 9, 41 },
- { 18, 25 }, { 9, 32 }, { 5, 43 }, { 9, 47 },
- { 0, 44 }, { 0, 51 }, { 2, 46 }, { 19, 38 },
- { -4, 66 }, { 15, 38 }, { 12, 42 }, { 9, 34 },
- { 0, 89 },
-
- /* 166 - 226 */
- { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
- { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
- { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
- { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
- { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
- { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
- { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
- { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
- { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
- { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
- { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
- { 0, 75 }, { 2, 72 }, { 8, 77 }, { 14, 35 },
- { 18, 31 }, { 17, 35 }, { 21, 30 }, { 17, 45 },
- { 20, 42 }, { 18, 45 }, { 27, 26 }, { 16, 54 },
- { 7, 66 }, { 16, 56 }, { 11, 73 }, { 10, 67 },
- { -10, 116 },
-
- /* 227 - 275 */
- { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
- { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
- { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
- { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
- { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
- { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
- { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
- { -5, 74 }, { -9, 86 }, { 2, 66 }, { -9, 34 },
- { 1, 32 }, { 11, 31 }, { 5, 52 }, { -2, 55 },
- { -2, 67 }, { 0, 73 }, { -8, 89 }, { 3, 52 },
- { 7, 4 }, { 10, 8 }, { 17, 8 }, { 16, 19 },
- { 3, 37 }, { -1, 61 }, { -5, 73 }, { -1, 70 },
- { -4, 78 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 - 337 */
- { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
- { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
- { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
- { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
- { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
- { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
- { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
- { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
- { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
- { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
- { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
- { -1, 70 }, { -9, 72 }, { 14, 60 }, { 16, 37 },
- { 0, 47 }, { 18, 35 }, { 11, 37 }, { 12, 41 },
- { 10, 41 }, { 2, 48 }, { 12, 41 }, { 13, 41 },
- { 0, 59 }, { 3, 50 }, { 19, 40 }, { 3, 66 },
- { 18, 50 },
-
- /* 338 - 398 */
- { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
- { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
- { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
- { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
- { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
- { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
- { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
- { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
- { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
- { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
- { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
- { 12, 48 }, { 11, 49 }, { 26, 45 }, { 22, 22 },
- { 23, 22 }, { 27, 21 }, { 33, 20 }, { 26, 28 },
- { 30, 24 }, { 27, 34 }, { 18, 42 }, { 25, 39 },
- { 18, 50 }, { 12, 70 }, { 21, 54 }, { 14, 71 },
- { 11, 83 },
-
- /* 399 -> 435 */
- { 25, 32 }, { 21, 49 }, { 21, 54 },
- { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
- { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
- { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
- { -14, 66 }, { 0, 59 }, { 2, 59 }, { 17, -10 },
- { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
- { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
- { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
- { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
- { -4, 67 }, { -7, 82 },
-
- /* 436 -> 459 */
- { -3, 81 }, { -3, 76 }, { -7, 72 }, { -6, 78 },
- { -12, 72 }, { -14, 68 }, { -3, 70 }, { -6, 76 },
- { -5, 66 }, { -5, 62 }, { 0, 57 }, { -4, 61 },
- { -9, 60 }, { 1, 54 }, { 2, 58 }, { 17, -10 },
- { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
- { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
-
- /* 460 - 1024 */
- { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
- { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
- { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
- { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
- { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
- { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
- { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
- { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
- { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
- { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
- { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
- { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
- { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
- { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
- { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
- { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
- { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
- { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
- { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
- { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
- { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
- { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
- { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
- { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
- { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
- { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
- { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
- { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
- { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
- { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
- { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
- { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
- { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
- { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
- { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
- { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
- { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
- { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
- { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
- { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
- { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
- { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
- { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
- { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
- { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
- { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
- { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
- { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
- { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
- { -14, 66 }, { 0, 59 }, { 2, 59 }, { -3, 81 },
- { -3, 76 }, { -7, 72 }, { -6, 78 }, { -12, 72 },
- { -14, 68 }, { -3, 70 }, { -6, 76 }, { -5, 66 },
- { -5, 62 }, { 0, 57 }, { -4, 61 }, { -9, 60 },
- { 1, 54 }, { 2, 58 }, { 17, -10 }, { 32, -13 },
- { 42, -9 }, { 49, -5 }, { 53, 0 }, { 64, 3 },
- { 68, 10 }, { 66, 27 }, { 47, 57 }, { 17, -10 },
- { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
- { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
- { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
- { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
- { -4, 67 }, { -7, 82 }, { -5, 85 }, { -6, 81 },
- { -10, 77 }, { -7, 81 }, { -17, 80 }, { -18, 73 },
- { -4, 74 }, { -10, 83 }, { -9, 71 }, { -9, 67 },
- { -1, 61 }, { -8, 66 }, { -14, 66 }, { 0, 59 },
- { 2, 59 }, { -3, 81 }, { -3, 76 }, { -7, 72 },
- { -6, 78 }, { -12, 72 }, { -14, 68 }, { -3, 70 },
- { -6, 76 }, { -5, 66 }, { -5, 62 }, { 0, 57 },
- { -4, 61 }, { -9, 60 }, { 1, 54 }, { 2, 58 },
- { 17, -10 }, { 32, -13 }, { 42, -9 }, { 49, -5 },
- { 53, 0 }, { 64, 3 }, { 68, 10 }, { 66, 27 },
- { 47, 57 }, { 17, -10 }, { 32, -13 }, { 42, -9 },
- { 49, -5 }, { 53, 0 }, { 64, 3 }, { 68, 10 },
- { 66, 27 }, { 47, 57 }, { -5, 71 }, { 0, 24 },
- { -1, 36 }, { -2, 42 }, { -2, 52 }, { -9, 57 },
- { -6, 63 }, { -4, 65 }, { -4, 67 }, { -7, 82 },
- { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
- { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
- { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
- { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
- { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
- { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
- { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
- { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
- { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
- { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
- { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
- { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
- { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
- { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
- { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
- { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
- { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
- { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
- { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
- { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
- { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
- { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
- { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
- { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
- { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
- { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
- { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
- { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
- { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
- { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
- { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
- { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
- { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
- { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
- { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
- { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
- { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
- { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
- { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
- { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
- { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
- { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
- { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
- { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
- { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
- { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
- { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
- { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
- { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
- { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
- { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
- { -5, 74 }, { -9, 86 }, { -23, 112 }, { -15, 71 },
- { -7, 61 }, { 0, 53 }, { -5, 66 }, { -11, 77 },
- { -9, 80 }, { -9, 84 }, { -10, 87 }, { -34, 127 },
- { -21, 101 }, { -3, 39 }, { -5, 53 }, { -7, 61 },
- { -11, 75 }, { -15, 77 }, { -17, 91 }, { -25, 107 },
- { -25, 111 }, { -28, 122 }, { -11, 76 }, { -10, 44 },
- { -10, 52 }, { -10, 57 }, { -9, 58 }, { -16, 72 },
- { -7, 69 }, { -4, 69 }, { -5, 74 }, { -9, 86 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
- { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }
- },
-
- /* i_cabac_init_idc == 2 */
- {
- /* 0 - 10 */
- { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
- { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
- { -6, 53 }, { -1, 54 }, { 7, 51 },
-
- /* 11 - 23 */
- { 29, 16 }, { 25, 0 }, { 14, 0 }, { -10, 51 },
- { -3, 62 }, { -27, 99 }, { 26, 16 }, { -4, 85 },
- { -24, 102 }, { 5, 57 }, { 6, 57 }, { -17, 73 },
- { 14, 57 },
-
- /* 24 - 39 */
- { 20, 40 }, { 20, 10 }, { 29, 0 }, { 54, 0 },
- { 37, 42 }, { 12, 97 }, { -32, 127 }, { -22, 117 },
- { -2, 74 }, { -4, 85 }, { -24, 102 }, { 5, 57 },
- { -6, 93 }, { -14, 88 }, { -6, 44 }, { 4, 55 },
-
- /* 40 - 53 */
- { -11, 89 },{ -15, 103 },{ -21, 116 },{ 19, 57 },
- { 20, 58 },{ 4, 84 },{ 6, 96 },{ 1, 63 },
- { -5, 85 },{ -13, 106 },{ 5, 63 },{ 6, 75 },
- { -3, 90 },{ -1, 101 },
-
- /* 54 - 59 */
- { 3, 55 },{ -4, 79 },{ -2, 75 },{ -12, 97 },
- { -7, 50 },{ 1, 60 },
-
- /* 60 - 69 */
- { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
- { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
- { 13, 41 }, { 3, 62 },
-
- /* 70 - 104 */
- { 7, 34 }, { -9, 88 }, { -20, 127 }, { -36, 127 },
- { -17, 91 }, { -14, 95 }, { -25, 84 }, { -25, 86 },
- { -12, 89 }, { -17, 91 }, { -31, 127 }, { -14, 76 },
- { -18, 103 }, { -13, 90 }, { -37, 127 }, { 11, 80 },
- { 5, 76 }, { 2, 84 }, { 5, 78 }, { -6, 55 },
- { 4, 61 }, { -14, 83 }, { -37, 127 }, { -5, 79 },
- { -11, 104 }, { -11, 91 }, { -30, 127 }, { 0, 65 },
- { -2, 79 }, { 0, 72 }, { -4, 92 }, { -6, 56 },
- { 3, 68 }, { -8, 71 }, { -13, 98 },
-
- /* 105 -> 165 */
- { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
- { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
- { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
- { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
- { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
- { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
- { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
- { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
- { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
- { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
- { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
- { 3, 65 }, { -7, 69 }, { 8, 77 }, { -10, 66 },
- { 3, 62 }, { -3, 68 }, { -20, 81 }, { 0, 30 },
- { 1, 7 }, { -3, 23 }, { -21, 74 }, { 16, 66 },
- { -23, 124 }, { 17, 37 }, { 44, -18 }, { 50, -34 },
- { -22, 127 },
-
- /* 166 - 226 */
- { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
- { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
- { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
- { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
- { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
- { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
- { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
- { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
- { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
- { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
- { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
- { 20, 34 }, { 19, 31 }, { 27, 44 }, { 19, 16 },
- { 15, 36 }, { 15, 36 }, { 21, 28 }, { 25, 21 },
- { 30, 20 }, { 31, 12 }, { 27, 16 }, { 24, 42 },
- { 0, 93 }, { 14, 56 }, { 15, 57 }, { 26, 38 },
- { -24, 127 },
-
- /* 227 - 275 */
- { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
- { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
- { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
- { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
- { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
- { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
- { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
- { -12, 92 }, { -18, 108 }, { -4, 79 }, { -22, 69 },
- { -16, 75 }, { -2, 58 }, { 1, 58 }, { -13, 78 },
- { -9, 83 }, { -4, 81 }, { -13, 99 }, { -13, 81 },
- { -6, 38 }, { -13, 62 }, { -6, 58 }, { -2, 59 },
- { -16, 73 }, { -10, 76 }, { -13, 86 }, { -9, 83 },
- { -10, 87 },
-
- /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
- { 0, 0 },
-
- /* 277 - 337 */
- { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
- { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
- { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
- { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
- { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
- { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
- { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
- { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
- { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
- { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
- { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
- { -2, 76 }, { -18, 86 }, { 12, 70 }, { 5, 64 },
- { -12, 70 }, { 11, 55 }, { 5, 56 }, { 0, 69 },
- { 2, 65 }, { -6, 74 }, { 5, 54 }, { 7, 54 },
- { -6, 76 }, { -11, 82 }, { -2, 77 }, { -2, 77 },
- { 25, 42 },
-
- /* 338 - 398 */
- { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
- { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
- { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
- { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
- { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
- { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
- { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
- { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
- { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
- { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
- { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
- { 18, 31 }, { 19, 26 }, { 36, 24 }, { 24, 23 },
- { 27, 16 }, { 24, 30 }, { 31, 29 }, { 22, 41 },
- { 22, 42 }, { 16, 60 }, { 15, 52 }, { 14, 60 },
- { 3, 78 }, { -16, 123 }, { 21, 53 }, { 22, 56 },
- { 25, 61 },
-
- /* 399 -> 435 */
- { 21, 33 }, { 19, 50 }, { 17, 61 },
- { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
- { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
- { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
- { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
- { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
- { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
- { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
- { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
- { -6, 68 }, { -10, 79 },
-
- /* 436 -> 459 */
- { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
- { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
- { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
- { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
- { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
- { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
-
- /* 460 - 1024 */
- { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
- { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
- { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
- { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
- { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
- { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
- { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
- { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
- { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
- { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
- { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
- { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
- { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
- { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
- { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
- { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
- { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
- { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
- { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
- { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
- { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
- { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
- { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
- { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
- { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
- { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
- { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
- { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
- { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
- { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
- { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
- { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
- { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
- { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
- { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
- { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
- { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
- { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
- { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
- { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
- { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
- { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
- { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
- { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
- { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
- { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
- { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
- { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
- { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
- { -14, 59 }, { -9, 52 }, { -11, 68 }, { -3, 78 },
- { -8, 74 }, { -9, 72 }, { -10, 72 }, { -18, 75 },
- { -12, 71 }, { -11, 63 }, { -5, 70 }, { -17, 75 },
- { -14, 72 }, { -16, 67 }, { -8, 53 }, { -14, 59 },
- { -9, 52 }, { -11, 68 }, { 9, -2 }, { 30, -10 },
- { 31, -4 }, { 33, -1 }, { 33, 7 }, { 31, 12 },
- { 37, 23 }, { 31, 38 }, { 20, 64 }, { 9, -2 },
- { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
- { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
- { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
- { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
- { -6, 68 }, { -10, 79 }, { -3, 78 }, { -8, 74 },
- { -9, 72 }, { -10, 72 }, { -18, 75 }, { -12, 71 },
- { -11, 63 }, { -5, 70 }, { -17, 75 }, { -14, 72 },
- { -16, 67 }, { -8, 53 }, { -14, 59 }, { -9, 52 },
- { -11, 68 }, { -3, 78 }, { -8, 74 }, { -9, 72 },
- { -10, 72 }, { -18, 75 }, { -12, 71 }, { -11, 63 },
- { -5, 70 }, { -17, 75 }, { -14, 72 }, { -16, 67 },
- { -8, 53 }, { -14, 59 }, { -9, 52 }, { -11, 68 },
- { 9, -2 }, { 30, -10 }, { 31, -4 }, { 33, -1 },
- { 33, 7 }, { 31, 12 }, { 37, 23 }, { 31, 38 },
- { 20, 64 }, { 9, -2 }, { 30, -10 }, { 31, -4 },
- { 33, -1 }, { 33, 7 }, { 31, 12 }, { 37, 23 },
- { 31, 38 }, { 20, 64 }, { -9, 71 }, { -7, 37 },
- { -8, 44 }, { -11, 49 }, { -10, 56 }, { -12, 59 },
- { -8, 63 }, { -9, 67 }, { -6, 68 }, { -10, 79 },
- { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
- { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
- { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
- { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
- { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
- { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
- { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
- { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
- { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
- { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
- { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
- { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
- { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
- { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
- { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
- { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
- { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
- { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
- { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
- { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
- { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
- { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
- { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
- { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
- { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
- { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
- { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
- { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
- { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
- { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
- { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
- { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
- { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
- { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
- { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
- { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
- { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
- { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
- { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
- { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
- { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
- { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
- { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
- { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
- { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
- { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
- { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
- { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
- { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
- { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
- { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
- { -12, 92 }, { -18, 108 }, { -24, 115 }, { -22, 82 },
- { -9, 62 }, { 0, 53 }, { 0, 59 }, { -14, 85 },
- { -13, 89 }, { -13, 94 }, { -11, 92 }, { -29, 127 },
- { -21, 100 }, { -14, 57 }, { -12, 67 }, { -11, 71 },
- { -10, 77 }, { -21, 85 }, { -16, 88 }, { -23, 104 },
- { -15, 98 }, { -37, 127 }, { -10, 82 }, { -8, 48 },
- { -8, 61 }, { -8, 66 }, { -7, 70 }, { -14, 75 },
- { -10, 79 }, { -9, 83 }, { -12, 92 }, { -18, 108 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
- { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }
- }
-};
-
-const uint8_t x264_cabac_range_lps[64][4] =
-{
- { 2, 2, 2, 2}, { 6, 7, 8, 9}, { 6, 7, 9, 10}, { 6, 8, 9, 11},
- { 7, 8, 10, 11}, { 7, 9, 10, 12}, { 7, 9, 11, 12}, { 8, 9, 11, 13},
- { 8, 10, 12, 14}, { 9, 11, 12, 14}, { 9, 11, 13, 15}, { 10, 12, 14, 16},
- { 10, 12, 15, 17}, { 11, 13, 15, 18}, { 11, 14, 16, 19}, { 12, 14, 17, 20},
- { 12, 15, 18, 21}, { 13, 16, 19, 22}, { 14, 17, 20, 23}, { 14, 18, 21, 24},
- { 15, 19, 22, 25}, { 16, 20, 23, 27}, { 17, 21, 25, 28}, { 18, 22, 26, 30},
- { 19, 23, 27, 31}, { 20, 24, 29, 33}, { 21, 26, 30, 35}, { 22, 27, 32, 37},
- { 23, 28, 33, 39}, { 24, 30, 35, 41}, { 26, 31, 37, 43}, { 27, 33, 39, 45},
- { 29, 35, 41, 48}, { 30, 37, 43, 50}, { 32, 39, 46, 53}, { 33, 41, 48, 56},
- { 35, 43, 51, 59}, { 37, 45, 54, 62}, { 39, 48, 56, 65}, { 41, 50, 59, 69},
- { 43, 53, 63, 72}, { 46, 56, 66, 76}, { 48, 59, 69, 80}, { 51, 62, 73, 85},
- { 53, 65, 77, 89}, { 56, 69, 81, 94}, { 59, 72, 86, 99}, { 62, 76, 90, 104},
- { 66, 80, 95, 110}, { 69, 85, 100, 116}, { 73, 89, 105, 122}, { 77, 94, 111, 128},
- { 81, 99, 117, 135}, { 85, 104, 123, 142}, { 90, 110, 130, 150}, { 95, 116, 137, 158},
- {100, 122, 144, 166}, {105, 128, 152, 175}, {111, 135, 160, 185}, {116, 142, 169, 195},
- {123, 150, 178, 205}, {128, 158, 187, 216}, {128, 167, 197, 227}, {128, 176, 208, 240}
-};
-
-const uint8_t x264_cabac_transition[128][2] =
-{
- { 0, 0}, { 1, 1}, { 2, 50}, { 51, 3}, { 2, 50}, { 51, 3}, { 4, 52}, { 53, 5},
- { 6, 52}, { 53, 7}, { 8, 52}, { 53, 9}, { 10, 54}, { 55, 11}, { 12, 54}, { 55, 13},
- { 14, 54}, { 55, 15}, { 16, 56}, { 57, 17}, { 18, 56}, { 57, 19}, { 20, 56}, { 57, 21},
- { 22, 58}, { 59, 23}, { 24, 58}, { 59, 25}, { 26, 60}, { 61, 27}, { 28, 60}, { 61, 29},
- { 30, 60}, { 61, 31}, { 32, 62}, { 63, 33}, { 34, 62}, { 63, 35}, { 36, 64}, { 65, 37},
- { 38, 66}, { 67, 39}, { 40, 66}, { 67, 41}, { 42, 66}, { 67, 43}, { 44, 68}, { 69, 45},
- { 46, 68}, { 69, 47}, { 48, 70}, { 71, 49}, { 50, 72}, { 73, 51}, { 52, 72}, { 73, 53},
- { 54, 74}, { 75, 55}, { 56, 74}, { 75, 57}, { 58, 76}, { 77, 59}, { 60, 78}, { 79, 61},
- { 62, 78}, { 79, 63}, { 64, 80}, { 81, 65}, { 66, 82}, { 83, 67}, { 68, 82}, { 83, 69},
- { 70, 84}, { 85, 71}, { 72, 84}, { 85, 73}, { 74, 88}, { 89, 75}, { 76, 88}, { 89, 77},
- { 78, 90}, { 91, 79}, { 80, 90}, { 91, 81}, { 82, 94}, { 95, 83}, { 84, 94}, { 95, 85},
- { 86, 96}, { 97, 87}, { 88, 96}, { 97, 89}, { 90, 100}, {101, 91}, { 92, 100}, {101, 93},
- { 94, 102}, {103, 95}, { 96, 104}, {105, 97}, { 98, 104}, {105, 99}, {100, 108}, {109, 101},
- {102, 108}, {109, 103}, {104, 110}, {111, 105}, {106, 112}, {113, 107}, {108, 114}, {115, 109},
- {110, 116}, {117, 111}, {112, 118}, {119, 113}, {114, 118}, {119, 115}, {116, 122}, {123, 117},
- {118, 122}, {123, 119}, {120, 124}, {125, 121}, {122, 126}, {127, 123}, {124, 127}, {126, 125}
-};
-
-const uint8_t x264_cabac_renorm_shift[64] =
-{
- 6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-/* -ln2(probability) */
-const uint16_t x264_cabac_entropy[128] =
-{
- FIX8(0.0273), FIX8(5.7370), FIX8(0.0288), FIX8(5.6618),
- FIX8(0.0303), FIX8(5.5866), FIX8(0.0320), FIX8(5.5114),
- FIX8(0.0337), FIX8(5.4362), FIX8(0.0355), FIX8(5.3610),
- FIX8(0.0375), FIX8(5.2859), FIX8(0.0395), FIX8(5.2106),
- FIX8(0.0416), FIX8(5.1354), FIX8(0.0439), FIX8(5.0602),
- FIX8(0.0463), FIX8(4.9851), FIX8(0.0488), FIX8(4.9099),
- FIX8(0.0515), FIX8(4.8347), FIX8(0.0543), FIX8(4.7595),
- FIX8(0.0572), FIX8(4.6843), FIX8(0.0604), FIX8(4.6091),
- FIX8(0.0637), FIX8(4.5339), FIX8(0.0671), FIX8(4.4588),
- FIX8(0.0708), FIX8(4.3836), FIX8(0.0747), FIX8(4.3083),
- FIX8(0.0788), FIX8(4.2332), FIX8(0.0832), FIX8(4.1580),
- FIX8(0.0878), FIX8(4.0828), FIX8(0.0926), FIX8(4.0076),
- FIX8(0.0977), FIX8(3.9324), FIX8(0.1032), FIX8(3.8572),
- FIX8(0.1089), FIX8(3.7820), FIX8(0.1149), FIX8(3.7068),
- FIX8(0.1214), FIX8(3.6316), FIX8(0.1282), FIX8(3.5565),
- FIX8(0.1353), FIX8(3.4813), FIX8(0.1429), FIX8(3.4061),
- FIX8(0.1510), FIX8(3.3309), FIX8(0.1596), FIX8(3.2557),
- FIX8(0.1686), FIX8(3.1805), FIX8(0.1782), FIX8(3.1053),
- FIX8(0.1884), FIX8(3.0301), FIX8(0.1992), FIX8(2.9549),
- FIX8(0.2107), FIX8(2.8797), FIX8(0.2229), FIX8(2.8046),
- FIX8(0.2358), FIX8(2.7294), FIX8(0.2496), FIX8(2.6542),
- FIX8(0.2642), FIX8(2.5790), FIX8(0.2798), FIX8(2.5038),
- FIX8(0.2964), FIX8(2.4286), FIX8(0.3142), FIX8(2.3534),
- FIX8(0.3331), FIX8(2.2782), FIX8(0.3532), FIX8(2.2030),
- FIX8(0.3748), FIX8(2.1278), FIX8(0.3979), FIX8(2.0527),
- FIX8(0.4226), FIX8(1.9775), FIX8(0.4491), FIX8(1.9023),
- FIX8(0.4776), FIX8(1.8271), FIX8(0.5082), FIX8(1.7519),
- FIX8(0.5412), FIX8(1.6767), FIX8(0.5768), FIX8(1.6015),
- FIX8(0.6152), FIX8(1.5263), FIX8(0.6568), FIX8(1.4511),
- FIX8(0.7020), FIX8(1.3759), FIX8(0.7513), FIX8(1.3008),
- FIX8(0.8050), FIX8(1.2256), FIX8(0.8638), FIX8(1.1504),
- FIX8(0.9285), FIX8(1.0752), FIX8(1.0000), FIX8(1.0000)
-};
-
static uint8_t cabac_contexts[4][QP_MAX_SPEC+1][1024];
void x264_cabac_init( x264_t *h )
int ctx_count = CHROMA444 ? 1024 : 460;
for( int i = 0; i < 4; i++ )
{
- const int8_t (*cabac_context_init)[1024][2] = i == 0 ? &cabac_context_init_I
- : &cabac_context_init_PB[i-1];
+ const int8_t (*cabac_context_init)[1024][2] = i == 0 ? &x264_cabac_context_init_I
+ : &x264_cabac_context_init_PB[i-1];
for( int qp = 0; qp <= QP_MAX_SPEC; qp++ )
for( int j = 0; j < ctx_count; j++ )
{
uint8_t padding[12];
} x264_cabac_t;
-extern const uint8_t x264_cabac_transition[128][2];
-extern const uint16_t x264_cabac_entropy[128];
-
/* init the contexts given i_slice_type, the quantif and the model */
+#define x264_cabac_context_init x264_template(cabac_context_init)
void x264_cabac_context_init( x264_t *h, x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model );
+#define x264_cabac_encode_init_core x264_template(cabac_encode_init_core)
void x264_cabac_encode_init_core( x264_cabac_t *cb );
+#define x264_cabac_encode_init x264_template(cabac_encode_init)
void x264_cabac_encode_init( x264_cabac_t *cb, uint8_t *p_data, uint8_t *p_end );
+#define x264_cabac_encode_decision_c x264_template(cabac_encode_decision_c)
void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b );
+#define x264_cabac_encode_decision_asm x264_template(cabac_encode_decision_asm)
void x264_cabac_encode_decision_asm( x264_cabac_t *cb, int i_ctx, int b );
+#define x264_cabac_encode_bypass_c x264_template(cabac_encode_bypass_c)
void x264_cabac_encode_bypass_c( x264_cabac_t *cb, int b );
+#define x264_cabac_encode_bypass_asm x264_template(cabac_encode_bypass_asm)
void x264_cabac_encode_bypass_asm( x264_cabac_t *cb, int b );
+#define x264_cabac_encode_terminal_c x264_template(cabac_encode_terminal_c)
void x264_cabac_encode_terminal_c( x264_cabac_t *cb );
+#define x264_cabac_encode_terminal_asm x264_template(cabac_encode_terminal_asm)
void x264_cabac_encode_terminal_asm( x264_cabac_t *cb );
+#define x264_cabac_encode_ue_bypass x264_template(cabac_encode_ue_bypass)
void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val );
+#define x264_cabac_encode_flush x264_template(cabac_encode_flush)
void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb );
#if HAVE_MMX
#include "common.h"
-#include <ctype.h>
-
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_THP
-#include <sys/mman.h>
-#endif
-
-const int x264_bit_depth = BIT_DEPTH;
-
-const int x264_chroma_format = X264_CHROMA_FORMAT;
-
-static void log_default( void *, int, const char *, va_list );
-
-/****************************************************************************
- * x264_param_default:
- ****************************************************************************/
-void x264_param_default( x264_param_t *param )
-{
- /* */
- memset( param, 0, sizeof( x264_param_t ) );
-
- /* CPU autodetect */
- param->cpu = x264_cpu_detect();
- param->i_threads = X264_THREADS_AUTO;
- param->i_lookahead_threads = X264_THREADS_AUTO;
- param->b_deterministic = 1;
- param->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
-
- /* Video properties */
- param->i_csp = X264_CHROMA_FORMAT ? X264_CHROMA_FORMAT : X264_CSP_I420;
- param->i_width = 0;
- param->i_height = 0;
- param->vui.i_sar_width = 0;
- param->vui.i_sar_height= 0;
- param->vui.i_overscan = 0; /* undef */
- param->vui.i_vidformat = 5; /* undef */
- param->vui.b_fullrange = -1; /* default depends on input */
- param->vui.i_colorprim = 2; /* undef */
- param->vui.i_transfer = 2; /* undef */
- param->vui.i_colmatrix = -1; /* default depends on input */
- param->vui.i_chroma_loc= 0; /* left center */
- param->i_fps_num = 25;
- param->i_fps_den = 1;
- param->i_level_idc = -1;
- param->i_slice_max_size = 0;
- param->i_slice_max_mbs = 0;
- param->i_slice_count = 0;
-
- /* Encoder parameters */
- param->i_frame_reference = 3;
- param->i_keyint_max = 250;
- param->i_keyint_min = X264_KEYINT_MIN_AUTO;
- param->i_bframe = 3;
- param->i_scenecut_threshold = 40;
- param->i_bframe_adaptive = X264_B_ADAPT_FAST;
- param->i_bframe_bias = 0;
- param->i_bframe_pyramid = X264_B_PYRAMID_NORMAL;
- param->b_interlaced = 0;
- param->b_constrained_intra = 0;
-
- param->b_deblocking_filter = 1;
- param->i_deblocking_filter_alphac0 = 0;
- param->i_deblocking_filter_beta = 0;
-
- param->b_cabac = 1;
- param->i_cabac_init_idc = 0;
-
- param->rc.i_rc_method = X264_RC_CRF;
- param->rc.i_bitrate = 0;
- param->rc.f_rate_tolerance = 1.0;
- param->rc.i_vbv_max_bitrate = 0;
- param->rc.i_vbv_buffer_size = 0;
- param->rc.f_vbv_buffer_init = 0.9;
- param->rc.i_qp_constant = -1;
- param->rc.f_rf_constant = 23;
- param->rc.i_qp_min = 0;
- param->rc.i_qp_max = INT_MAX;
- param->rc.i_qp_step = 4;
- param->rc.f_ip_factor = 1.4;
- param->rc.f_pb_factor = 1.3;
- param->rc.i_aq_mode = X264_AQ_VARIANCE;
- param->rc.f_aq_strength = 1.0;
- param->rc.i_lookahead = 40;
-
- param->rc.b_stat_write = 0;
- param->rc.psz_stat_out = "x264_2pass.log";
- param->rc.b_stat_read = 0;
- param->rc.psz_stat_in = "x264_2pass.log";
- param->rc.f_qcompress = 0.6;
- param->rc.f_qblur = 0.5;
- param->rc.f_complexity_blur = 20;
- param->rc.i_zones = 0;
- param->rc.b_mb_tree = 1;
-
- /* Log */
- param->pf_log = log_default;
- param->p_log_private = NULL;
- param->i_log_level = X264_LOG_INFO;
-
- /* */
- param->analyse.intra = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8;
- param->analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8
- | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_BSUB16x16;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
- param->analyse.i_me_method = X264_ME_HEX;
- param->analyse.f_psy_rd = 1.0;
- param->analyse.b_psy = 1;
- param->analyse.f_psy_trellis = 0;
- param->analyse.i_me_range = 16;
- param->analyse.i_subpel_refine = 7;
- param->analyse.b_mixed_references = 1;
- param->analyse.b_chroma_me = 1;
- param->analyse.i_mv_range_thread = -1;
- param->analyse.i_mv_range = -1; // set from level_idc
- param->analyse.i_chroma_qp_offset = 0;
- param->analyse.b_fast_pskip = 1;
- param->analyse.b_weighted_bipred = 1;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SMART;
- param->analyse.b_dct_decimate = 1;
- param->analyse.b_transform_8x8 = 1;
- param->analyse.i_trellis = 1;
- param->analyse.i_luma_deadzone[0] = 21;
- param->analyse.i_luma_deadzone[1] = 11;
- param->analyse.b_psnr = 0;
- param->analyse.b_ssim = 0;
-
- param->i_cqm_preset = X264_CQM_FLAT;
- memset( param->cqm_4iy, 16, sizeof( param->cqm_4iy ) );
- memset( param->cqm_4py, 16, sizeof( param->cqm_4py ) );
- memset( param->cqm_4ic, 16, sizeof( param->cqm_4ic ) );
- memset( param->cqm_4pc, 16, sizeof( param->cqm_4pc ) );
- memset( param->cqm_8iy, 16, sizeof( param->cqm_8iy ) );
- memset( param->cqm_8py, 16, sizeof( param->cqm_8py ) );
- memset( param->cqm_8ic, 16, sizeof( param->cqm_8ic ) );
- memset( param->cqm_8pc, 16, sizeof( param->cqm_8pc ) );
-
- param->b_repeat_headers = 1;
- param->b_annexb = 1;
- param->b_aud = 0;
- param->b_vfr_input = 1;
- param->i_nal_hrd = X264_NAL_HRD_NONE;
- param->b_tff = 1;
- param->b_pic_struct = 0;
- param->b_fake_interlaced = 0;
- param->i_frame_packing = -1;
- param->b_opencl = 0;
- param->i_opencl_device = 0;
- param->opencl_device_id = NULL;
- param->psz_clbin_file = NULL;
-}
-
-static int param_apply_preset( x264_param_t *param, const char *preset )
-{
- char *end;
- int i = strtol( preset, &end, 10 );
- if( *end == 0 && i >= 0 && i < sizeof(x264_preset_names)/sizeof(*x264_preset_names)-1 )
- preset = x264_preset_names[i];
-
- if( !strcasecmp( preset, "ultrafast" ) )
- {
- param->i_frame_reference = 1;
- param->i_scenecut_threshold = 0;
- param->b_deblocking_filter = 0;
- param->b_cabac = 0;
- param->i_bframe = 0;
- param->analyse.intra = 0;
- param->analyse.inter = 0;
- param->analyse.b_transform_8x8 = 0;
- param->analyse.i_me_method = X264_ME_DIA;
- param->analyse.i_subpel_refine = 0;
- param->rc.i_aq_mode = 0;
- param->analyse.b_mixed_references = 0;
- param->analyse.i_trellis = 0;
- param->i_bframe_adaptive = X264_B_ADAPT_NONE;
- param->rc.b_mb_tree = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
- param->analyse.b_weighted_bipred = 0;
- param->rc.i_lookahead = 0;
- }
- else if( !strcasecmp( preset, "superfast" ) )
- {
- param->analyse.inter = X264_ANALYSE_I8x8|X264_ANALYSE_I4x4;
- param->analyse.i_me_method = X264_ME_DIA;
- param->analyse.i_subpel_refine = 1;
- param->i_frame_reference = 1;
- param->analyse.b_mixed_references = 0;
- param->analyse.i_trellis = 0;
- param->rc.b_mb_tree = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 0;
- }
- else if( !strcasecmp( preset, "veryfast" ) )
- {
- param->analyse.i_subpel_refine = 2;
- param->i_frame_reference = 1;
- param->analyse.b_mixed_references = 0;
- param->analyse.i_trellis = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 10;
- }
- else if( !strcasecmp( preset, "faster" ) )
- {
- param->analyse.b_mixed_references = 0;
- param->i_frame_reference = 2;
- param->analyse.i_subpel_refine = 4;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 20;
- }
- else if( !strcasecmp( preset, "fast" ) )
- {
- param->i_frame_reference = 2;
- param->analyse.i_subpel_refine = 6;
- param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE;
- param->rc.i_lookahead = 30;
- }
- else if( !strcasecmp( preset, "medium" ) )
- {
- /* Default is medium */
- }
- else if( !strcasecmp( preset, "slow" ) )
- {
- param->analyse.i_subpel_refine = 8;
- param->i_frame_reference = 5;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.i_trellis = 2;
- param->rc.i_lookahead = 50;
- }
- else if( !strcasecmp( preset, "slower" ) )
- {
- param->analyse.i_me_method = X264_ME_UMH;
- param->analyse.i_subpel_refine = 9;
- param->i_frame_reference = 8;
- param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- param->analyse.i_trellis = 2;
- param->rc.i_lookahead = 60;
- }
- else if( !strcasecmp( preset, "veryslow" ) )
- {
- param->analyse.i_me_method = X264_ME_UMH;
- param->analyse.i_subpel_refine = 10;
- param->analyse.i_me_range = 24;
- param->i_frame_reference = 16;
- param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- param->analyse.i_trellis = 2;
- param->i_bframe = 8;
- param->rc.i_lookahead = 60;
- }
- else if( !strcasecmp( preset, "placebo" ) )
- {
- param->analyse.i_me_method = X264_ME_TESA;
- param->analyse.i_subpel_refine = 11;
- param->analyse.i_me_range = 24;
- param->i_frame_reference = 16;
- param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS;
- param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- param->analyse.b_fast_pskip = 0;
- param->analyse.i_trellis = 2;
- param->i_bframe = 16;
- param->rc.i_lookahead = 60;
- }
- else
- {
- x264_log( NULL, X264_LOG_ERROR, "invalid preset '%s'\n", preset );
- return -1;
- }
- return 0;
-}
-
-static int param_apply_tune( x264_param_t *param, const char *tune )
-{
- char *tmp = x264_malloc( strlen( tune ) + 1 );
- if( !tmp )
- return -1;
- tmp = strcpy( tmp, tune );
- char *s = strtok( tmp, ",./-+" );
- int psy_tuning_used = 0;
- while( s )
- {
- if( !strncasecmp( s, "film", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_deblocking_filter_alphac0 = -1;
- param->i_deblocking_filter_beta = -1;
- param->analyse.f_psy_trellis = 0.15;
- }
- else if( !strncasecmp( s, "animation", 9 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1;
- param->i_deblocking_filter_alphac0 = 1;
- param->i_deblocking_filter_beta = 1;
- param->analyse.f_psy_rd = 0.4;
- param->rc.f_aq_strength = 0.6;
- param->i_bframe += 2;
- }
- else if( !strncasecmp( s, "grain", 5 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_deblocking_filter_alphac0 = -2;
- param->i_deblocking_filter_beta = -2;
- param->analyse.f_psy_trellis = 0.25;
- param->analyse.b_dct_decimate = 0;
- param->rc.f_pb_factor = 1.1;
- param->rc.f_ip_factor = 1.1;
- param->rc.f_aq_strength = 0.5;
- param->analyse.i_luma_deadzone[0] = 6;
- param->analyse.i_luma_deadzone[1] = 6;
- param->rc.f_qcompress = 0.8;
- }
- else if( !strncasecmp( s, "stillimage", 10 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_deblocking_filter_alphac0 = -3;
- param->i_deblocking_filter_beta = -3;
- param->analyse.f_psy_rd = 2.0;
- param->analyse.f_psy_trellis = 0.7;
- param->rc.f_aq_strength = 1.2;
- }
- else if( !strncasecmp( s, "psnr", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->rc.i_aq_mode = X264_AQ_NONE;
- param->analyse.b_psy = 0;
- }
- else if( !strncasecmp( s, "ssim", 4 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->rc.i_aq_mode = X264_AQ_AUTOVARIANCE;
- param->analyse.b_psy = 0;
- }
- else if( !strncasecmp( s, "fastdecode", 10 ) )
- {
- param->b_deblocking_filter = 0;
- param->b_cabac = 0;
- param->analyse.b_weighted_bipred = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
- }
- else if( !strncasecmp( s, "zerolatency", 11 ) )
- {
- param->rc.i_lookahead = 0;
- param->i_sync_lookahead = 0;
- param->i_bframe = 0;
- param->b_sliced_threads = 1;
- param->b_vfr_input = 0;
- param->rc.b_mb_tree = 0;
- }
- else if( !strncasecmp( s, "touhou", 6 ) )
- {
- if( psy_tuning_used++ ) goto psy_failure;
- param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1;
- param->i_deblocking_filter_alphac0 = -1;
- param->i_deblocking_filter_beta = -1;
- param->analyse.f_psy_trellis = 0.2;
- param->rc.f_aq_strength = 1.3;
- if( param->analyse.inter & X264_ANALYSE_PSUB16x16 )
- param->analyse.inter |= X264_ANALYSE_PSUB8x8;
- }
- else
- {
- x264_log( NULL, X264_LOG_ERROR, "invalid tune '%s'\n", s );
- x264_free( tmp );
- return -1;
- }
- if( 0 )
- {
- psy_failure:
- x264_log( NULL, X264_LOG_WARNING, "only 1 psy tuning can be used: ignoring tune %s\n", s );
- }
- s = strtok( NULL, ",./-+" );
- }
- x264_free( tmp );
- return 0;
-}
-
-int x264_param_default_preset( x264_param_t *param, const char *preset, const char *tune )
-{
- x264_param_default( param );
-
- if( preset && param_apply_preset( param, preset ) < 0 )
- return -1;
- if( tune && param_apply_tune( param, tune ) < 0 )
- return -1;
- return 0;
-}
-
-void x264_param_apply_fastfirstpass( x264_param_t *param )
-{
- /* Set faster options in case of turbo firstpass. */
- if( param->rc.b_stat_write && !param->rc.b_stat_read )
- {
- param->i_frame_reference = 1;
- param->analyse.b_transform_8x8 = 0;
- param->analyse.inter = 0;
- param->analyse.i_me_method = X264_ME_DIA;
- param->analyse.i_subpel_refine = X264_MIN( 2, param->analyse.i_subpel_refine );
- param->analyse.i_trellis = 0;
- param->analyse.b_fast_pskip = 1;
- }
-}
-
-static int profile_string_to_int( const char *str )
-{
- if( !strcasecmp( str, "baseline" ) )
- return PROFILE_BASELINE;
- if( !strcasecmp( str, "main" ) )
- return PROFILE_MAIN;
- if( !strcasecmp( str, "high" ) )
- return PROFILE_HIGH;
- if( !strcasecmp( str, "high10" ) )
- return PROFILE_HIGH10;
- if( !strcasecmp( str, "high422" ) )
- return PROFILE_HIGH422;
- if( !strcasecmp( str, "high444" ) )
- return PROFILE_HIGH444_PREDICTIVE;
- return -1;
-}
-
-int x264_param_apply_profile( x264_param_t *param, const char *profile )
-{
- if( !profile )
- return 0;
-
- int p = profile_string_to_int( profile );
- if( p < 0 )
- {
- x264_log( NULL, X264_LOG_ERROR, "invalid profile: %s\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH444_PREDICTIVE && ((param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant <= 0) ||
- (param->rc.i_rc_method == X264_RC_CRF && (int)(param->rc.f_rf_constant + QP_BD_OFFSET) <= 0)) )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support lossless\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH444_PREDICTIVE && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I444 )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support 4:4:4\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH422 && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I422 )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support 4:2:2\n", profile );
- return -1;
- }
- if( p < PROFILE_HIGH10 && BIT_DEPTH > 8 )
- {
- x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support a bit depth of %d\n", profile, BIT_DEPTH );
- return -1;
- }
-
- if( p == PROFILE_BASELINE )
- {
- param->analyse.b_transform_8x8 = 0;
- param->b_cabac = 0;
- param->i_cqm_preset = X264_CQM_FLAT;
- param->psz_cqm_file = NULL;
- param->i_bframe = 0;
- param->analyse.i_weighted_pred = X264_WEIGHTP_NONE;
- if( param->b_interlaced )
- {
- x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support interlacing\n" );
- return -1;
- }
- if( param->b_fake_interlaced )
- {
- x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support fake interlacing\n" );
- return -1;
- }
- }
- else if( p == PROFILE_MAIN )
- {
- param->analyse.b_transform_8x8 = 0;
- param->i_cqm_preset = X264_CQM_FLAT;
- param->psz_cqm_file = NULL;
- }
- return 0;
-}
-
-static int parse_enum( const char *arg, const char * const *names, int *dst )
-{
- for( int i = 0; names[i]; i++ )
- if( !strcasecmp( arg, names[i] ) )
- {
- *dst = i;
- return 0;
- }
- return -1;
-}
-
-static int parse_cqm( const char *str, uint8_t *cqm, int length )
-{
- int i = 0;
- do {
- int coef;
- if( !sscanf( str, "%d", &coef ) || coef < 1 || coef > 255 )
- return -1;
- cqm[i++] = coef;
- } while( i < length && (str = strchr( str, ',' )) && str++ );
- return (i == length) ? 0 : -1;
-}
-
-static int atobool_internal( const char *str, int *b_error )
-{
- if( !strcmp(str, "1") ||
- !strcasecmp(str, "true") ||
- !strcasecmp(str, "yes") )
- return 1;
- if( !strcmp(str, "0") ||
- !strcasecmp(str, "false") ||
- !strcasecmp(str, "no") )
- return 0;
- *b_error = 1;
- return 0;
-}
-
-static int atoi_internal( const char *str, int *b_error )
-{
- char *end;
- int v = strtol( str, &end, 0 );
- if( end == str || *end != '\0' )
- *b_error = 1;
- return v;
-}
-
-static double atof_internal( const char *str, int *b_error )
-{
- char *end;
- double v = strtod( str, &end );
- if( end == str || *end != '\0' )
- *b_error = 1;
- return v;
-}
-
-#define atobool(str) ( name_was_bool = 1, atobool_internal( str, &b_error ) )
-#undef atoi
-#undef atof
-#define atoi(str) atoi_internal( str, &b_error )
-#define atof(str) atof_internal( str, &b_error )
-
-int x264_param_parse( x264_param_t *p, const char *name, const char *value )
-{
- char *name_buf = NULL;
- int b_error = 0;
- int errortype = X264_PARAM_BAD_VALUE;
- int name_was_bool;
- int value_was_null = !value;
-
- if( !name )
- return X264_PARAM_BAD_NAME;
- if( !value )
- value = "true";
-
- if( value[0] == '=' )
- value++;
-
- if( strchr( name, '_' ) ) // s/_/-/g
- {
- char *c;
- name_buf = strdup(name);
- if( !name_buf )
- return X264_PARAM_BAD_NAME;
- while( (c = strchr( name_buf, '_' )) )
- *c = '-';
- name = name_buf;
- }
-
- if( !strncmp( name, "no", 2 ) )
- {
- name += 2;
- if( name[0] == '-' )
- name++;
- value = atobool(value) ? "false" : "true";
- }
- name_was_bool = 0;
-
-#define OPT(STR) else if( !strcmp( name, STR ) )
-#define OPT2(STR0, STR1) else if( !strcmp( name, STR0 ) || !strcmp( name, STR1 ) )
- if( 0 );
- OPT("asm")
- {
- p->cpu = isdigit(value[0]) ? atoi(value) :
- !strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0;
- if( b_error )
- {
- char *buf = strdup( value );
- if( buf )
- {
- char *tok, UNUSED *saveptr=NULL, *init;
- b_error = 0;
- p->cpu = 0;
- for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL )
- {
- int i = 0;
- while( x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name) )
- i++;
- p->cpu |= x264_cpu_names[i].flags;
- if( !x264_cpu_names[i].flags )
- b_error = 1;
- }
- free( buf );
- if( (p->cpu&X264_CPU_SSSE3) && !(p->cpu&X264_CPU_SSE2_IS_SLOW) )
- p->cpu |= X264_CPU_SSE2_IS_FAST;
- }
- }
- }
- OPT("threads")
- {
- if( !strcasecmp(value, "auto") )
- p->i_threads = X264_THREADS_AUTO;
- else
- p->i_threads = atoi(value);
- }
- OPT("lookahead-threads")
- {
- if( !strcasecmp(value, "auto") )
- p->i_lookahead_threads = X264_THREADS_AUTO;
- else
- p->i_lookahead_threads = atoi(value);
- }
- OPT("sliced-threads")
- p->b_sliced_threads = atobool(value);
- OPT("sync-lookahead")
- {
- if( !strcasecmp(value, "auto") )
- p->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO;
- else
- p->i_sync_lookahead = atoi(value);
- }
- OPT2("deterministic", "n-deterministic")
- p->b_deterministic = atobool(value);
- OPT("cpu-independent")
- p->b_cpu_independent = atobool(value);
- OPT2("level", "level-idc")
- {
- if( !strcmp(value, "1b") )
- p->i_level_idc = 9;
- else if( atof(value) < 7 )
- p->i_level_idc = (int)(10*atof(value)+.5);
- else
- p->i_level_idc = atoi(value);
- }
- OPT("bluray-compat")
- p->b_bluray_compat = atobool(value);
- OPT("avcintra-class")
- p->i_avcintra_class = atoi(value);
- OPT("sar")
- {
- b_error = ( 2 != sscanf( value, "%d:%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) &&
- 2 != sscanf( value, "%d/%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) );
- }
- OPT("overscan")
- b_error |= parse_enum( value, x264_overscan_names, &p->vui.i_overscan );
- OPT("videoformat")
- b_error |= parse_enum( value, x264_vidformat_names, &p->vui.i_vidformat );
- OPT("fullrange")
- b_error |= parse_enum( value, x264_fullrange_names, &p->vui.b_fullrange );
- OPT("colorprim")
- b_error |= parse_enum( value, x264_colorprim_names, &p->vui.i_colorprim );
- OPT("transfer")
- b_error |= parse_enum( value, x264_transfer_names, &p->vui.i_transfer );
- OPT("colormatrix")
- b_error |= parse_enum( value, x264_colmatrix_names, &p->vui.i_colmatrix );
- OPT("chromaloc")
- {
- p->vui.i_chroma_loc = atoi(value);
- b_error = ( p->vui.i_chroma_loc < 0 || p->vui.i_chroma_loc > 5 );
- }
- OPT("fps")
- {
- if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 )
- {
- double fps = atof(value);
- if( fps > 0.0 && fps <= INT_MAX/1000.0 )
- {
- p->i_fps_num = (int)(fps * 1000.0 + .5);
- p->i_fps_den = 1000;
- }
- else
- {
- p->i_fps_num = atoi(value);
- p->i_fps_den = 1;
- }
- }
- }
- OPT2("ref", "frameref")
- p->i_frame_reference = atoi(value);
- OPT("dpb-size")
- p->i_dpb_size = atoi(value);
- OPT("keyint")
- {
- if( strstr( value, "infinite" ) )
- p->i_keyint_max = X264_KEYINT_MAX_INFINITE;
- else
- p->i_keyint_max = atoi(value);
- }
- OPT2("min-keyint", "keyint-min")
- {
- p->i_keyint_min = atoi(value);
- if( p->i_keyint_max < p->i_keyint_min )
- p->i_keyint_max = p->i_keyint_min;
- }
- OPT("scenecut")
- {
- p->i_scenecut_threshold = atobool(value);
- if( b_error || p->i_scenecut_threshold )
- {
- b_error = 0;
- p->i_scenecut_threshold = atoi(value);
- }
- }
- OPT("intra-refresh")
- p->b_intra_refresh = atobool(value);
- OPT("bframes")
- p->i_bframe = atoi(value);
- OPT("b-adapt")
- {
- p->i_bframe_adaptive = atobool(value);
- if( b_error )
- {
- b_error = 0;
- p->i_bframe_adaptive = atoi(value);
- }
- }
- OPT("b-bias")
- p->i_bframe_bias = atoi(value);
- OPT("b-pyramid")
- {
- b_error |= parse_enum( value, x264_b_pyramid_names, &p->i_bframe_pyramid );
- if( b_error )
- {
- b_error = 0;
- p->i_bframe_pyramid = atoi(value);
- }
- }
- OPT("open-gop")
- p->b_open_gop = atobool(value);
- OPT("nf")
- p->b_deblocking_filter = !atobool(value);
- OPT2("filter", "deblock")
- {
- if( 2 == sscanf( value, "%d:%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) ||
- 2 == sscanf( value, "%d,%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) )
- {
- p->b_deblocking_filter = 1;
- }
- else if( sscanf( value, "%d", &p->i_deblocking_filter_alphac0 ) )
- {
- p->b_deblocking_filter = 1;
- p->i_deblocking_filter_beta = p->i_deblocking_filter_alphac0;
- }
- else
- p->b_deblocking_filter = atobool(value);
- }
- OPT("slice-max-size")
- p->i_slice_max_size = atoi(value);
- OPT("slice-max-mbs")
- p->i_slice_max_mbs = atoi(value);
- OPT("slice-min-mbs")
- p->i_slice_min_mbs = atoi(value);
- OPT("slices")
- p->i_slice_count = atoi(value);
- OPT("slices-max")
- p->i_slice_count_max = atoi(value);
- OPT("cabac")
- p->b_cabac = atobool(value);
- OPT("cabac-idc")
- p->i_cabac_init_idc = atoi(value);
- OPT("interlaced")
- p->b_interlaced = atobool(value);
- OPT("tff")
- p->b_interlaced = p->b_tff = atobool(value);
- OPT("bff")
- {
- p->b_interlaced = atobool(value);
- p->b_tff = !p->b_interlaced;
- }
- OPT("constrained-intra")
- p->b_constrained_intra = atobool(value);
- OPT("cqm")
- {
- if( strstr( value, "flat" ) )
- p->i_cqm_preset = X264_CQM_FLAT;
- else if( strstr( value, "jvt" ) )
- p->i_cqm_preset = X264_CQM_JVT;
- else
- p->psz_cqm_file = strdup(value);
- }
- OPT("cqmfile")
- p->psz_cqm_file = strdup(value);
- OPT("cqm4")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4iy, 16 );
- b_error |= parse_cqm( value, p->cqm_4py, 16 );
- b_error |= parse_cqm( value, p->cqm_4ic, 16 );
- b_error |= parse_cqm( value, p->cqm_4pc, 16 );
- }
- OPT("cqm8")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_8iy, 64 );
- b_error |= parse_cqm( value, p->cqm_8py, 64 );
- b_error |= parse_cqm( value, p->cqm_8ic, 64 );
- b_error |= parse_cqm( value, p->cqm_8pc, 64 );
- }
- OPT("cqm4i")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4iy, 16 );
- b_error |= parse_cqm( value, p->cqm_4ic, 16 );
- }
- OPT("cqm4p")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4py, 16 );
- b_error |= parse_cqm( value, p->cqm_4pc, 16 );
- }
- OPT("cqm4iy")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4iy, 16 );
- }
- OPT("cqm4ic")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4ic, 16 );
- }
- OPT("cqm4py")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4py, 16 );
- }
- OPT("cqm4pc")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_4pc, 16 );
- }
- OPT("cqm8i")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_8iy, 64 );
- b_error |= parse_cqm( value, p->cqm_8ic, 64 );
- }
- OPT("cqm8p")
- {
- p->i_cqm_preset = X264_CQM_CUSTOM;
- b_error |= parse_cqm( value, p->cqm_8py, 64 );
- b_error |= parse_cqm( value, p->cqm_8pc, 64 );
- }
- OPT("log")
- p->i_log_level = atoi(value);
- OPT("dump-yuv")
- p->psz_dump_yuv = strdup(value);
- OPT2("analyse", "partitions")
- {
- p->analyse.inter = 0;
- if( strstr( value, "none" ) ) p->analyse.inter = 0;
- if( strstr( value, "all" ) ) p->analyse.inter = ~0;
-
- if( strstr( value, "i4x4" ) ) p->analyse.inter |= X264_ANALYSE_I4x4;
- if( strstr( value, "i8x8" ) ) p->analyse.inter |= X264_ANALYSE_I8x8;
- if( strstr( value, "p8x8" ) ) p->analyse.inter |= X264_ANALYSE_PSUB16x16;
- if( strstr( value, "p4x4" ) ) p->analyse.inter |= X264_ANALYSE_PSUB8x8;
- if( strstr( value, "b8x8" ) ) p->analyse.inter |= X264_ANALYSE_BSUB16x16;
- }
- OPT("8x8dct")
- p->analyse.b_transform_8x8 = atobool(value);
- OPT2("weightb", "weight-b")
- p->analyse.b_weighted_bipred = atobool(value);
- OPT("weightp")
- p->analyse.i_weighted_pred = atoi(value);
- OPT2("direct", "direct-pred")
- b_error |= parse_enum( value, x264_direct_pred_names, &p->analyse.i_direct_mv_pred );
- OPT("chroma-qp-offset")
- p->analyse.i_chroma_qp_offset = atoi(value);
- OPT("me")
- b_error |= parse_enum( value, x264_motion_est_names, &p->analyse.i_me_method );
- OPT2("merange", "me-range")
- p->analyse.i_me_range = atoi(value);
- OPT2("mvrange", "mv-range")
- p->analyse.i_mv_range = atoi(value);
- OPT2("mvrange-thread", "mv-range-thread")
- p->analyse.i_mv_range_thread = atoi(value);
- OPT2("subme", "subq")
- p->analyse.i_subpel_refine = atoi(value);
- OPT("psy-rd")
- {
- if( 2 == sscanf( value, "%f:%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) ||
- 2 == sscanf( value, "%f,%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) ||
- 2 == sscanf( value, "%f|%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ))
- { }
- else if( sscanf( value, "%f", &p->analyse.f_psy_rd ) )
- {
- p->analyse.f_psy_trellis = 0;
- }
- else
- {
- p->analyse.f_psy_rd = 0;
- p->analyse.f_psy_trellis = 0;
- }
- }
- OPT("psy")
- p->analyse.b_psy = atobool(value);
- OPT("chroma-me")
- p->analyse.b_chroma_me = atobool(value);
- OPT("mixed-refs")
- p->analyse.b_mixed_references = atobool(value);
- OPT("trellis")
- p->analyse.i_trellis = atoi(value);
- OPT("fast-pskip")
- p->analyse.b_fast_pskip = atobool(value);
- OPT("dct-decimate")
- p->analyse.b_dct_decimate = atobool(value);
- OPT("deadzone-inter")
- p->analyse.i_luma_deadzone[0] = atoi(value);
- OPT("deadzone-intra")
- p->analyse.i_luma_deadzone[1] = atoi(value);
- OPT("nr")
- p->analyse.i_noise_reduction = atoi(value);
- OPT("bitrate")
- {
- p->rc.i_bitrate = atoi(value);
- p->rc.i_rc_method = X264_RC_ABR;
- }
- OPT2("qp", "qp_constant")
- {
- p->rc.i_qp_constant = atoi(value);
- p->rc.i_rc_method = X264_RC_CQP;
- }
- OPT("crf")
- {
- p->rc.f_rf_constant = atof(value);
- p->rc.i_rc_method = X264_RC_CRF;
- }
- OPT("crf-max")
- p->rc.f_rf_constant_max = atof(value);
- OPT("rc-lookahead")
- p->rc.i_lookahead = atoi(value);
- OPT2("qpmin", "qp-min")
- p->rc.i_qp_min = atoi(value);
- OPT2("qpmax", "qp-max")
- p->rc.i_qp_max = atoi(value);
- OPT2("qpstep", "qp-step")
- p->rc.i_qp_step = atoi(value);
- OPT("ratetol")
- p->rc.f_rate_tolerance = !strncmp("inf", value, 3) ? 1e9 : atof(value);
- OPT("vbv-maxrate")
- p->rc.i_vbv_max_bitrate = atoi(value);
- OPT("vbv-bufsize")
- p->rc.i_vbv_buffer_size = atoi(value);
- OPT("vbv-init")
- p->rc.f_vbv_buffer_init = atof(value);
- OPT2("ipratio", "ip-factor")
- p->rc.f_ip_factor = atof(value);
- OPT2("pbratio", "pb-factor")
- p->rc.f_pb_factor = atof(value);
- OPT("aq-mode")
- p->rc.i_aq_mode = atoi(value);
- OPT("aq-strength")
- p->rc.f_aq_strength = atof(value);
- OPT("pass")
- {
- int pass = x264_clip3( atoi(value), 0, 3 );
- p->rc.b_stat_write = pass & 1;
- p->rc.b_stat_read = pass & 2;
- }
- OPT("stats")
- {
- p->rc.psz_stat_in = strdup(value);
- p->rc.psz_stat_out = strdup(value);
- }
- OPT("qcomp")
- p->rc.f_qcompress = atof(value);
- OPT("mbtree")
- p->rc.b_mb_tree = atobool(value);
- OPT("qblur")
- p->rc.f_qblur = atof(value);
- OPT2("cplxblur", "cplx-blur")
- p->rc.f_complexity_blur = atof(value);
- OPT("zones")
- p->rc.psz_zones = strdup(value);
- OPT("crop-rect")
- b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top,
- &p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4;
- OPT("psnr")
- p->analyse.b_psnr = atobool(value);
- OPT("ssim")
- p->analyse.b_ssim = atobool(value);
- OPT("aud")
- p->b_aud = atobool(value);
- OPT("sps-id")
- p->i_sps_id = atoi(value);
- OPT("global-header")
- p->b_repeat_headers = !atobool(value);
- OPT("repeat-headers")
- p->b_repeat_headers = atobool(value);
- OPT("annexb")
- p->b_annexb = atobool(value);
- OPT("force-cfr")
- p->b_vfr_input = !atobool(value);
- OPT("nal-hrd")
- b_error |= parse_enum( value, x264_nal_hrd_names, &p->i_nal_hrd );
- OPT("filler")
- p->rc.b_filler = atobool(value);
- OPT("pic-struct")
- p->b_pic_struct = atobool(value);
- OPT("fake-interlaced")
- p->b_fake_interlaced = atobool(value);
- OPT("frame-packing")
- p->i_frame_packing = atoi(value);
- OPT("stitchable")
- p->b_stitchable = atobool(value);
- OPT("opencl")
- p->b_opencl = atobool( value );
- OPT("opencl-clbin")
- p->psz_clbin_file = strdup( value );
- OPT("opencl-device")
- p->i_opencl_device = atoi( value );
- else
- {
- b_error = 1;
- errortype = X264_PARAM_BAD_NAME;
- }
-#undef OPT
-#undef OPT2
-#undef atobool
-#undef atoi
-#undef atof
-
- if( name_buf )
- free( name_buf );
-
- b_error |= value_was_null && !name_was_bool;
- return b_error ? errortype : 0;
-}
-
/****************************************************************************
* x264_log:
****************************************************************************/
va_list arg;
va_start( arg, psz_fmt );
if( !h )
- log_default( NULL, i_level, psz_fmt, arg );
+ x264_log_default( NULL, i_level, psz_fmt, arg );
else
h->param.pf_log( h->param.p_log_private, i_level, psz_fmt, arg );
va_end( arg );
}
}
-
-static void log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg )
-{
- char *psz_prefix;
- switch( i_level )
- {
- case X264_LOG_ERROR:
- psz_prefix = "error";
- break;
- case X264_LOG_WARNING:
- psz_prefix = "warning";
- break;
- case X264_LOG_INFO:
- psz_prefix = "info";
- break;
- case X264_LOG_DEBUG:
- psz_prefix = "debug";
- break;
- default:
- psz_prefix = "unknown";
- break;
- }
- fprintf( stderr, "x264 [%s]: ", psz_prefix );
- x264_vfprintf( stderr, psz_fmt, arg );
-}
-
-/****************************************************************************
- * x264_picture_init:
- ****************************************************************************/
-void x264_picture_init( x264_picture_t *pic )
-{
- memset( pic, 0, sizeof( x264_picture_t ) );
- pic->i_type = X264_TYPE_AUTO;
- pic->i_qpplus1 = X264_QP_AUTO;
- pic->i_pic_struct = PIC_STRUCT_AUTO;
-}
-
-/****************************************************************************
- * x264_picture_alloc:
- ****************************************************************************/
-int x264_picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height )
-{
- typedef struct
- {
- int planes;
- int width_fix8[3];
- int height_fix8[3];
- } x264_csp_tab_t;
-
- static const x264_csp_tab_t csp_tab[] =
- {
- [X264_CSP_I420] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
- [X264_CSP_YV12] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } },
- [X264_CSP_NV12] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, },
- [X264_CSP_NV21] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, },
- [X264_CSP_I422] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_YV16] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_NV16] = { 2, { 256*1, 256*1 }, { 256*1, 256*1 }, },
- [X264_CSP_YUYV] = { 1, { 256*2 }, { 256*1 }, },
- [X264_CSP_UYVY] = { 1, { 256*2 }, { 256*1 }, },
- [X264_CSP_I444] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_YV24] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } },
- [X264_CSP_BGR] = { 1, { 256*3 }, { 256*1 }, },
- [X264_CSP_BGRA] = { 1, { 256*4 }, { 256*1 }, },
- [X264_CSP_RGB] = { 1, { 256*3 }, { 256*1 }, },
- };
-
- int csp = i_csp & X264_CSP_MASK;
- if( csp <= X264_CSP_NONE || csp >= X264_CSP_MAX || csp == X264_CSP_V210 )
- return -1;
- x264_picture_init( pic );
- pic->img.i_csp = i_csp;
- pic->img.i_plane = csp_tab[csp].planes;
- int depth_factor = i_csp & X264_CSP_HIGH_DEPTH ? 2 : 1;
- int plane_offset[3] = {0};
- int frame_size = 0;
- for( int i = 0; i < pic->img.i_plane; i++ )
- {
- int stride = (((int64_t)i_width * csp_tab[csp].width_fix8[i]) >> 8) * depth_factor;
- int plane_size = (((int64_t)i_height * csp_tab[csp].height_fix8[i]) >> 8) * stride;
- pic->img.i_stride[i] = stride;
- plane_offset[i] = frame_size;
- frame_size += plane_size;
- }
- pic->img.plane[0] = x264_malloc( frame_size );
- if( !pic->img.plane[0] )
- return -1;
- for( int i = 1; i < pic->img.i_plane; i++ )
- pic->img.plane[i] = pic->img.plane[0] + plane_offset[i];
- return 0;
-}
-
-/****************************************************************************
- * x264_picture_clean:
- ****************************************************************************/
-void x264_picture_clean( x264_picture_t *pic )
-{
- x264_free( pic->img.plane[0] );
-
- /* just to be safe */
- memset( pic, 0, sizeof( x264_picture_t ) );
-}
-
-/****************************************************************************
- * x264_malloc:
- ****************************************************************************/
-void *x264_malloc( int i_size )
-{
- uint8_t *align_buf = NULL;
-#if HAVE_MALLOC_H
-#if HAVE_THP
-#define HUGE_PAGE_SIZE 2*1024*1024
-#define HUGE_PAGE_THRESHOLD HUGE_PAGE_SIZE*7/8 /* FIXME: Is this optimal? */
- /* Attempt to allocate huge pages to reduce TLB misses. */
- if( i_size >= HUGE_PAGE_THRESHOLD )
- {
- align_buf = memalign( HUGE_PAGE_SIZE, i_size );
- if( align_buf )
- {
- /* Round up to the next huge page boundary if we are close enough. */
- size_t madv_size = (i_size + HUGE_PAGE_SIZE - HUGE_PAGE_THRESHOLD) & ~(HUGE_PAGE_SIZE-1);
- madvise( align_buf, madv_size, MADV_HUGEPAGE );
- }
- }
- else
-#undef HUGE_PAGE_SIZE
-#undef HUGE_PAGE_THRESHOLD
-#endif
- align_buf = memalign( NATIVE_ALIGN, i_size );
-#else
- uint8_t *buf = malloc( i_size + (NATIVE_ALIGN-1) + sizeof(void **) );
- if( buf )
- {
- align_buf = buf + (NATIVE_ALIGN-1) + sizeof(void **);
- align_buf -= (intptr_t) align_buf & (NATIVE_ALIGN-1);
- *( (void **) ( align_buf - sizeof(void **) ) ) = buf;
- }
-#endif
- if( !align_buf )
- x264_log( NULL, X264_LOG_ERROR, "malloc of size %d failed\n", i_size );
- return align_buf;
-}
-
-/****************************************************************************
- * x264_free:
- ****************************************************************************/
-void x264_free( void *p )
-{
- if( p )
- {
-#if HAVE_MALLOC_H
- free( p );
-#else
- free( *( ( ( void **) p ) - 1 ) );
-#endif
- }
-}
-
-/****************************************************************************
- * x264_reduce_fraction:
- ****************************************************************************/
-#define REDUCE_FRACTION( name, type )\
-void name( type *n, type *d )\
-{ \
- type a = *n; \
- type b = *d; \
- type c; \
- if( !a || !b ) \
- return; \
- c = a % b; \
- while( c ) \
- { \
- a = b; \
- b = c; \
- c = a % b; \
- } \
- *n /= b; \
- *d /= b; \
-}
-
-REDUCE_FRACTION( x264_reduce_fraction , uint32_t )
-REDUCE_FRACTION( x264_reduce_fraction64, uint64_t )
-
-/****************************************************************************
- * x264_slurp_file:
- ****************************************************************************/
-char *x264_slurp_file( const char *filename )
-{
- int b_error = 0;
- int64_t i_size;
- char *buf;
- FILE *fh = x264_fopen( filename, "rb" );
- if( !fh )
- return NULL;
-
- b_error |= fseek( fh, 0, SEEK_END ) < 0;
- b_error |= ( i_size = ftell( fh ) ) <= 0;
- if( WORD_SIZE == 4 )
- b_error |= i_size > INT32_MAX;
- b_error |= fseek( fh, 0, SEEK_SET ) < 0;
- if( b_error )
- goto error;
-
- buf = x264_malloc( i_size+2 );
- if( !buf )
- goto error;
-
- b_error |= fread( buf, 1, i_size, fh ) != i_size;
- fclose( fh );
- if( b_error )
- {
- x264_free( buf );
- return NULL;
- }
-
- if( buf[i_size-1] != '\n' )
- buf[i_size++] = '\n';
- buf[i_size] = '\0';
-
- return buf;
-error:
- fclose( fh );
- return NULL;
-}
-
-/****************************************************************************
- * x264_param2string:
- ****************************************************************************/
-char *x264_param2string( x264_param_t *p, int b_res )
-{
- int len = 1000;
- char *buf, *s;
- if( p->rc.psz_zones )
- len += strlen(p->rc.psz_zones);
- buf = s = x264_malloc( len );
- if( !buf )
- return NULL;
-
- if( b_res )
- {
- s += sprintf( s, "%dx%d ", p->i_width, p->i_height );
- s += sprintf( s, "fps=%u/%u ", p->i_fps_num, p->i_fps_den );
- s += sprintf( s, "timebase=%u/%u ", p->i_timebase_num, p->i_timebase_den );
- s += sprintf( s, "bitdepth=%d ", BIT_DEPTH );
- }
-
- if( p->b_opencl )
- s += sprintf( s, "opencl=%d ", p->b_opencl );
- s += sprintf( s, "cabac=%d", p->b_cabac );
- s += sprintf( s, " ref=%d", p->i_frame_reference );
- s += sprintf( s, " deblock=%d:%d:%d", p->b_deblocking_filter,
- p->i_deblocking_filter_alphac0, p->i_deblocking_filter_beta );
- s += sprintf( s, " analyse=%#x:%#x", p->analyse.intra, p->analyse.inter );
- s += sprintf( s, " me=%s", x264_motion_est_names[ p->analyse.i_me_method ] );
- s += sprintf( s, " subme=%d", p->analyse.i_subpel_refine );
- s += sprintf( s, " psy=%d", p->analyse.b_psy );
- if( p->analyse.b_psy )
- s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis );
- s += sprintf( s, " mixed_ref=%d", p->analyse.b_mixed_references );
- s += sprintf( s, " me_range=%d", p->analyse.i_me_range );
- s += sprintf( s, " chroma_me=%d", p->analyse.b_chroma_me );
- s += sprintf( s, " trellis=%d", p->analyse.i_trellis );
- s += sprintf( s, " 8x8dct=%d", p->analyse.b_transform_8x8 );
- s += sprintf( s, " cqm=%d", p->i_cqm_preset );
- s += sprintf( s, " deadzone=%d,%d", p->analyse.i_luma_deadzone[0], p->analyse.i_luma_deadzone[1] );
- s += sprintf( s, " fast_pskip=%d", p->analyse.b_fast_pskip );
- s += sprintf( s, " chroma_qp_offset=%d", p->analyse.i_chroma_qp_offset );
- s += sprintf( s, " threads=%d", p->i_threads );
- s += sprintf( s, " lookahead_threads=%d", p->i_lookahead_threads );
- s += sprintf( s, " sliced_threads=%d", p->b_sliced_threads );
- if( p->i_slice_count )
- s += sprintf( s, " slices=%d", p->i_slice_count );
- if( p->i_slice_count_max )
- s += sprintf( s, " slices_max=%d", p->i_slice_count_max );
- if( p->i_slice_max_size )
- s += sprintf( s, " slice_max_size=%d", p->i_slice_max_size );
- if( p->i_slice_max_mbs )
- s += sprintf( s, " slice_max_mbs=%d", p->i_slice_max_mbs );
- if( p->i_slice_min_mbs )
- s += sprintf( s, " slice_min_mbs=%d", p->i_slice_min_mbs );
- s += sprintf( s, " nr=%d", p->analyse.i_noise_reduction );
- s += sprintf( s, " decimate=%d", p->analyse.b_dct_decimate );
- s += sprintf( s, " interlaced=%s", p->b_interlaced ? p->b_tff ? "tff" : "bff" : p->b_fake_interlaced ? "fake" : "0" );
- s += sprintf( s, " bluray_compat=%d", p->b_bluray_compat );
- if( p->b_stitchable )
- s += sprintf( s, " stitchable=%d", p->b_stitchable );
-
- s += sprintf( s, " constrained_intra=%d", p->b_constrained_intra );
-
- s += sprintf( s, " bframes=%d", p->i_bframe );
- if( p->i_bframe )
- {
- s += sprintf( s, " b_pyramid=%d b_adapt=%d b_bias=%d direct=%d weightb=%d open_gop=%d",
- p->i_bframe_pyramid, p->i_bframe_adaptive, p->i_bframe_bias,
- p->analyse.i_direct_mv_pred, p->analyse.b_weighted_bipred, p->b_open_gop );
- }
- s += sprintf( s, " weightp=%d", p->analyse.i_weighted_pred > 0 ? p->analyse.i_weighted_pred : 0 );
-
- if( p->i_keyint_max == X264_KEYINT_MAX_INFINITE )
- s += sprintf( s, " keyint=infinite" );
- else
- s += sprintf( s, " keyint=%d", p->i_keyint_max );
- s += sprintf( s, " keyint_min=%d scenecut=%d intra_refresh=%d",
- p->i_keyint_min, p->i_scenecut_threshold, p->b_intra_refresh );
-
- if( p->rc.b_mb_tree || p->rc.i_vbv_buffer_size )
- s += sprintf( s, " rc_lookahead=%d", p->rc.i_lookahead );
-
- s += sprintf( s, " rc=%s mbtree=%d", p->rc.i_rc_method == X264_RC_ABR ?
- ( p->rc.b_stat_read ? "2pass" : p->rc.i_vbv_max_bitrate == p->rc.i_bitrate ? "cbr" : "abr" )
- : p->rc.i_rc_method == X264_RC_CRF ? "crf" : "cqp", p->rc.b_mb_tree );
- if( p->rc.i_rc_method == X264_RC_ABR || p->rc.i_rc_method == X264_RC_CRF )
- {
- if( p->rc.i_rc_method == X264_RC_CRF )
- s += sprintf( s, " crf=%.1f", p->rc.f_rf_constant );
- else
- s += sprintf( s, " bitrate=%d ratetol=%.1f",
- p->rc.i_bitrate, p->rc.f_rate_tolerance );
- s += sprintf( s, " qcomp=%.2f qpmin=%d qpmax=%d qpstep=%d",
- p->rc.f_qcompress, p->rc.i_qp_min, p->rc.i_qp_max, p->rc.i_qp_step );
- if( p->rc.b_stat_read )
- s += sprintf( s, " cplxblur=%.1f qblur=%.1f",
- p->rc.f_complexity_blur, p->rc.f_qblur );
- if( p->rc.i_vbv_buffer_size )
- {
- s += sprintf( s, " vbv_maxrate=%d vbv_bufsize=%d",
- p->rc.i_vbv_max_bitrate, p->rc.i_vbv_buffer_size );
- if( p->rc.i_rc_method == X264_RC_CRF )
- s += sprintf( s, " crf_max=%.1f", p->rc.f_rf_constant_max );
- }
- }
- else if( p->rc.i_rc_method == X264_RC_CQP )
- s += sprintf( s, " qp=%d", p->rc.i_qp_constant );
-
- if( p->rc.i_vbv_buffer_size )
- s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler );
- if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom )
- s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top,
- p->crop_rect.i_right, p->crop_rect.i_bottom );
- if( p->i_frame_packing >= 0 )
- s += sprintf( s, " frame-packing=%d", p->i_frame_packing );
-
- if( !(p->rc.i_rc_method == X264_RC_CQP && p->rc.i_qp_constant == 0) )
- {
- s += sprintf( s, " ip_ratio=%.2f", p->rc.f_ip_factor );
- if( p->i_bframe && !p->rc.b_mb_tree )
- s += sprintf( s, " pb_ratio=%.2f", p->rc.f_pb_factor );
- s += sprintf( s, " aq=%d", p->rc.i_aq_mode );
- if( p->rc.i_aq_mode )
- s += sprintf( s, ":%.2f", p->rc.f_aq_strength );
- if( p->rc.psz_zones )
- s += sprintf( s, " zones=%s", p->rc.psz_zones );
- else if( p->rc.i_zones )
- s += sprintf( s, " zones" );
- }
-
- return buf;
-}
-
#ifndef X264_COMMON_H
#define X264_COMMON_H
+#include "base.h"
+
+/* Macros for templating function calls according to bit depth */
+#define x264_template(w) x264_glue3(x264, BIT_DEPTH, w)
+
+/****************************************************************************
+ * API Templates
+ ****************************************************************************/
+#define x264_nal_encode x264_template(nal_encode)
+#define x264_encoder_reconfig x264_template(encoder_reconfig)
+#define x264_encoder_parameters x264_template(encoder_parameters)
+#define x264_encoder_headers x264_template(encoder_headers)
+#define x264_encoder_encode x264_template(encoder_encode)
+#define x264_encoder_close x264_template(encoder_close)
+#define x264_encoder_delayed_frames x264_template(encoder_delayed_frames)
+#define x264_encoder_maximum_delayed_frames x264_template(encoder_maximum_delayed_frames)
+#define x264_encoder_intra_refresh x264_template(encoder_intra_refresh)
+#define x264_encoder_invalidate_reference x264_template(encoder_invalidate_reference)
+
+/* This undef allows to rename the external symbol and force link failure in case
+ * of incompatible libraries. Then the define enables templating as above. */
+#undef x264_encoder_open
+#define x264_encoder_open x264_template(encoder_open)
+
/****************************************************************************
* Macros
****************************************************************************/
-#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
-#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
-#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c)))
-#define X264_MAX3(a,b,c) X264_MAX((a),X264_MAX((b),(c)))
-#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d)))
-#define X264_MAX4(a,b,c,d) X264_MAX((a),X264_MAX3((b),(c),(d)))
-#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 )
-#define IS_DISPOSABLE(type) ( type == X264_TYPE_B )
-#define FIX8(f) ((int)(f*(1<<8)+.5))
-#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
-#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0])))
-
-#define CHECKED_MALLOC( var, size )\
-do {\
- var = x264_malloc( size );\
- if( !var )\
- goto fail;\
-} while( 0 )
-#define CHECKED_MALLOCZERO( var, size )\
-do {\
- CHECKED_MALLOC( var, size );\
- memset( var, 0, size );\
-} while( 0 )
-
-/* Macros for merging multiple allocations into a single large malloc, for improved
- * use with huge pages. */
-
-/* Needs to be enough to contain any set of buffers that use combined allocations */
-#define PREALLOC_BUF_SIZE 1024
-
-#define PREALLOC_INIT\
- int prealloc_idx = 0;\
- size_t prealloc_size = 0;\
- uint8_t **preallocs[PREALLOC_BUF_SIZE];
-
-#define PREALLOC( var, size )\
-do {\
- var = (void*)prealloc_size;\
- preallocs[prealloc_idx++] = (uint8_t**)&var;\
- prealloc_size += ALIGN(size, NATIVE_ALIGN);\
-} while( 0 )
-
-#define PREALLOC_END( ptr )\
-do {\
- CHECKED_MALLOC( ptr, prealloc_size );\
- while( prealloc_idx-- )\
- *preallocs[prealloc_idx] += (intptr_t)ptr;\
-} while( 0 )
-
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
-
-#define X264_BFRAME_MAX 16
-#define X264_REF_MAX 16
-#define X264_THREAD_MAX 128
-#define X264_LOOKAHEAD_THREAD_MAX 16
#define X264_PCM_COST (FRAME_SIZE(256*BIT_DEPTH)+16)
-#define X264_LOOKAHEAD_MAX 250
#define QP_BD_OFFSET (6*(BIT_DEPTH-8))
#define QP_MAX_SPEC (51+QP_BD_OFFSET)
#define QP_MAX (QP_MAX_SPEC+18)
-#define QP_MAX_MAX (51+2*6+18)
#define PIXEL_MAX ((1 << BIT_DEPTH)-1)
// arbitrary, but low because SATD scores are 1/4 normal
#define X264_LOOKAHEAD_QP (12+QP_BD_OFFSET)
#define SPEC_QP(x) X264_MIN((x), QP_MAX_SPEC)
-// number of pixels (per thread) in progress at any given time.
-// 16 for the macroblock in progress + 3 for deblocking + 3 for motion compensation filter + 2 for extra safety
-#define X264_THREAD_HEIGHT 24
-
-/* WEIGHTP_FAKE is set when mb_tree & psy are enabled, but normal weightp is disabled
- * (such as in baseline). It checks for fades in lookahead and adjusts qp accordingly
- * to increase quality. Defined as (-1) so that if(i_weighted_pred > 0) is true only when
- * real weights are being used. */
-
-#define X264_WEIGHTP_FAKE (-1)
-
#define NALU_OVERHEAD 5 // startcode + NAL type costs 5 bytes per frame
#define FILLER_OVERHEAD (NALU_OVERHEAD+1)
#define SEI_OVERHEAD (NALU_OVERHEAD - (h->param.b_annexb && !h->param.i_avcintra_class && (h->out.i_nal-1)))
-/****************************************************************************
- * Includes
- ****************************************************************************/
-#include "osdep.h"
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <limits.h>
-
#if HAVE_INTERLACED
# define MB_INTERLACED h->mb.b_interlaced
# define SLICE_MBAFF h->sh.b_mbaff
#define FRAME_SIZE(s) ((s)+2*CHROMA_SIZE(s))
#define CHROMA444 (CHROMA_FORMAT == CHROMA_444)
-/* Unions for type-punning.
- * Mn: load or store n bits, aligned, native-endian
- * CPn: copy n bits, aligned, native-endian
- * we don't use memcpy for CPn because memcpy's args aren't assumed to be aligned */
-typedef union { uint16_t i; uint8_t c[2]; } MAY_ALIAS x264_union16_t;
-typedef union { uint32_t i; uint16_t b[2]; uint8_t c[4]; } MAY_ALIAS x264_union32_t;
-typedef union { uint64_t i; uint32_t a[2]; uint16_t b[4]; uint8_t c[8]; } MAY_ALIAS x264_union64_t;
-typedef struct { uint64_t i[2]; } x264_uint128_t;
-typedef union { x264_uint128_t i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_t;
-#define M16(src) (((x264_union16_t*)(src))->i)
-#define M32(src) (((x264_union32_t*)(src))->i)
-#define M64(src) (((x264_union64_t*)(src))->i)
-#define M128(src) (((x264_union128_t*)(src))->i)
-#define M128_ZERO ((x264_uint128_t){{0,0}})
-#define CP16(dst,src) M16(dst) = M16(src)
-#define CP32(dst,src) M32(dst) = M32(src)
-#define CP64(dst,src) M64(dst) = M64(src)
-#define CP128(dst,src) M128(dst) = M128(src)
-
#if HIGH_BIT_DEPTH
typedef uint16_t pixel;
typedef uint64_t pixel4;
# define MPIXEL_X4(src) M32(src)
#endif
-#define BIT_DEPTH X264_BIT_DEPTH
-
#define CPPIXEL_X4(dst,src) MPIXEL_X4(dst) = MPIXEL_X4(src)
-#define X264_SCAN8_LUMA_SIZE (5*8)
-#define X264_SCAN8_SIZE (X264_SCAN8_LUMA_SIZE*3)
-#define X264_SCAN8_0 (4+1*8)
-
-/* Scan8 organization:
- * 0 1 2 3 4 5 6 7
- * 0 DY y y y y y
- * 1 y Y Y Y Y
- * 2 y Y Y Y Y
- * 3 y Y Y Y Y
- * 4 y Y Y Y Y
- * 5 DU u u u u u
- * 6 u U U U U
- * 7 u U U U U
- * 8 u U U U U
- * 9 u U U U U
- * 10 DV v v v v v
- * 11 v V V V V
- * 12 v V V V V
- * 13 v V V V V
- * 14 v V V V V
- * DY/DU/DV are for luma/chroma DC.
- */
-
-#define LUMA_DC 48
-#define CHROMA_DC 49
-
-static const uint8_t x264_scan8[16*3 + 3] =
-{
- 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8,
- 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8,
- 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8,
- 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8,
- 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8,
- 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8,
- 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8,
- 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8,
- 4+11*8, 5+11*8, 4+12*8, 5+12*8,
- 6+11*8, 7+11*8, 6+12*8, 7+12*8,
- 4+13*8, 5+13*8, 4+14*8, 5+14*8,
- 6+13*8, 7+13*8, 6+14*8, 7+14*8,
- 0+ 0*8, 0+ 5*8, 0+10*8
-};
-
-#include "x264.h"
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
#if HAVE_OPENCL
#include "opencl.h"
#endif
#include "frame.h"
#include "dct.h"
#include "quant.h"
-#include "cpu.h"
#include "threadpool.h"
/****************************************************************************
* General functions
****************************************************************************/
-/* x264_malloc : will do or emulate a memalign
- * you have to use x264_free for buffers allocated with x264_malloc */
-void *x264_malloc( int );
-void x264_free( void * );
-
-/* x264_slurp_file: malloc space for the whole file and read it */
-char *x264_slurp_file( const char *filename );
-
-/* x264_param2string: return a (malloced) string containing most of
- * the encoding options */
-char *x264_param2string( x264_param_t *p, int b_res );
/* log */
+#define x264_log x264_template(log)
void x264_log( x264_t *h, int i_level, const char *psz_fmt, ... );
-void x264_reduce_fraction( uint32_t *n, uint32_t *d );
-void x264_reduce_fraction64( uint64_t *n, uint64_t *d );
+#define x264_cavlc_init x264_template(cavlc_init)
void x264_cavlc_init( x264_t *h );
+#define x264_cabac_init x264_template(cabac_init)
void x264_cabac_init( x264_t *h );
static ALWAYS_INLINE pixel x264_clip_pixel( int x )
return ( (x & ~PIXEL_MAX) ? (-x)>>31 & PIXEL_MAX : x );
}
-static ALWAYS_INLINE int x264_clip3( int v, int i_min, int i_max )
-{
- return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v );
-}
-
-static ALWAYS_INLINE double x264_clip3f( double v, double f_min, double f_max )
-{
- return ( (v < f_min) ? f_min : (v > f_max) ? f_max : v );
-}
-
-static ALWAYS_INLINE int x264_median( int a, int b, int c )
-{
- int t = (a-b)&((a-b)>>31);
- a -= t;
- b += t;
- b -= (b-c)&((b-c)>>31);
- b += (a-b)&((a-b)>>31);
- return b;
-}
-
-static ALWAYS_INLINE void x264_median_mv( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
-{
- dst[0] = x264_median( a[0], b[0], c[0] );
- dst[1] = x264_median( a[1], b[1], c[1] );
-}
-
-static ALWAYS_INLINE int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc )
-{
- int sum = 0;
- for( int i = 0; i < i_mvc-1; i++ )
- {
- sum += abs( mvc[i][0] - mvc[i+1][0] )
- + abs( mvc[i][1] - mvc[i+1][1] );
- }
- return sum;
-}
-
-static ALWAYS_INLINE uint16_t x264_cabac_mvd_sum( uint8_t *mvdleft, uint8_t *mvdtop )
-{
- int amvd0 = mvdleft[0] + mvdtop[0];
- int amvd1 = mvdleft[1] + mvdtop[1];
- amvd0 = (amvd0 > 2) + (amvd0 > 32);
- amvd1 = (amvd1 > 2) + (amvd1 > 32);
- return amvd0 + (amvd1<<8);
-}
-
-extern const uint8_t x264_exp2_lut[64];
-extern const float x264_log2_lut[128];
-extern const float x264_log2_lz_lut[32];
-
-/* Not a general-purpose function; multiplies input by -1/6 to convert
- * qp to qscale. */
-static ALWAYS_INLINE int x264_exp2fix8( float x )
-{
- int i = x*(-64.f/6.f) + 512.5f;
- if( i < 0 ) return 0;
- if( i > 1023 ) return 0xffff;
- return (x264_exp2_lut[i&63]+256) << (i>>6) >> 8;
-}
-
-static ALWAYS_INLINE float x264_log2( uint32_t x )
-{
- int lz = x264_clz( x );
- return x264_log2_lut[(x<<lz>>24)&0x7f] + x264_log2_lz_lut[lz];
-}
-
/****************************************************************************
*
****************************************************************************/
-enum slice_type_e
-{
- SLICE_TYPE_P = 0,
- SLICE_TYPE_B = 1,
- SLICE_TYPE_I = 2,
-};
-
-static const char slice_type_to_char[] = { 'P', 'B', 'I' };
-
-enum sei_payload_type_e
-{
- SEI_BUFFERING_PERIOD = 0,
- SEI_PIC_TIMING = 1,
- SEI_PAN_SCAN_RECT = 2,
- SEI_FILLER = 3,
- SEI_USER_DATA_REGISTERED = 4,
- SEI_USER_DATA_UNREGISTERED = 5,
- SEI_RECOVERY_POINT = 6,
- SEI_DEC_REF_PIC_MARKING = 7,
- SEI_FRAME_PACKING = 45,
-};
-
typedef struct
{
x264_sps_t *sps;
#include "rectangle.h"
#endif
-
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#include "common.h"
+#include "base.h"
#if HAVE_POSIXTHREAD && SYS_LINUX
#include <sched.h>
else if( cache == 64 )
cpu |= X264_CPU_CACHELINE_64;
else
- x264_log( NULL, X264_LOG_WARNING, "unable to determine cacheline size\n" );
+ x264_log_internal( X264_LOG_WARNING, "unable to determine cacheline size\n" );
}
#if STACK_ALIGNMENT < 16
# include "mips/dct.h"
#endif
-/* the inverse of the scaling factors introduced by 8x8 fdct */
-/* uint32 is for the asm implementation of trellis. the actual values fit in uint16. */
-#define W(i) (i==0 ? FIX8(1.0000) :\
- i==1 ? FIX8(0.8859) :\
- i==2 ? FIX8(1.6000) :\
- i==3 ? FIX8(0.9415) :\
- i==4 ? FIX8(1.2651) :\
- i==5 ? FIX8(1.1910) :0)
-const uint32_t x264_dct8_weight_tab[64] = {
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
-
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1)
-};
-#undef W
-
-#define W(i) (i==0 ? FIX8(1.76777) :\
- i==1 ? FIX8(1.11803) :\
- i==2 ? FIX8(0.70711) :0)
-const uint32_t x264_dct4_weight_tab[16] = {
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2),
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2)
-};
-#undef W
-
-/* inverse squared */
-#define W(i) (i==0 ? FIX8(3.125) :\
- i==1 ? FIX8(1.25) :\
- i==2 ? FIX8(0.5) :0)
-const uint32_t x264_dct4_weight2_tab[16] = {
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2),
- W(0), W(1), W(0), W(1),
- W(1), W(2), W(1), W(2)
-};
-#undef W
-
-#define W(i) (i==0 ? FIX8(1.00000) :\
- i==1 ? FIX8(0.78487) :\
- i==2 ? FIX8(2.56132) :\
- i==3 ? FIX8(0.88637) :\
- i==4 ? FIX8(1.60040) :\
- i==5 ? FIX8(1.41850) :0)
-const uint32_t x264_dct8_weight2_tab[64] = {
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
-
- W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
- W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
- W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1)
-};
-#undef W
-
-
static void dct4x4dc( dctcoef d[16] )
{
dctcoef tmp[16];
#ifndef X264_DCT_H
#define X264_DCT_H
-extern const uint32_t x264_dct4_weight_tab[16];
-extern const uint32_t x264_dct8_weight_tab[64];
-extern const uint32_t x264_dct4_weight2_tab[16];
-extern const uint32_t x264_dct8_weight2_tab[64];
-
typedef struct
{
// pix1 stride = FENC_STRIDE
} x264_zigzag_function_t;
+#define x264_dct_init x264_template(dct_init)
void x264_dct_init( int cpu, x264_dct_function_t *dctf );
+#define x264_zigzag_init x264_template(zigzag_init)
void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
#endif
}
#if HAVE_MMX
-void x264_deblock_v_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_422_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_422_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_422_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_strength_sse2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_ssse3 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_avx ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_avx2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_strength_avx512( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-
-void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
-#if ARCH_X86
-void x264_deblock_h_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v8_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v8_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-
-#if HIGH_BIT_DEPTH
-void x264_deblock_v_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
-#else
-// FIXME this wrapper has a significant cpu cost
-static void x264_deblock_v_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
-{
- x264_deblock_v8_luma_mmx2( pix, stride, alpha, beta, tc0 );
- x264_deblock_v8_luma_mmx2( pix+8, stride, alpha, beta, tc0+2 );
-}
-static void x264_deblock_v_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta )
-{
- x264_deblock_v8_luma_intra_mmx2( pix, stride, alpha, beta );
- x264_deblock_v8_luma_intra_mmx2( pix+8, stride, alpha, beta );
-}
-#endif // HIGH_BIT_DEPTH
+#include "x86/deblock.h"
#endif
-#endif
-
#if ARCH_PPC
-void x264_deblock_v_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-#endif // ARCH_PPC
-
-#if HAVE_ARMV6 || ARCH_AARCH64
-void x264_deblock_v_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_strength_neon( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
- int mvy_limit, int bframe );
-void x264_deblock_h_chroma_422_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_intra_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_422_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#include "ppc/deblock.h"
#endif
-
-#if !HIGH_BIT_DEPTH
-#if HAVE_MSA
-void x264_deblock_v_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_h_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
-void x264_deblock_v_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_v_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_h_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
-void x264_deblock_strength_msa( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
- int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit,
- int bframe );
+#if HAVE_ARMV6
+#include "arm/deblock.h"
#endif
+#if ARCH_AARCH64
+#include "aarch64/deblock.h"
+#endif
+#if HAVE_MSA
+#include "mips/deblock.h"
#endif
void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff )
int bframe );
} x264_deblock_function_t;
+#define x264_frame_delete x264_template(frame_delete)
void x264_frame_delete( x264_frame_t *frame );
+#define x264_frame_copy_picture x264_template(frame_copy_picture)
int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src );
+#define x264_frame_expand_border x264_template(frame_expand_border)
void x264_frame_expand_border( x264_t *h, x264_frame_t *frame, int mb_y );
+#define x264_frame_expand_border_filtered x264_template(frame_expand_border_filtered)
void x264_frame_expand_border_filtered( x264_t *h, x264_frame_t *frame, int mb_y, int b_end );
+#define x264_frame_expand_border_lowres x264_template(frame_expand_border_lowres)
void x264_frame_expand_border_lowres( x264_frame_t *frame );
+#define x264_frame_expand_border_chroma x264_template(frame_expand_border_chroma)
void x264_frame_expand_border_chroma( x264_t *h, x264_frame_t *frame, int plane );
+#define x264_frame_expand_border_mod16 x264_template(frame_expand_border_mod16)
void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame );
+#define x264_expand_border_mbpair x264_template(expand_border_mbpair)
void x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y );
+#define x264_frame_deblock_row x264_template(frame_deblock_row)
void x264_frame_deblock_row( x264_t *h, int mb_y );
+#define x264_macroblock_deblock x264_template(macroblock_deblock)
void x264_macroblock_deblock( x264_t *h );
+#define x264_frame_filter x264_template(frame_filter)
void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end );
+#define x264_frame_init_lowres x264_template(frame_init_lowres)
void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame );
+#define x264_deblock_init x264_template(deblock_init)
void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff );
+#define x264_frame_cond_broadcast x264_template(frame_cond_broadcast)
void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed );
+#define x264_frame_cond_wait x264_template(frame_cond_wait)
void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed );
+#define x264_frame_new_slice x264_template(frame_new_slice)
int x264_frame_new_slice( x264_t *h, x264_frame_t *frame );
+#define x264_threadslice_cond_broadcast x264_template(threadslice_cond_broadcast)
void x264_threadslice_cond_broadcast( x264_t *h, int pass );
+#define x264_threadslice_cond_wait x264_template(threadslice_cond_wait)
void x264_threadslice_cond_wait( x264_t *h, int pass );
+#define x264_frame_push x264_template(frame_push)
void x264_frame_push( x264_frame_t **list, x264_frame_t *frame );
+#define x264_frame_pop x264_template(frame_pop)
x264_frame_t *x264_frame_pop( x264_frame_t **list );
+#define x264_frame_unshift x264_template(frame_unshift)
void x264_frame_unshift( x264_frame_t **list, x264_frame_t *frame );
+#define x264_frame_shift x264_template(frame_shift)
x264_frame_t *x264_frame_shift( x264_frame_t **list );
+#define x264_frame_push_unused x264_template(frame_push_unused)
void x264_frame_push_unused( x264_t *h, x264_frame_t *frame );
+#define x264_frame_push_blank_unused x264_template(frame_push_blank_unused)
void x264_frame_push_blank_unused( x264_t *h, x264_frame_t *frame );
+#define x264_frame_pop_blank_unused x264_template(frame_pop_blank_unused)
x264_frame_t *x264_frame_pop_blank_unused( x264_t *h );
+#define x264_weight_scale_plane x264_template(weight_scale_plane)
void x264_weight_scale_plane( x264_t *h, pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride,
int i_width, int i_height, x264_weight_t *w );
+#define x264_frame_pop_unused x264_template(frame_pop_unused)
x264_frame_t *x264_frame_pop_unused( x264_t *h, int b_fdec );
+#define x264_frame_delete_list x264_template(frame_delete_list)
void x264_frame_delete_list( x264_frame_t **list );
+#define x264_sync_frame_list_init x264_template(sync_frame_list_init)
int x264_sync_frame_list_init( x264_sync_frame_list_t *slist, int nelem );
+#define x264_sync_frame_list_delete x264_template(sync_frame_list_delete)
void x264_sync_frame_list_delete( x264_sync_frame_list_t *slist );
+#define x264_sync_frame_list_push x264_template(sync_frame_list_push)
void x264_sync_frame_list_push( x264_sync_frame_list_t *slist, x264_frame_t *frame );
+#define x264_sync_frame_list_pop x264_template(sync_frame_list_pop)
x264_frame_t *x264_sync_frame_list_pop( x264_sync_frame_list_t *slist );
#endif
};
/* Per-frame allocation: is allocated per-thread only in frame-threads mode. */
+#define x264_macroblock_cache_allocate x264_template(macroblock_cache_allocate)
int x264_macroblock_cache_allocate( x264_t *h );
+#define x264_macroblock_cache_free x264_template(macroblock_cache_free)
void x264_macroblock_cache_free( x264_t *h );
/* Per-thread allocation: is allocated per-thread even in sliced-threads mode. */
+#define x264_macroblock_thread_allocate x264_template(macroblock_thread_allocate)
int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead );
+#define x264_macroblock_thread_free x264_template(macroblock_thread_free)
void x264_macroblock_thread_free( x264_t *h, int b_lookahead );
+#define x264_macroblock_slice_init x264_template(macroblock_slice_init)
void x264_macroblock_slice_init( x264_t *h );
+#define x264_macroblock_thread_init x264_template(macroblock_thread_init)
void x264_macroblock_thread_init( x264_t *h );
+#define x264_macroblock_cache_load_interlaced x264_template(macroblock_cache_load_interlaced)
void x264_macroblock_cache_load_progressive( x264_t *h, int mb_x, int mb_y );
+#define x264_macroblock_cache_load_progressive x264_template(macroblock_cache_load_progressive)
void x264_macroblock_cache_load_interlaced( x264_t *h, int mb_x, int mb_y );
+#define x264_macroblock_deblock_strength x264_template(macroblock_deblock_strength)
void x264_macroblock_deblock_strength( x264_t *h );
+#define x264_macroblock_cache_save x264_template(macroblock_cache_save)
void x264_macroblock_cache_save( x264_t *h );
+#define x264_macroblock_bipred_init x264_template(macroblock_bipred_init)
void x264_macroblock_bipred_init( x264_t *h );
+#define x264_prefetch_fenc x264_template(prefetch_fenc)
void x264_prefetch_fenc( x264_t *h, x264_frame_t *fenc, int i_mb_x, int i_mb_y );
+#define x264_copy_column8 x264_template(copy_column8)
void x264_copy_column8( pixel *dst, pixel *src );
/* x264_mb_predict_mv_16x16:
* set mvp with predicted mv for D_16x16 block
* h->mb. need only valid values from other blocks */
+#define x264_mb_predict_mv_16x16 x264_template(mb_predict_mv_16x16)
void x264_mb_predict_mv_16x16( x264_t *h, int i_list, int i_ref, int16_t mvp[2] );
/* x264_mb_predict_mv_pskip:
* set mvp with predicted mv for P_SKIP
* h->mb. need only valid values from other blocks */
+#define x264_mb_predict_mv_pskip x264_template(mb_predict_mv_pskip)
void x264_mb_predict_mv_pskip( x264_t *h, int16_t mv[2] );
/* x264_mb_predict_mv:
* set mvp with predicted mv for all blocks except SKIP and DIRECT
* h->mb. need valid ref/partition/sub of current block to be valid
* and valid mv/ref from other blocks. */
+#define x264_mb_predict_mv x264_template(mb_predict_mv)
void x264_mb_predict_mv( x264_t *h, int i_list, int idx, int i_width, int16_t mvp[2] );
/* x264_mb_predict_mv_direct16x16:
* set h->mb.cache.mv and h->mb.cache.ref for B_SKIP or B_DIRECT
* return 1 on success, 0 on failure.
* if b_changed != NULL, set it to whether refs or mvs differ from
* before this functioncall. */
+#define x264_mb_predict_mv_direct16x16 x264_template(mb_predict_mv_direct16x16)
int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed );
/* x264_mb_predict_mv_ref16x16:
* set mvc with D_16x16 prediction.
* uses all neighbors, even those that didn't end up using this ref.
* h->mb. need only valid values from other blocks */
+#define x264_mb_predict_mv_ref16x16 x264_template(mb_predict_mv_ref16x16)
void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[8][2], int *i_mvc );
+#define x264_mb_mc x264_template(mb_mc)
void x264_mb_mc( x264_t *h );
+#define x264_mb_mc_8x8 x264_template(mb_mc_8x8)
void x264_mb_mc_8x8( x264_t *h, int i8 );
static ALWAYS_INLINE uint32_t pack16to32( uint32_t a, uint32_t b )
}
}
-const uint8_t x264_hpel_ref0[16] = {0,1,1,1,0,1,1,1,2,3,3,3,0,1,1,1};
-const uint8_t x264_hpel_ref1[16] = {0,0,1,0,2,2,3,2,2,2,3,2,2,2,3,2};
-
static void mc_luma( pixel *dst, intptr_t i_dst_stride,
pixel *src[4], intptr_t i_src_stride,
int mvx, int mvy,
MC_CLIP_ADD((s)[1], (x)[1]);\
} while( 0 )
+#define x264_mbtree_propagate_list_internal_neon x264_template(mbtree_propagate_list_internal_neon)
#define PROPAGATE_LIST(cpu)\
void x264_mbtree_propagate_list_internal_##cpu( int16_t (*mvs)[2], int16_t *propagate_amount,\
uint16_t *lowres_costs, int16_t *output,\
}\
}
+#define x264_plane_copy_c x264_template(plane_copy_c)
void x264_plane_copy_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY(align, cpu)\
}\
}
+#define x264_plane_copy_swap_c x264_template(plane_copy_swap_c)
void x264_plane_copy_swap_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
#define PLANE_COPY_SWAP(align, cpu)\
x264_plane_copy_swap_c( dst, i_dst, src, i_src, w, h );\
}
+#define x264_plane_copy_deinterleave_c x264_template(plane_copy_deinterleave_c)
void x264_plane_copy_deinterleave_c( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,
pixel *src, intptr_t i_src, int w, int h );
x264_plane_copy_deinterleave_c( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\
}
+#define x264_plane_copy_interleave_c x264_template(plane_copy_interleave_c)
void x264_plane_copy_interleave_c( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
weight_fn_t *weightfn;
} ALIGNED_16( x264_weight_t );
+#define x264_weight_none x264_template(weight_none)
extern const x264_weight_t x264_weight_none[3];
-extern const uint8_t x264_hpel_ref0[16];
-extern const uint8_t x264_hpel_ref1[16];
#define SET_WEIGHT( w, b, s, d, o )\
{\
void (*mbtree_fix8_unpack)( float *dst, uint16_t *src, int count );
} x264_mc_functions_t;
+#define x264_mc_init x264_template(mc_init)
void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent );
#endif
#include "common/common.h"
#include "macros.h"
+#include "dct.h"
#if !HIGH_BIT_DEPTH
#define AVC_ITRANS_H( in0, in1, in2, in3, out0, out1, out2, out3 ) \
#ifndef X264_MIPS_DCT_H
#define X264_MIPS_DCT_H
+#define x264_dct4x4dc_msa x264_template(dct4x4dc_msa)
void x264_dct4x4dc_msa( int16_t d[16] );
+#define x264_idct4x4dc_msa x264_template(idct4x4dc_msa)
void x264_idct4x4dc_msa( int16_t d[16] );
+#define x264_add4x4_idct_msa x264_template(add4x4_idct_msa)
void x264_add4x4_idct_msa( uint8_t *p_dst, int16_t pi_dct[16] );
+#define x264_add8x8_idct_msa x264_template(add8x8_idct_msa)
void x264_add8x8_idct_msa( uint8_t *p_dst, int16_t pi_dct[4][16] );
+#define x264_add16x16_idct_msa x264_template(add16x16_idct_msa)
void x264_add16x16_idct_msa( uint8_t *p_dst, int16_t pi_dct[16][16] );
+#define x264_add8x8_idct8_msa x264_template(add8x8_idct8_msa)
void x264_add8x8_idct8_msa( uint8_t *p_dst, int16_t pi_dct[64] );
+#define x264_add16x16_idct8_msa x264_template(add16x16_idct8_msa)
void x264_add16x16_idct8_msa( uint8_t *p_dst, int16_t pi_dct[4][64] );
+#define x264_add8x8_idct_dc_msa x264_template(add8x8_idct_dc_msa)
void x264_add8x8_idct_dc_msa( uint8_t *p_dst, int16_t pi_dct[4] );
+#define x264_add16x16_idct_dc_msa x264_template(add16x16_idct_dc_msa)
void x264_add16x16_idct_dc_msa( uint8_t *p_dst, int16_t pi_dct[16] );
+#define x264_sub4x4_dct_msa x264_template(sub4x4_dct_msa)
void x264_sub4x4_dct_msa( int16_t p_dst[16], uint8_t *p_src, uint8_t *p_ref );
+#define x264_sub8x8_dct_msa x264_template(sub8x8_dct_msa)
void x264_sub8x8_dct_msa( int16_t p_dst[4][16], uint8_t *p_src,
uint8_t *p_ref );
+#define x264_sub16x16_dct_msa x264_template(sub16x16_dct_msa)
void x264_sub16x16_dct_msa( int16_t p_dst[16][16], uint8_t *p_src,
uint8_t *p_ref );
+#define x264_sub8x8_dct_dc_msa x264_template(sub8x8_dct_dc_msa)
void x264_sub8x8_dct_dc_msa( int16_t pi_dct[4], uint8_t *p_pix1,
uint8_t *p_pix2 );
+#define x264_sub8x16_dct_dc_msa x264_template(sub8x16_dct_dc_msa)
void x264_sub8x16_dct_dc_msa( int16_t pi_dct[8], uint8_t *p_pix1,
uint8_t *p_pix2 );
+#define x264_zigzag_scan_4x4_frame_msa x264_template(zigzag_scan_4x4_frame_msa)
void x264_zigzag_scan_4x4_frame_msa( int16_t pi_level[16], int16_t pi_dct[16] );
#endif
#include "common/common.h"
#include "macros.h"
+#include "deblock.h"
#if !HIGH_BIT_DEPTH
#define AVC_LPF_P0P1P2_OR_Q0Q1Q2( p3_or_q3_org_in, p0_or_q0_org_in, \
--- /dev/null
+/*****************************************************************************
+ * deblock.h: msa deblocking
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_MIPS_DEBLOCK_H
+#define X264_MIPS_DEBLOCK_H
+
+#if !HIGH_BIT_DEPTH
+#define x264_deblock_v_luma_msa x264_template(deblock_v_luma_msa)
+void x264_deblock_v_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_msa x264_template(deblock_h_luma_msa)
+void x264_deblock_h_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_chroma_msa x264_template(deblock_v_chroma_msa)
+void x264_deblock_v_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_msa x264_template(deblock_h_chroma_msa)
+void x264_deblock_h_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_luma_intra_msa x264_template(deblock_v_luma_intra_msa)
+void x264_deblock_v_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_luma_intra_msa x264_template(deblock_h_luma_intra_msa)
+void x264_deblock_h_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_msa x264_template(deblock_v_chroma_intra_msa)
+void x264_deblock_v_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_msa x264_template(deblock_h_chroma_intra_msa)
+void x264_deblock_h_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_strength_msa x264_template(deblock_strength_msa)
+void x264_deblock_strength_msa( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit,
+ int bframe );
+#endif
+
+#endif
#ifndef X264_MIPS_MC_H
#define X264_MIPS_MC_H
+#define x264_mc_init_mips x264_template(mc_init_mips)
void x264_mc_init_mips( int cpu, x264_mc_functions_t *pf );
#endif
#ifndef X264_MIPS_SAD_H
#define X264_MIPS_SAD_H
+#define x264_pixel_sad_16x16_msa x264_template(pixel_sad_16x16_msa)
int32_t x264_pixel_sad_16x16_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_16x8_msa x264_template(pixel_sad_16x8_msa)
int32_t x264_pixel_sad_16x8_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_8x16_msa x264_template(pixel_sad_8x16_msa)
int32_t x264_pixel_sad_8x16_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_8x8_msa x264_template(pixel_sad_8x8_msa)
int32_t x264_pixel_sad_8x8_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_8x4_msa x264_template(pixel_sad_8x4_msa)
int32_t x264_pixel_sad_8x4_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_4x16_msa x264_template(pixel_sad_4x16_msa)
int32_t x264_pixel_sad_4x16_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_4x8_msa x264_template(pixel_sad_4x8_msa)
int32_t x264_pixel_sad_4x8_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_4x4_msa x264_template(pixel_sad_4x4_msa)
int32_t x264_pixel_sad_4x4_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_sad_x4_16x16_msa x264_template(pixel_sad_x4_16x16_msa)
void x264_pixel_sad_x4_16x16_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x4_16x8_msa x264_template(pixel_sad_x4_16x8_msa)
void x264_pixel_sad_x4_16x8_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x4_8x16_msa x264_template(pixel_sad_x4_8x16_msa)
void x264_pixel_sad_x4_8x16_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x4_8x8_msa x264_template(pixel_sad_x4_8x8_msa)
void x264_pixel_sad_x4_8x8_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x4_8x4_msa x264_template(pixel_sad_x4_8x4_msa)
void x264_pixel_sad_x4_8x4_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x4_4x8_msa x264_template(pixel_sad_x4_4x8_msa)
void x264_pixel_sad_x4_4x8_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x4_4x4_msa x264_template(pixel_sad_x4_4x4_msa)
void x264_pixel_sad_x4_4x4_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
uint8_t *p_ref3, intptr_t i_ref_stride,
int32_t p_sad_array[4] );
+#define x264_pixel_sad_x3_16x16_msa x264_template(pixel_sad_x3_16x16_msa)
void x264_pixel_sad_x3_16x16_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_sad_x3_16x8_msa x264_template(pixel_sad_x3_16x8_msa)
void x264_pixel_sad_x3_16x8_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_sad_x3_8x16_msa x264_template(pixel_sad_x3_8x16_msa)
void x264_pixel_sad_x3_8x16_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_sad_x3_8x8_msa x264_template(pixel_sad_x3_8x8_msa)
void x264_pixel_sad_x3_8x8_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_sad_x3_8x4_msa x264_template(pixel_sad_x3_8x4_msa)
void x264_pixel_sad_x3_8x4_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_sad_x3_4x8_msa x264_template(pixel_sad_x3_4x8_msa)
void x264_pixel_sad_x3_4x8_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_sad_x3_4x4_msa x264_template(pixel_sad_x3_4x4_msa)
void x264_pixel_sad_x3_4x4_msa( uint8_t *p_src, uint8_t *p_ref0,
uint8_t *p_ref1, uint8_t *p_ref2,
intptr_t i_ref_stride,
int32_t p_sad_array[3] );
+#define x264_pixel_ssd_16x16_msa x264_template(pixel_ssd_16x16_msa)
int32_t x264_pixel_ssd_16x16_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_16x8_msa x264_template(pixel_ssd_16x8_msa)
int32_t x264_pixel_ssd_16x8_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_8x16_msa x264_template(pixel_ssd_8x16_msa)
int32_t x264_pixel_ssd_8x16_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_8x8_msa x264_template(pixel_ssd_8x8_msa)
int32_t x264_pixel_ssd_8x8_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_8x4_msa x264_template(pixel_ssd_8x4_msa)
int32_t x264_pixel_ssd_8x4_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_4x16_msa x264_template(pixel_ssd_4x16_msa)
int32_t x264_pixel_ssd_4x16_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_4x8_msa x264_template(pixel_ssd_4x8_msa)
int32_t x264_pixel_ssd_4x8_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_pixel_ssd_4x4_msa x264_template(pixel_ssd_4x4_msa)
int32_t x264_pixel_ssd_4x4_msa( uint8_t *p_src, intptr_t i_src_stride,
uint8_t *p_ref, intptr_t i_ref_stride );
+#define x264_intra_sad_x3_4x4_msa x264_template(intra_sad_x3_4x4_msa)
void x264_intra_sad_x3_4x4_msa( uint8_t *p_enc, uint8_t *p_dec,
int32_t p_sad_array[3] );
+#define x264_intra_sad_x3_16x16_msa x264_template(intra_sad_x3_16x16_msa)
void x264_intra_sad_x3_16x16_msa( uint8_t *p_enc, uint8_t *p_dec,
int32_t p_sad_array[3] );
+#define x264_intra_sad_x3_8x8_msa x264_template(intra_sad_x3_8x8_msa)
void x264_intra_sad_x3_8x8_msa( uint8_t *p_enc, uint8_t p_edge[36],
int32_t p_sad_array[3] );
+#define x264_intra_sad_x3_8x8c_msa x264_template(intra_sad_x3_8x8c_msa)
void x264_intra_sad_x3_8x8c_msa( uint8_t *p_enc, uint8_t *p_dec,
int32_t p_sad_array[3] );
+#define x264_ssim_4x4x2_core_msa x264_template(ssim_4x4x2_core_msa)
void x264_ssim_4x4x2_core_msa( const uint8_t *p_pix1, intptr_t i_stride1,
const uint8_t *p_pix2, intptr_t i_stride2,
int32_t i_sums[2][4] );
+#define x264_pixel_hadamard_ac_8x8_msa x264_template(pixel_hadamard_ac_8x8_msa)
uint64_t x264_pixel_hadamard_ac_8x8_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_hadamard_ac_8x16_msa x264_template(pixel_hadamard_ac_8x16_msa)
uint64_t x264_pixel_hadamard_ac_8x16_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_hadamard_ac_16x8_msa x264_template(pixel_hadamard_ac_16x8_msa)
uint64_t x264_pixel_hadamard_ac_16x8_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_hadamard_ac_16x16_msa x264_template(pixel_hadamard_ac_16x16_msa)
uint64_t x264_pixel_hadamard_ac_16x16_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_satd_4x4_msa x264_template(pixel_satd_4x4_msa)
int32_t x264_pixel_satd_4x4_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_4x8_msa x264_template(pixel_satd_4x8_msa)
int32_t x264_pixel_satd_4x8_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_4x16_msa x264_template(pixel_satd_4x16_msa)
int32_t x264_pixel_satd_4x16_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_8x4_msa x264_template(pixel_satd_8x4_msa)
int32_t x264_pixel_satd_8x4_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_8x8_msa x264_template(pixel_satd_8x8_msa)
int32_t x264_pixel_satd_8x8_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_8x16_msa x264_template(pixel_satd_8x16_msa)
int32_t x264_pixel_satd_8x16_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_16x8_msa x264_template(pixel_satd_16x8_msa)
int32_t x264_pixel_satd_16x8_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_satd_16x16_msa x264_template(pixel_satd_16x16_msa)
int32_t x264_pixel_satd_16x16_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_sa8d_8x8_msa x264_template(pixel_sa8d_8x8_msa)
int32_t x264_pixel_sa8d_8x8_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_pixel_sa8d_16x16_msa x264_template(pixel_sa8d_16x16_msa)
int32_t x264_pixel_sa8d_16x16_msa( uint8_t *p_pix1, intptr_t i_stride,
uint8_t *p_pix2, intptr_t i_stride2 );
+#define x264_intra_satd_x3_4x4_msa x264_template(intra_satd_x3_4x4_msa)
void x264_intra_satd_x3_4x4_msa( uint8_t *p_enc, uint8_t *p_dec,
int32_t p_sad_array[3] );
+#define x264_intra_satd_x3_16x16_msa x264_template(intra_satd_x3_16x16_msa)
void x264_intra_satd_x3_16x16_msa( uint8_t *p_enc, uint8_t *p_dec,
int32_t p_sad_array[3] );
+#define x264_intra_sa8d_x3_8x8_msa x264_template(intra_sa8d_x3_8x8_msa)
void x264_intra_sa8d_x3_8x8_msa( uint8_t *p_enc, uint8_t p_edge[36],
int32_t p_sad_array[3] );
+#define x264_intra_satd_x3_8x8c_msa x264_template(intra_satd_x3_8x8c_msa)
void x264_intra_satd_x3_8x8c_msa( uint8_t *p_enc, uint8_t *p_dec,
int32_t p_sad_array[3] );
+#define x264_pixel_var_16x16_msa x264_template(pixel_var_16x16_msa)
uint64_t x264_pixel_var_16x16_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_var_8x16_msa x264_template(pixel_var_8x16_msa)
uint64_t x264_pixel_var_8x16_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_var_8x8_msa x264_template(pixel_var_8x8_msa)
uint64_t x264_pixel_var_8x8_msa( uint8_t *p_pix, intptr_t i_stride );
+#define x264_pixel_var2_8x16_msa x264_template(pixel_var2_8x16_msa)
int32_t x264_pixel_var2_8x16_msa( uint8_t *p_pix1, intptr_t i_stride1,
uint8_t *p_pix2, intptr_t i_stride2,
int32_t *p_ssd );
+#define x264_pixel_var2_8x8_msa x264_template(pixel_var2_8x8_msa)
int32_t x264_pixel_var2_8x8_msa( uint8_t *p_pix1, intptr_t i_stride1,
uint8_t *p_pix2, intptr_t i_stride2,
int32_t *p_ssd );
#include "common/common.h"
#include "macros.h"
+#include "predict.h"
#if !HIGH_BIT_DEPTH
static void intra_predict_vert_4x4_msa( uint8_t *p_src, uint8_t *p_dst,
#ifndef X264_MIPS_PREDICT_H
#define X264_MIPS_PREDICT_H
+#define x264_intra_predict_dc_16x16_msa x264_template(intra_predict_dc_16x16_msa)
void x264_intra_predict_dc_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_dc_left_16x16_msa x264_template(intra_predict_dc_left_16x16_msa)
void x264_intra_predict_dc_left_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_dc_top_16x16_msa x264_template(intra_predict_dc_top_16x16_msa)
void x264_intra_predict_dc_top_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_dc_128_16x16_msa x264_template(intra_predict_dc_128_16x16_msa)
void x264_intra_predict_dc_128_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_hor_16x16_msa x264_template(intra_predict_hor_16x16_msa)
void x264_intra_predict_hor_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_vert_16x16_msa x264_template(intra_predict_vert_16x16_msa)
void x264_intra_predict_vert_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_plane_16x16_msa x264_template(intra_predict_plane_16x16_msa)
void x264_intra_predict_plane_16x16_msa( uint8_t *p_src );
+#define x264_intra_predict_dc_4blk_8x8_msa x264_template(intra_predict_dc_4blk_8x8_msa)
void x264_intra_predict_dc_4blk_8x8_msa( uint8_t *p_src );
+#define x264_intra_predict_hor_8x8_msa x264_template(intra_predict_hor_8x8_msa)
void x264_intra_predict_hor_8x8_msa( uint8_t *p_src );
+#define x264_intra_predict_vert_8x8_msa x264_template(intra_predict_vert_8x8_msa)
void x264_intra_predict_vert_8x8_msa( uint8_t *p_src );
+#define x264_intra_predict_plane_8x8_msa x264_template(intra_predict_plane_8x8_msa)
void x264_intra_predict_plane_8x8_msa( uint8_t *p_src );
+#define x264_intra_predict_ddl_8x8_msa x264_template(intra_predict_ddl_8x8_msa)
void x264_intra_predict_ddl_8x8_msa( uint8_t *p_src, uint8_t pu_xyz[36] );
+#define x264_intra_predict_dc_8x8_msa x264_template(intra_predict_dc_8x8_msa)
void x264_intra_predict_dc_8x8_msa( uint8_t *p_src, uint8_t pu_xyz[36] );
+#define x264_intra_predict_h_8x8_msa x264_template(intra_predict_h_8x8_msa)
void x264_intra_predict_h_8x8_msa( uint8_t *p_src, uint8_t pu_xyz[36] );
+#define x264_intra_predict_v_8x8_msa x264_template(intra_predict_v_8x8_msa)
void x264_intra_predict_v_8x8_msa( uint8_t *p_src, uint8_t pu_xyz[36] );
+#define x264_intra_predict_dc_4x4_msa x264_template(intra_predict_dc_4x4_msa)
void x264_intra_predict_dc_4x4_msa( uint8_t *p_src );
+#define x264_intra_predict_hor_4x4_msa x264_template(intra_predict_hor_4x4_msa)
void x264_intra_predict_hor_4x4_msa( uint8_t *p_src );
+#define x264_intra_predict_vert_4x4_msa x264_template(intra_predict_vert_4x4_msa)
void x264_intra_predict_vert_4x4_msa( uint8_t *p_src );
#endif
#include "common/common.h"
#include "macros.h"
+#include "quant.h"
#if !HIGH_BIT_DEPTH
static void avc_dequant_4x4_msa( int16_t *p_dct, int32_t pi_dequant_mf[6][16],
#ifndef X264_MIPS_QUANT_H
#define X264_MIPS_QUANT_H
+#define x264_dequant_4x4_msa x264_template(dequant_4x4_msa)
void x264_dequant_4x4_msa( int16_t *p_dct, int32_t pi_dequant_mf[6][16],
int32_t i_qp );
+#define x264_dequant_8x8_msa x264_template(dequant_8x8_msa)
void x264_dequant_8x8_msa( int16_t *p_dct, int32_t pi_dequant_mf[6][64],
int32_t i_qp );
+#define x264_dequant_4x4_dc_msa x264_template(dequant_4x4_dc_msa)
void x264_dequant_4x4_dc_msa( int16_t *p_dct, int32_t pi_dequant_mf[6][16],
int32_t i_qp );
+#define x264_quant_4x4_msa x264_template(quant_4x4_msa)
int32_t x264_quant_4x4_msa( int16_t *p_dct, uint16_t *p_mf, uint16_t *p_bias );
+#define x264_quant_4x4x4_msa x264_template(quant_4x4x4_msa)
int32_t x264_quant_4x4x4_msa( int16_t p_dct[4][16],
uint16_t pu_mf[16], uint16_t pu_bias[16] );
+#define x264_quant_8x8_msa x264_template(quant_8x8_msa)
int32_t x264_quant_8x8_msa( int16_t *p_dct, uint16_t *p_mf, uint16_t *p_bias );
+#define x264_quant_4x4_dc_msa x264_template(quant_4x4_dc_msa)
int32_t x264_quant_4x4_dc_msa( int16_t *p_dct, int32_t i_mf, int32_t i_bias );
+#define x264_coeff_last64_msa x264_template(coeff_last64_msa)
int32_t x264_coeff_last64_msa( int16_t *p_src );
+#define x264_coeff_last16_msa x264_template(coeff_last16_msa)
int32_t x264_coeff_last16_msa( int16_t *p_src );
#endif
typedef struct x264_frame x264_frame;
+#define x264_opencl_load_library x264_template(opencl_load_library)
x264_opencl_function_t *x264_opencl_load_library( void );
+#define x264_opencl_close_library x264_template(opencl_close_library)
void x264_opencl_close_library( x264_opencl_function_t *ocl );
+#define x264_opencl_lookahead_init x264_template(opencl_lookahead_init)
int x264_opencl_lookahead_init( x264_t *h );
+#define x264_opencl_lookahead_delete x264_template(opencl_lookahead_delete)
void x264_opencl_lookahead_delete( x264_t *h );
+#define x264_opencl_frame_delete x264_template(opencl_frame_delete)
void x264_opencl_frame_delete( x264_frame *frame );
#endif
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#include "common.h"
+#include "osdep.h"
#ifdef _WIN32
#include <windows.h>
#define x264_is_pipe(x) 0
#endif
+#define x264_glue3_expand(x,y,z) x##_##y##_##z
+#define x264_glue3(x,y,z) x264_glue3_expand(x,y,z)
+
#ifdef _MSC_VER
#define DECLARE_ALIGNED( var, n ) __declspec(align(n)) var
#else
int (*intra_sad_x9_8x8) ( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds );
} x264_pixel_function_t;
+#define x264_pixel_init x264_template(pixel_init)
void x264_pixel_init( int cpu, x264_pixel_function_t *pixf );
+#define x264_pixel_ssd_nv12 x264_template(pixel_ssd_nv12)
void x264_pixel_ssd_nv12 ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_wxh x264_template(pixel_ssd_wxh)
uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height );
+#define x264_pixel_ssim_wxh x264_template(pixel_ssim_wxh)
float x264_pixel_ssim_wxh ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2,
int i_width, int i_height, void *buf, int *cnt );
+#define x264_field_vsad x264_template(field_vsad)
int x264_field_vsad( x264_t *h, int mb_x, int mb_y );
#endif
#include "common/common.h"
#include "ppccommon.h"
+#include "dct.h"
#if !HIGH_BIT_DEPTH
#define VEC_DCT(a0,a1,a2,a3,b0,b1,b2,b3) \
#ifndef X264_PPC_DCT_H
#define X264_PPC_DCT_H
+#define x264_sub4x4_dct_altivec x264_template(sub4x4_dct_altivec)
void x264_sub4x4_dct_altivec( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_altivec x264_template(sub8x8_dct_altivec)
void x264_sub8x8_dct_altivec( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_altivec x264_template(sub16x16_dct_altivec)
void x264_sub16x16_dct_altivec( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add8x8_idct_dc_altivec x264_template(add8x8_idct_dc_altivec)
void x264_add8x8_idct_dc_altivec( uint8_t *p_dst, int16_t dct[4] );
+#define x264_add4x4_idct_altivec x264_template(add4x4_idct_altivec)
void x264_add4x4_idct_altivec( uint8_t *p_dst, int16_t dct[16] );
+#define x264_add8x8_idct_altivec x264_template(add8x8_idct_altivec)
void x264_add8x8_idct_altivec( uint8_t *p_dst, int16_t dct[4][16] );
+#define x264_add16x16_idct_altivec x264_template(add16x16_idct_altivec)
void x264_add16x16_idct_altivec( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_sub8x8_dct_dc_altivec x264_template(sub8x8_dct_dc_altivec)
void x264_sub8x8_dct_dc_altivec( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_altivec x264_template(sub8x8_dct8_altivec)
void x264_sub8x8_dct8_altivec( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_altivec x264_template(sub16x16_dct8_altivec)
void x264_sub16x16_dct8_altivec( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add8x8_idct8_altivec x264_template(add8x8_idct8_altivec)
void x264_add8x8_idct8_altivec( uint8_t *dst, int16_t dct[64] );
+#define x264_add16x16_idct8_altivec x264_template(add16x16_idct8_altivec)
void x264_add16x16_idct8_altivec( uint8_t *dst, int16_t dct[4][64] );
+#define x264_zigzag_scan_4x4_frame_altivec x264_template(zigzag_scan_4x4_frame_altivec)
void x264_zigzag_scan_4x4_frame_altivec( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_field_altivec x264_template(zigzag_scan_4x4_field_altivec)
void x264_zigzag_scan_4x4_field_altivec( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_8x8_frame_altivec x264_template(zigzag_scan_8x8_frame_altivec)
void x264_zigzag_scan_8x8_frame_altivec( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_interleave_8x8_cavlc_altivec x264_template(zigzag_interleave_8x8_cavlc_altivec)
void x264_zigzag_interleave_8x8_cavlc_altivec( int16_t *dst, int16_t *src, uint8_t *nnz );
#endif
#include "common/common.h"
#include "ppccommon.h"
+#include "deblock.h"
#if !HIGH_BIT_DEPTH
#define transpose4x16(r0, r1, r2, r3) \
--- /dev/null
+/*****************************************************************************
+ * deblock.h: ppc deblocking
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_PPC_DEBLOCK_H
+#define X264_PPC_DEBLOCK_H
+
+#define x264_deblock_v_luma_altivec x264_template(deblock_v_luma_altivec)
+void x264_deblock_v_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_altivec x264_template(deblock_h_luma_altivec)
+void x264_deblock_h_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+
+#endif
*****************************************************************************/
#include "common/common.h"
-#include "mc.h"
#include "ppccommon.h"
+#include "mc.h"
#if !HIGH_BIT_DEPTH
typedef void (*pf_mc_t)( uint8_t *src, intptr_t i_src,
}
}
+#define x264_plane_copy_swap_core_altivec x264_template(plane_copy_swap_core_altivec)
void x264_plane_copy_swap_core_altivec( uint8_t *dst, intptr_t i_dst,
uint8_t *src, intptr_t i_src, int w, int h )
{
}
}
+#define x264_plane_copy_interleave_core_altivec x264_template(plane_copy_interleave_core_altivec)
void x264_plane_copy_interleave_core_altivec( uint8_t *dst, intptr_t i_dst,
uint8_t *srcu, intptr_t i_srcu,
uint8_t *srcv, intptr_t i_srcv, int w, int h )
#ifndef X264_PPC_MC_H
#define X264_PPC_MC_H
+#define x264_mc_init_altivec x264_template(mc_init_altivec)
void x264_mc_init_altivec( x264_mc_functions_t *pf );
#endif
#include "common/common.h"
#include "ppccommon.h"
+#include "pixel.h"
#if !HIGH_BIT_DEPTH
/***********************************************************************
#ifndef X264_PPC_PIXEL_H
#define X264_PPC_PIXEL_H
+#define x264_pixel_init_altivec x264_template(pixel_init_altivec)
void x264_pixel_init_altivec( x264_pixel_function_t *pixf );
#endif
*****************************************************************************/
#include "common/common.h"
+#include "ppccommon.h"
#include "predict.h"
#include "pixel.h"
-#include "ppccommon.h"
#if !HIGH_BIT_DEPTH
static void predict_8x8c_p_altivec( uint8_t *src )
#ifndef X264_PPC_PREDICT_H
#define X264_PPC_PREDICT_H
+#define x264_predict_16x16_init_altivec x264_template(predict_16x16_init_altivec)
void x264_predict_16x16_init_altivec( x264_predict_t pf[7] );
+#define x264_predict_8x8c_init_altivec x264_template(predict_8x8c_init_altivec)
void x264_predict_8x8c_init_altivec( x264_predict_t pf[7] );
#endif /* X264_PPC_PREDICT_H */
#ifndef X264_PPC_QUANT_H
#define X264_PPC_QUANT_H
+#define x264_quant_4x4_altivec x264_template(quant_4x4_altivec)
int x264_quant_4x4_altivec( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] );
+#define x264_quant_8x8_altivec x264_template(quant_8x8_altivec)
int x264_quant_8x8_altivec( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] );
+#define x264_quant_4x4_dc_altivec x264_template(quant_4x4_dc_altivec)
int x264_quant_4x4_dc_altivec( int16_t dct[16], int mf, int bias );
+#define x264_quant_2x2_dc_altivec x264_template(quant_2x2_dc_altivec)
int x264_quant_2x2_dc_altivec( int16_t dct[4], int mf, int bias );
+#define x264_dequant_4x4_altivec x264_template(dequant_4x4_altivec)
void x264_dequant_4x4_altivec( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_altivec x264_template(dequant_8x8_altivec)
void x264_dequant_8x8_altivec( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+
#endif
I_PRED_8x8_DC_128 = 11,
};
+#define x264_predict_8x8_dc_c x264_template(predict_8x8_dc_c)
void x264_predict_8x8_dc_c ( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_h_c x264_template(predict_8x8_h_c)
void x264_predict_8x8_h_c ( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_v_c x264_template(predict_8x8_v_c)
void x264_predict_8x8_v_c ( pixel *src, pixel edge[36] );
+#define x264_predict_4x4_dc_c x264_template(predict_4x4_dc_c)
void x264_predict_4x4_dc_c ( pixel *src );
+#define x264_predict_4x4_h_c x264_template(predict_4x4_h_c)
void x264_predict_4x4_h_c ( pixel *src );
+#define x264_predict_4x4_v_c x264_template(predict_4x4_v_c)
void x264_predict_4x4_v_c ( pixel *src );
+#define x264_predict_16x16_dc_c x264_template(predict_16x16_dc_c)
void x264_predict_16x16_dc_c( pixel *src );
+#define x264_predict_16x16_h_c x264_template(predict_16x16_h_c)
void x264_predict_16x16_h_c ( pixel *src );
+#define x264_predict_16x16_v_c x264_template(predict_16x16_v_c)
void x264_predict_16x16_v_c ( pixel *src );
+#define x264_predict_16x16_p_c x264_template(predict_16x16_p_c)
void x264_predict_16x16_p_c ( pixel *src );
+#define x264_predict_8x8c_dc_c x264_template(predict_8x8c_dc_c)
void x264_predict_8x8c_dc_c ( pixel *src );
+#define x264_predict_8x8c_h_c x264_template(predict_8x8c_h_c)
void x264_predict_8x8c_h_c ( pixel *src );
+#define x264_predict_8x8c_v_c x264_template(predict_8x8c_v_c)
void x264_predict_8x8c_v_c ( pixel *src );
+#define x264_predict_8x8c_p_c x264_template(predict_8x8c_p_c)
void x264_predict_8x8c_p_c ( pixel *src );
+#define x264_predict_8x16c_dc_c x264_template(predict_8x16c_dc_c)
void x264_predict_8x16c_dc_c( pixel *src );
+#define x264_predict_8x16c_h_c x264_template(predict_8x16c_h_c)
void x264_predict_8x16c_h_c ( pixel *src );
+#define x264_predict_8x16c_v_c x264_template(predict_8x16c_v_c)
void x264_predict_8x16c_v_c ( pixel *src );
+#define x264_predict_8x16c_p_c x264_template(predict_8x16c_p_c)
void x264_predict_8x16c_p_c ( pixel *src );
+#define x264_predict_16x16_init x264_template(predict_16x16_init)
void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] );
+#define x264_predict_8x8c_init x264_template(predict_8x8c_init)
void x264_predict_8x8c_init ( int cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init x264_template(predict_8x16c_init)
void x264_predict_8x16c_init ( int cpu, x264_predict_t pf[7] );
+#define x264_predict_4x4_init x264_template(predict_4x4_init)
void x264_predict_4x4_init ( int cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init x264_template(predict_8x8_init)
void x264_predict_8x8_init ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
-
#endif
* chroma: for the complete mb: if score < 7 -> null
*/
-const uint8_t x264_decimate_table4[16] =
-{
- 3,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0
-};
-const uint8_t x264_decimate_table8[64] =
-{
- 3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,
- 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-};
-
static int ALWAYS_INLINE decimate_score_internal( dctcoef *dct, int i_max )
{
const uint8_t *ds_table = (i_max == 64) ? x264_decimate_table8 : x264_decimate_table4;
int (*trellis_cabac_chroma_422_dc)( TRELLIS_PARAMS );
} x264_quant_function_t;
+#define x264_quant_init x264_template(quant_init)
void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf );
#endif
assert(0);
}
-extern void (*x264_cache_mv_func_table[10])(void *, uint32_t);\
-extern void (*x264_cache_mvd_func_table[10])(void *, uint32_t);\
-extern void (*x264_cache_ref_func_table[10])(void *, uint32_t);\
+#define x264_cache_mv_func_table x264_template(cache_mv_func_table)
+extern void (*x264_cache_mv_func_table[10])(void *, uint32_t);
+#define x264_cache_mvd_func_table x264_template(cache_mvd_func_table)
+extern void (*x264_cache_mvd_func_table[10])(void *, uint32_t);
+#define x264_cache_ref_func_table x264_template(cache_ref_func_table)
+extern void (*x264_cache_ref_func_table[10])(void *, uint32_t);
#define x264_macroblock_cache_mv_ptr( a, x, y, w, h, l, mv ) x264_macroblock_cache_mv( a, x, y, w, h, l, M32( mv ) )
static ALWAYS_INLINE void x264_macroblock_cache_mv( x264_t *h, int x, int y, int width, int height, int i_list, uint32_t mv )
#ifndef X264_SET_H
#define X264_SET_H
-enum profile_e
-{
- PROFILE_BASELINE = 66,
- PROFILE_MAIN = 77,
- PROFILE_HIGH = 100,
- PROFILE_HIGH10 = 110,
- PROFILE_HIGH422 = 122,
- PROFILE_HIGH444_PREDICTIVE = 244,
-};
-
-enum chroma_format_e
-{
- CHROMA_400 = 0,
- CHROMA_420 = 1,
- CHROMA_422 = 2,
- CHROMA_444 = 3,
-};
-
enum cqm4_e
{
CQM_4IY = 0,
} x264_pps_t;
-/* default quant matrices */
-static const uint8_t x264_cqm_jvt4i[16] =
-{
- 6,13,20,28,
- 13,20,28,32,
- 20,28,32,37,
- 28,32,37,42
-};
-static const uint8_t x264_cqm_jvt4p[16] =
-{
- 10,14,20,24,
- 14,20,24,27,
- 20,24,27,30,
- 24,27,30,34
-};
-static const uint8_t x264_cqm_jvt8i[64] =
-{
- 6,10,13,16,18,23,25,27,
- 10,11,16,18,23,25,27,29,
- 13,16,18,23,25,27,29,31,
- 16,18,23,25,27,29,31,33,
- 18,23,25,27,29,31,33,36,
- 23,25,27,29,31,33,36,38,
- 25,27,29,31,33,36,38,40,
- 27,29,31,33,36,38,40,42
-};
-static const uint8_t x264_cqm_jvt8p[64] =
-{
- 9,13,15,17,19,21,22,24,
- 13,13,17,19,21,22,24,25,
- 15,17,19,21,22,24,25,27,
- 17,19,21,22,24,25,27,28,
- 19,21,22,24,25,27,28,30,
- 21,22,24,25,27,28,30,32,
- 22,24,25,27,28,30,32,33,
- 24,25,27,28,30,32,33,35
-};
-static const uint8_t x264_cqm_flat16[64] =
-{
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16,
- 16,16,16,16,16,16,16,16
-};
-static const uint8_t * const x264_cqm_jvt[8] =
-{
- x264_cqm_jvt4i, x264_cqm_jvt4p,
- x264_cqm_jvt4i, x264_cqm_jvt4p,
- x264_cqm_jvt8i, x264_cqm_jvt8p,
- x264_cqm_jvt8i, x264_cqm_jvt8p
-};
-
-// 1080i25_avci50, 1080p25_avci50
-static const uint8_t x264_cqm_avci50_4ic[16] =
-{
- 16,22,28,40,
- 22,28,40,44,
- 28,40,44,48,
- 40,44,48,60
-};
-
-// 1080i25_avci50,
-static const uint8_t x264_cqm_avci50_1080i_8iy[64] =
-{
- 16,18,19,21,27,33,81,87,
- 18,19,21,24,30,33,81,87,
- 19,21,24,27,30,78,84,90,
- 21,24,27,30,33,78,84,90,
- 24,27,30,33,78,81,84,90,
- 24,27,30,33,78,81,84,93,
- 27,30,33,78,78,81,87,93,
- 30,33,33,78,81,84,87,96
-};
-
-// 1080p25_avci50, 720p25_avci50, 720p50_avci50
-static const uint8_t x264_cqm_avci50_p_8iy[64] =
-{
- 16,18,19,21,24,27,30,33,
- 18,19,21,24,27,30,33,78,
- 19,21,24,27,30,33,78,81,
- 21,24,27,30,33,78,81,84,
- 24,27,30,33,78,81,84,87,
- 27,30,33,78,81,84,87,90,
- 30,33,78,81,84,87,90,93,
- 33,78,81,84,87,90,93,96
-};
-
-// 1080i25_avci100, 1080p25_avci100
-static const uint8_t x264_cqm_avci100_1080_4ic[16] =
-{
- 16,20,26,32,
- 20,26,32,38,
- 26,32,38,44,
- 32,38,44,50
-};
-
-// 720p25_avci100, 720p50_avci100
-static const uint8_t x264_cqm_avci100_720p_4ic[16] =
-{
- 16,21,27,34,
- 21,27,34,41,
- 27,34,41,46,
- 34,41,46,54
-};
-
-// 1080i25_avci100,
-static const uint8_t x264_cqm_avci100_1080i_8iy[64] =
-{
- 16,19,20,23,24,26,32,42,
- 18,19,22,24,26,32,36,42,
- 18,20,23,24,26,32,36,63,
- 19,20,23,26,32,36,42,63,
- 20,22,24,26,32,36,59,63,
- 22,23,24,26,32,36,59,68,
- 22,23,24,26,32,42,59,68,
- 22,23,24,26,36,42,59,72
-};
-
-// 1080p25_avci100,
-static const uint8_t x264_cqm_avci100_1080p_8iy[64] =
-{
- 16,18,19,20,22,23,24,26,
- 18,19,20,22,23,24,26,32,
- 19,20,22,23,24,26,32,36,
- 20,22,23,24,26,32,36,42,
- 22,23,24,26,32,36,42,59,
- 23,24,26,32,36,42,59,63,
- 24,26,32,36,42,59,63,68,
- 26,32,36,42,59,63,68,72
-};
-
-// 720p25_avci100, 720p50_avci100
-static const uint8_t x264_cqm_avci100_720p_8iy[64] =
-{
- 16,18,19,21,22,24,26,32,
- 18,19,19,21,22,24,26,32,
- 19,19,21,22,22,24,26,32,
- 21,21,22,22,23,24,26,34,
- 22,22,22,23,24,25,26,34,
- 24,24,24,24,25,26,34,36,
- 26,26,26,26,26,34,36,38,
- 32,32,32,34,34,36,38,42
-};
-
+#define x264_cqm_init x264_template(cqm_init)
int x264_cqm_init( x264_t *h );
+#define x264_cqm_delete x264_template(cqm_delete)
void x264_cqm_delete( x264_t *h );
+#define x264_cqm_parse_file x264_template(cqm_parse_file)
int x264_cqm_parse_file( x264_t *h, const char *filename );
#endif
--- /dev/null
+/*****************************************************************************
+ * tables.c: const tables
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Laurent Aimar <fenrir@via.ecp.fr>
+ * Loren Merritt <lorenm@u.washington.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#include "base.h"
+
+const x264_level_t x264_levels[] =
+{
+ { 10, 1485, 99, 396, 64, 175, 64, 64, 0, 2, 0, 0, 1 },
+ { 9, 1485, 99, 396, 128, 350, 64, 64, 0, 2, 0, 0, 1 }, /* "1b" */
+ { 11, 3000, 396, 900, 192, 500, 128, 64, 0, 2, 0, 0, 1 },
+ { 12, 6000, 396, 2376, 384, 1000, 128, 64, 0, 2, 0, 0, 1 },
+ { 13, 11880, 396, 2376, 768, 2000, 128, 64, 0, 2, 0, 0, 1 },
+ { 20, 11880, 396, 2376, 2000, 2000, 128, 64, 0, 2, 0, 0, 1 },
+ { 21, 19800, 792, 4752, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 },
+ { 22, 20250, 1620, 8100, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 },
+ { 30, 40500, 1620, 8100, 10000, 10000, 256, 32, 22, 2, 0, 1, 0 },
+ { 31, 108000, 3600, 18000, 14000, 14000, 512, 16, 60, 4, 1, 1, 0 },
+ { 32, 216000, 5120, 20480, 20000, 20000, 512, 16, 60, 4, 1, 1, 0 },
+ { 40, 245760, 8192, 32768, 20000, 25000, 512, 16, 60, 4, 1, 1, 0 },
+ { 41, 245760, 8192, 32768, 50000, 62500, 512, 16, 24, 2, 1, 1, 0 },
+ { 42, 522240, 8704, 34816, 50000, 62500, 512, 16, 24, 2, 1, 1, 1 },
+ { 50, 589824, 22080, 110400, 135000, 135000, 512, 16, 24, 2, 1, 1, 1 },
+ { 51, 983040, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
+ { 52, 2073600, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
+ { 60, 4177920, 139264, 696320, 240000, 240000, 8192, 16, 24, 2, 1, 1, 1 },
+ { 61, 8355840, 139264, 696320, 480000, 480000, 8192, 16, 24, 2, 1, 1, 1 },
+ { 62, 16711680, 139264, 696320, 800000, 800000, 8192, 16, 24, 2, 1, 1, 1 },
+ { 0 }
+};
+
+/*****************************************************************************
+ * MATH
+ *****************************************************************************/
+
+const uint8_t x264_exp2_lut[64] =
+{
+ 0, 3, 6, 8, 11, 14, 17, 20, 23, 26, 29, 32, 36, 39, 42, 45,
+ 48, 52, 55, 58, 62, 65, 69, 72, 76, 80, 83, 87, 91, 94, 98, 102,
+ 106, 110, 114, 118, 122, 126, 130, 135, 139, 143, 147, 152, 156, 161, 165, 170,
+ 175, 179, 184, 189, 194, 198, 203, 208, 214, 219, 224, 229, 234, 240, 245, 250
+};
+
+const float x264_log2_lut[128] =
+{
+ 0.00000, 0.01123, 0.02237, 0.03342, 0.04439, 0.05528, 0.06609, 0.07682,
+ 0.08746, 0.09803, 0.10852, 0.11894, 0.12928, 0.13955, 0.14975, 0.15987,
+ 0.16993, 0.17991, 0.18982, 0.19967, 0.20945, 0.21917, 0.22882, 0.23840,
+ 0.24793, 0.25739, 0.26679, 0.27612, 0.28540, 0.29462, 0.30378, 0.31288,
+ 0.32193, 0.33092, 0.33985, 0.34873, 0.35755, 0.36632, 0.37504, 0.38370,
+ 0.39232, 0.40088, 0.40939, 0.41785, 0.42626, 0.43463, 0.44294, 0.45121,
+ 0.45943, 0.46761, 0.47573, 0.48382, 0.49185, 0.49985, 0.50779, 0.51570,
+ 0.52356, 0.53138, 0.53916, 0.54689, 0.55459, 0.56224, 0.56986, 0.57743,
+ 0.58496, 0.59246, 0.59991, 0.60733, 0.61471, 0.62205, 0.62936, 0.63662,
+ 0.64386, 0.65105, 0.65821, 0.66534, 0.67243, 0.67948, 0.68650, 0.69349,
+ 0.70044, 0.70736, 0.71425, 0.72110, 0.72792, 0.73471, 0.74147, 0.74819,
+ 0.75489, 0.76155, 0.76818, 0.77479, 0.78136, 0.78790, 0.79442, 0.80090,
+ 0.80735, 0.81378, 0.82018, 0.82655, 0.83289, 0.83920, 0.84549, 0.85175,
+ 0.85798, 0.86419, 0.87036, 0.87652, 0.88264, 0.88874, 0.89482, 0.90087,
+ 0.90689, 0.91289, 0.91886, 0.92481, 0.93074, 0.93664, 0.94251, 0.94837,
+ 0.95420, 0.96000, 0.96578, 0.97154, 0.97728, 0.98299, 0.98868, 0.99435,
+};
+
+/* Avoid an int/float conversion. */
+const float x264_log2_lz_lut[32] =
+{
+ 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+};
+
+/*****************************************************************************
+ * ANALYSE
+ *****************************************************************************/
+
+/* lambda = pow(2,qp/6-2) */
+const uint16_t x264_lambda_tab[QP_MAX_MAX+1] =
+{
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 7 */
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 8-15 */
+ 2, 2, 2, 2, 3, 3, 3, 4, /* 16-23 */
+ 4, 4, 5, 6, 6, 7, 8, 9, /* 24-31 */
+ 10, 11, 13, 14, 16, 18, 20, 23, /* 32-39 */
+ 25, 29, 32, 36, 40, 45, 51, 57, /* 40-47 */
+ 64, 72, 81, 91, 102, 114, 128, 144, /* 48-55 */
+ 161, 181, 203, 228, 256, 287, 323, 362, /* 56-63 */
+ 406, 456, 512, 575, 645, 724, 813, 912, /* 64-71 */
+1024,1149,1290,1448,1625,1825,2048,2299, /* 72-79 */
+2580,2896, /* 80-81 */
+};
+
+/* lambda2 = pow(lambda,2) * .9 * 256 */
+/* Capped to avoid overflow */
+const int x264_lambda2_tab[QP_MAX_MAX+1] =
+{
+ 14, 18, 22, 28, 36, 45, 57, 72, /* 0- 7 */
+ 91, 115, 145, 182, 230, 290, 365, 460, /* 8-15 */
+ 580, 731, 921, 1161, 1462, 1843, 2322, 2925, /* 16-23 */
+ 3686, 4644, 5851, 7372, 9289, 11703, 14745, 18578, /* 24-31 */
+ 23407, 29491, 37156, 46814, 58982, 74313, 93628, 117964, /* 32-39 */
+ 148626, 187257, 235929, 297252, 374514, 471859, 594505, 749029, /* 40-47 */
+ 943718, 1189010, 1498059, 1887436, 2378021, 2996119, 3774873, 4756042, /* 48-55 */
+ 5992238, 7549747, 9512085, 11984476, 15099494, 19024170,23968953,30198988, /* 56-63 */
+ 38048341, 47937906, 60397977, 76096683, 95875813,120795955, /* 64-69 */
+134217727,134217727,134217727,134217727,134217727,134217727, /* 70-75 */
+134217727,134217727,134217727,134217727,134217727,134217727, /* 76-81 */
+};
+
+// should the intra and inter lambdas be different?
+// I'm just matching the behaviour of deadzone quant.
+const int x264_trellis_lambda2_tab[2][QP_MAX_MAX+1] =
+{
+ // inter lambda = .85 * .85 * 2**(qp/3. + 10 - LAMBDA_BITS)
+ {
+ 46, 58, 73, 92, 117, 147,
+ 185, 233, 294, 370, 466, 587,
+ 740, 932, 1174, 1480, 1864, 2349,
+ 2959, 3728, 4697, 5918, 7457, 9395,
+ 11837, 14914, 18790, 23674, 29828, 37581,
+ 47349, 59656, 75163, 94699, 119313, 150326,
+ 189399, 238627, 300652, 378798, 477255, 601304,
+ 757596, 954511, 1202608, 1515192, 1909022, 2405217,
+ 3030384, 3818045, 4810435, 6060769, 7636091, 9620872,
+ 12121539, 15272182, 19241743, 24243077, 30544363, 38483486,
+ 48486154, 61088726, 76966972, 96972308,
+ 122177453,134217727,134217727,134217727,134217727,134217727,
+ 134217727,134217727,134217727,134217727,134217727,134217727,
+ },
+ // intra lambda = .65 * .65 * 2**(qp/3. + 10 - LAMBDA_BITS)
+ {
+ 27, 34, 43, 54, 68, 86,
+ 108, 136, 172, 216, 273, 343,
+ 433, 545, 687, 865, 1090, 1374,
+ 1731, 2180, 2747, 3461, 4361, 5494,
+ 6922, 8721, 10988, 13844, 17442, 21976,
+ 27688, 34885, 43953, 55377, 69771, 87906,
+ 110755, 139543, 175813, 221511, 279087, 351627,
+ 443023, 558174, 703255, 886046, 1116348, 1406511,
+ 1772093, 2232697, 2813022, 3544186, 4465396, 5626046,
+ 7088374, 8930791, 11252092, 14176748, 17861583, 22504184,
+ 28353495, 35723165, 45008368, 56706990,
+ 71446330, 90016736,113413980,134217727,134217727,134217727,
+ 134217727,134217727,134217727,134217727,134217727,134217727,
+ 134217727,134217727,134217727,134217727,134217727,134217727,
+ }
+};
+
+const uint16_t x264_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1] =
+{
+ 16, 20, 25, 32, 40, 50,
+ 64, 80, 101, 128, 161, 203,
+ 256, 322, 406, 512, 645, 812,
+ 1024, 1290, 1625, 2048, 2580, 3250,
+ 4096, 5160, 6501, 8192, 10321, 13003,
+ 16384, 20642, 26007, 32768, 41285, 52015,
+ 65535
+};
+
+/*****************************************************************************
+ * MC
+ *****************************************************************************/
+
+const uint8_t x264_hpel_ref0[16] = {0,1,1,1,0,1,1,1,2,3,3,3,0,1,1,1};
+const uint8_t x264_hpel_ref1[16] = {0,0,1,0,2,2,3,2,2,2,3,2,2,2,3,2};
+
+/*****************************************************************************
+ * CQM
+ *****************************************************************************/
+
+/* default quant matrices */
+const uint8_t x264_cqm_jvt4i[16] =
+{
+ 6,13,20,28,
+ 13,20,28,32,
+ 20,28,32,37,
+ 28,32,37,42
+};
+const uint8_t x264_cqm_jvt4p[16] =
+{
+ 10,14,20,24,
+ 14,20,24,27,
+ 20,24,27,30,
+ 24,27,30,34
+};
+const uint8_t x264_cqm_jvt8i[64] =
+{
+ 6,10,13,16,18,23,25,27,
+ 10,11,16,18,23,25,27,29,
+ 13,16,18,23,25,27,29,31,
+ 16,18,23,25,27,29,31,33,
+ 18,23,25,27,29,31,33,36,
+ 23,25,27,29,31,33,36,38,
+ 25,27,29,31,33,36,38,40,
+ 27,29,31,33,36,38,40,42
+};
+const uint8_t x264_cqm_jvt8p[64] =
+{
+ 9,13,15,17,19,21,22,24,
+ 13,13,17,19,21,22,24,25,
+ 15,17,19,21,22,24,25,27,
+ 17,19,21,22,24,25,27,28,
+ 19,21,22,24,25,27,28,30,
+ 21,22,24,25,27,28,30,32,
+ 22,24,25,27,28,30,32,33,
+ 24,25,27,28,30,32,33,35
+};
+const uint8_t x264_cqm_flat16[64] =
+{
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16
+};
+const uint8_t * const x264_cqm_jvt[8] =
+{
+ x264_cqm_jvt4i, x264_cqm_jvt4p,
+ x264_cqm_jvt4i, x264_cqm_jvt4p,
+ x264_cqm_jvt8i, x264_cqm_jvt8p,
+ x264_cqm_jvt8i, x264_cqm_jvt8p
+};
+
+// 1080i25_avci50, 1080p25_avci50
+const uint8_t x264_cqm_avci50_4ic[16] =
+{
+ 16,22,28,40,
+ 22,28,40,44,
+ 28,40,44,48,
+ 40,44,48,60
+};
+
+// 1080p25_avci50, 720p25_avci50, 720p50_avci50
+const uint8_t x264_cqm_avci50_p_8iy[64] =
+{
+ 16,18,19,21,24,27,30,33,
+ 18,19,21,24,27,30,33,78,
+ 19,21,24,27,30,33,78,81,
+ 21,24,27,30,33,78,81,84,
+ 24,27,30,33,78,81,84,87,
+ 27,30,33,78,81,84,87,90,
+ 30,33,78,81,84,87,90,93,
+ 33,78,81,84,87,90,93,96
+};
+
+// 1080i25_avci50,
+const uint8_t x264_cqm_avci50_1080i_8iy[64] =
+{
+ 16,18,19,21,27,33,81,87,
+ 18,19,21,24,30,33,81,87,
+ 19,21,24,27,30,78,84,90,
+ 21,24,27,30,33,78,84,90,
+ 24,27,30,33,78,81,84,90,
+ 24,27,30,33,78,81,84,93,
+ 27,30,33,78,78,81,87,93,
+ 30,33,33,78,81,84,87,96
+};
+
+// 720p25_avci100, 720p50_avci100
+const uint8_t x264_cqm_avci100_720p_4ic[16] =
+{
+ 16,21,27,34,
+ 21,27,34,41,
+ 27,34,41,46,
+ 34,41,46,54
+};
+
+// 720p25_avci100, 720p50_avci100
+const uint8_t x264_cqm_avci100_720p_8iy[64] =
+{
+ 16,18,19,21,22,24,26,32,
+ 18,19,19,21,22,24,26,32,
+ 19,19,21,22,22,24,26,32,
+ 21,21,22,22,23,24,26,34,
+ 22,22,22,23,24,25,26,34,
+ 24,24,24,24,25,26,34,36,
+ 26,26,26,26,26,34,36,38,
+ 32,32,32,34,34,36,38,42
+};
+
+// 1080i25_avci100, 1080p25_avci100
+const uint8_t x264_cqm_avci100_1080_4ic[16] =
+{
+ 16,20,26,32,
+ 20,26,32,38,
+ 26,32,38,44,
+ 32,38,44,50
+};
+
+// 1080i25_avci100,
+const uint8_t x264_cqm_avci100_1080i_8iy[64] =
+{
+ 16,19,20,23,24,26,32,42,
+ 18,19,22,24,26,32,36,42,
+ 18,20,23,24,26,32,36,63,
+ 19,20,23,26,32,36,42,63,
+ 20,22,24,26,32,36,59,63,
+ 22,23,24,26,32,36,59,68,
+ 22,23,24,26,32,42,59,68,
+ 22,23,24,26,36,42,59,72
+};
+
+// 1080p25_avci100,
+const uint8_t x264_cqm_avci100_1080p_8iy[64] =
+{
+ 16,18,19,20,22,23,24,26,
+ 18,19,20,22,23,24,26,32,
+ 19,20,22,23,24,26,32,36,
+ 20,22,23,24,26,32,36,42,
+ 22,23,24,26,32,36,42,59,
+ 23,24,26,32,36,42,59,63,
+ 24,26,32,36,42,59,63,68,
+ 26,32,36,42,59,63,68,72
+};
+
+/*****************************************************************************
+ * QUANT
+ *****************************************************************************/
+
+const uint8_t x264_decimate_table4[16] =
+{
+ 3,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0
+};
+const uint8_t x264_decimate_table8[64] =
+{
+ 3,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,
+ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+/*****************************************************************************
+ * DCT
+ *****************************************************************************/
+
+/* the inverse of the scaling factors introduced by 8x8 fdct */
+/* uint32 is for the asm implementation of trellis. the actual values fit in uint16. */
+#define W(i) (i==0 ? FIX8(1.0000) :\
+ i==1 ? FIX8(0.8859) :\
+ i==2 ? FIX8(1.6000) :\
+ i==3 ? FIX8(0.9415) :\
+ i==4 ? FIX8(1.2651) :\
+ i==5 ? FIX8(1.1910) :0)
+const uint32_t x264_dct8_weight_tab[64] = {
+ W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
+ W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
+
+ W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
+ W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1)
+};
+#undef W
+
+#define W(i) (i==0 ? FIX8(1.76777) :\
+ i==1 ? FIX8(1.11803) :\
+ i==2 ? FIX8(0.70711) :0)
+const uint32_t x264_dct4_weight_tab[16] = {
+ W(0), W(1), W(0), W(1),
+ W(1), W(2), W(1), W(2),
+ W(0), W(1), W(0), W(1),
+ W(1), W(2), W(1), W(2)
+};
+#undef W
+
+/* inverse squared */
+#define W(i) (i==0 ? FIX8(3.125) :\
+ i==1 ? FIX8(1.25) :\
+ i==2 ? FIX8(0.5) :0)
+const uint32_t x264_dct4_weight2_tab[16] = {
+ W(0), W(1), W(0), W(1),
+ W(1), W(2), W(1), W(2),
+ W(0), W(1), W(0), W(1),
+ W(1), W(2), W(1), W(2)
+};
+#undef W
+
+#define W(i) (i==0 ? FIX8(1.00000) :\
+ i==1 ? FIX8(0.78487) :\
+ i==2 ? FIX8(2.56132) :\
+ i==3 ? FIX8(0.88637) :\
+ i==4 ? FIX8(1.60040) :\
+ i==5 ? FIX8(1.41850) :0)
+const uint32_t x264_dct8_weight2_tab[64] = {
+ W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
+ W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
+
+ W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
+ W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
+ W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1)
+};
+#undef W
+
+/*****************************************************************************
+ * CABAC
+ *****************************************************************************/
+
+const int8_t x264_cabac_context_init_I[1024][2] =
+{
+ /* 0 - 10 */
+ { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
+ { 2, 54 }, { 3, 74 }, { -28,127 }, { -23, 104 },
+ { -6, 53 }, { -1, 54 }, { 7, 51 },
+
+ /* 11 - 23 unused for I */
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 },
+
+ /* 24- 39 */
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+
+ /* 40 - 53 */
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 },
+
+ /* 54 - 59 */
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, 0 }, { 0, 0 },
+
+ /* 60 - 69 */
+ { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
+ { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
+ { 13, 41 }, { 3, 62 },
+
+ /* 70 -> 87 */
+ { 0, 11 }, { 1, 55 }, { 0, 69 }, { -17, 127 },
+ { -13, 102 },{ 0, 82 }, { -7, 74 }, { -21, 107 },
+ { -27, 127 },{ -31, 127 },{ -24, 127 }, { -18, 95 },
+ { -27, 127 },{ -21, 114 },{ -30, 127 }, { -17, 123 },
+ { -12, 115 },{ -16, 122 },
+
+ /* 88 -> 104 */
+ { -11, 115 },{ -12, 63 }, { -2, 68 }, { -15, 84 },
+ { -13, 104 },{ -3, 70 }, { -8, 93 }, { -10, 90 },
+ { -30, 127 },{ -1, 74 }, { -6, 97 }, { -7, 91 },
+ { -20, 127 },{ -4, 56 }, { -5, 82 }, { -7, 76 },
+ { -22, 125 },
+
+ /* 105 -> 135 */
+ { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
+ { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
+ { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
+ { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
+ { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
+ { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
+ { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
+ { 14, 62 }, { -13, 108 },{ -15, 100 },
+
+ /* 136 -> 165 */
+ { -13, 101 },{ -13, 91 }, { -12, 94 }, { -10, 88 },
+ { -16, 84 }, { -10, 86 }, { -7, 83 }, { -13, 87 },
+ { -19, 94 }, { 1, 70 }, { 0, 72 }, { -5, 74 },
+ { 18, 59 }, { -8, 102 }, { -15, 100 }, { 0, 95 },
+ { -4, 75 }, { 2, 72 }, { -11, 75 }, { -3, 71 },
+ { 15, 46 }, { -13, 69 }, { 0, 62 }, { 0, 65 },
+ { 21, 37 }, { -15, 72 }, { 9, 57 }, { 16, 54 },
+ { 0, 62 }, { 12, 72 },
+
+ /* 166 -> 196 */
+ { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
+ { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
+ { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
+ { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
+ { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
+ { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
+ { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
+ { 0, 89 }, { 26, -19 }, { 22, -17 },
+
+ /* 197 -> 226 */
+ { 26, -17 }, { 30, -25 }, { 28, -20 }, { 33, -23 },
+ { 37, -27 }, { 33, -23 }, { 40, -28 }, { 38, -17 },
+ { 33, -11 }, { 40, -15 }, { 41, -6 }, { 38, 1 },
+ { 41, 17 }, { 30, -6 }, { 27, 3 }, { 26, 22 },
+ { 37, -16 }, { 35, -4 }, { 38, -8 }, { 38, -3 },
+ { 37, 3 }, { 38, 5 }, { 42, 0 }, { 35, 16 },
+ { 39, 22 }, { 14, 48 }, { 27, 37 }, { 21, 60 },
+ { 12, 68 }, { 2, 97 },
+
+ /* 227 -> 251 */
+ { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
+ { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
+ { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
+ { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
+ { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
+ { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
+ { -4, 65 },
+
+ /* 252 -> 275 */
+ { -12, 73 }, { -8, 76 }, { -7, 80 }, { -9, 88 },
+ { -17, 110 },{ -11, 97 }, { -20, 84 }, { -11, 79 },
+ { -6, 73 }, { -4, 74 }, { -13, 86 }, { -13, 96 },
+ { -11, 97 }, { -19, 117 },{ -8, 78 }, { -5, 33 },
+ { -4, 48 }, { -2, 53 }, { -3, 62 }, { -13, 71 },
+ { -10, 79 }, { -12, 86 }, { -13, 90 }, { -14, 97 },
+
+ /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
+ { 0, 0 },
+
+ /* 277 -> 307 */
+ { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
+ { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
+ { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
+ { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
+ { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
+ { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
+ { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
+ { 9, 64 }, { -12, 104 },{ -11, 97 },
+
+ /* 308 -> 337 */
+ { -16, 96 }, { -7, 88 }, { -8, 85 }, { -7, 85 },
+ { -9, 85 }, { -13, 88 }, { 4, 66 }, { -3, 77 },
+ { -3, 76 }, { -6, 76 }, { 10, 58 }, { -1, 76 },
+ { -1, 83 }, { -7, 99 }, { -14, 95 }, { 2, 95 },
+ { 0, 76 }, { -5, 74 }, { 0, 70 }, { -11, 75 },
+ { 1, 68 }, { 0, 65 }, { -14, 73 }, { 3, 62 },
+ { 4, 62 }, { -1, 68 }, { -13, 75 }, { 11, 55 },
+ { 5, 64 }, { 12, 70 },
+
+ /* 338 -> 368 */
+ { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
+ { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
+ { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
+ { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
+ { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
+ { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
+ { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
+ { -12, 109 },{ 36, -35 }, { 36, -34 },
+
+ /* 369 -> 398 */
+ { 32, -26 }, { 37, -30 }, { 44, -32 }, { 34, -18 },
+ { 34, -15 }, { 40, -15 }, { 33, -7 }, { 35, -5 },
+ { 33, 0 }, { 38, 2 }, { 33, 13 }, { 23, 35 },
+ { 13, 58 }, { 29, -3 }, { 26, 0 }, { 22, 30 },
+ { 31, -7 }, { 35, -15 }, { 34, -3 }, { 34, 3 },
+ { 36, -1 }, { 34, 5 }, { 32, 11 }, { 35, 5 },
+ { 34, 12 }, { 39, 11 }, { 30, 29 }, { 34, 26 },
+ { 29, 39 }, { 19, 66 },
+
+ /* 399 -> 435 */
+ { 31, 21 }, { 31, 31 }, { 25, 50 },
+ { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
+ { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
+ { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
+ { -23, 68 }, { -24, 50 }, { -11, 74 }, { 23, -13 },
+ { 26, -13 }, { 40, -15 }, { 49, -14 }, { 44, 3 },
+ { 45, 6 }, { 44, 34 }, { 33, 54 }, { 19, 82 },
+ { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
+ { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
+ { 0, 68 }, { -9, 92 },
+
+ /* 436 -> 459 */
+ { -14, 106 }, { -13, 97 }, { -15, 90 }, { -12, 90 },
+ { -18, 88 }, { -10, 73 }, { -9, 79 }, { -14, 86 },
+ { -10, 73 }, { -10, 70 }, { -10, 69 }, { -5, 66 },
+ { -9, 64 }, { -5, 58 }, { 2, 59 }, { 21, -10 },
+ { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
+ { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
+
+ /* 460 -> 1024 */
+ { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
+ { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
+ { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
+ { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 },
+ { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 },
+ { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
+ { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
+ { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
+ { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
+ { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
+ { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
+ { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
+ { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
+ { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
+ { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
+ { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
+ { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
+ { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 },
+ { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 },
+ { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 },
+ { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 },
+ { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 },
+ { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 },
+ { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 },
+ { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 },
+ { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 },
+ { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 },
+ { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 },
+ { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
+ { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
+ { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
+ { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
+ { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
+ { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
+ { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
+ { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
+ { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
+ { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
+ { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
+ { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 },
+ { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 },
+ { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 },
+ { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 },
+ { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 },
+ { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 },
+ { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 },
+ { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 },
+ { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 },
+ { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 },
+ { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 },
+ { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 },
+ { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 },
+ { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 },
+ { -23, 68 }, { -24, 50 }, { -11, 74 }, { -14, 106 },
+ { -13, 97 }, { -15, 90 }, { -12, 90 }, { -18, 88 },
+ { -10, 73 }, { -9, 79 }, { -14, 86 }, { -10, 73 },
+ { -10, 70 }, { -10, 69 }, { -5, 66 }, { -9, 64 },
+ { -5, 58 }, { 2, 59 }, { 23, -13 }, { 26, -13 },
+ { 40, -15 }, { 49, -14 }, { 44, 3 }, { 45, 6 },
+ { 44, 34 }, { 33, 54 }, { 19, 82 }, { 21, -10 },
+ { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 },
+ { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 },
+ { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 },
+ { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 },
+ { 0, 68 }, { -9, 92 }, { -17, 120 }, { -20, 112 },
+ { -18, 114 }, { -11, 85 }, { -15, 92 }, { -14, 89 },
+ { -26, 71 }, { -15, 81 }, { -14, 80 }, { 0, 68 },
+ { -14, 70 }, { -24, 56 }, { -23, 68 }, { -24, 50 },
+ { -11, 74 }, { -14, 106 }, { -13, 97 }, { -15, 90 },
+ { -12, 90 }, { -18, 88 }, { -10, 73 }, { -9, 79 },
+ { -14, 86 }, { -10, 73 }, { -10, 70 }, { -10, 69 },
+ { -5, 66 }, { -9, 64 }, { -5, 58 }, { 2, 59 },
+ { 23, -13 }, { 26, -13 }, { 40, -15 }, { 49, -14 },
+ { 44, 3 }, { 45, 6 }, { 44, 34 }, { 33, 54 },
+ { 19, 82 }, { 21, -10 }, { 24, -11 }, { 28, -8 },
+ { 28, -1 }, { 29, 3 }, { 29, 9 }, { 35, 20 },
+ { 29, 36 }, { 14, 67 }, { -3, 75 }, { -1, 23 },
+ { 1, 34 }, { 1, 43 }, { 0, 54 }, { -2, 55 },
+ { 0, 61 }, { 1, 64 }, { 0, 68 }, { -9, 92 },
+ { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
+ { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
+ { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
+ { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
+ { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
+ { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
+ { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
+ { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
+ { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
+ { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
+ { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
+ { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 },
+ { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 },
+ { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 },
+ { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 },
+ { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 },
+ { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 },
+ { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 },
+ { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 },
+ { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 },
+ { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 },
+ { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 },
+ { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
+ { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
+ { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
+ { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
+ { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
+ { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
+ { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
+ { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
+ { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
+ { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
+ { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
+ { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 },
+ { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 },
+ { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 },
+ { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 },
+ { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 },
+ { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 },
+ { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 },
+ { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 },
+ { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 },
+ { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 },
+ { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 },
+ { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 },
+ { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 },
+ { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 },
+ { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 },
+ { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 },
+ { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 },
+ { -4, 65 }, { -12, 73 }, { -8, 76 }, { -7, 80 },
+ { -9, 88 }, { -17, 110 }, { -3, 71 }, { -6, 42 },
+ { -5, 50 }, { -3, 54 }, { -2, 62 }, { 0, 58 },
+ { 1, 63 }, { -2, 72 }, { -1, 74 }, { -9, 91 },
+ { -5, 67 }, { -5, 27 }, { -3, 39 }, { -2, 44 },
+ { 0, 46 }, { -16, 64 }, { -8, 68 }, { -10, 78 },
+ { -6, 77 }, { -10, 86 }, { -12, 92 }, { -15, 55 },
+ { -10, 60 }, { -6, 62 }, { -4, 65 }, { -12, 73 },
+ { -8, 76 }, { -7, 80 }, { -9, 88 }, { -17, 110 },
+ { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
+ { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 },
+ { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }
+};
+
+const int8_t x264_cabac_context_init_PB[3][1024][2] =
+{
+ /* i_cabac_init_idc == 0 */
+ {
+ /* 0 - 10 */
+ { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
+ { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
+ { -6, 53 }, { -1, 54 }, { 7, 51 },
+
+ /* 11 - 23 */
+ { 23, 33 }, { 23, 2 }, { 21, 0 }, { 1, 9 },
+ { 0, 49 }, { -37, 118 }, { 5, 57 }, { -13, 78 },
+ { -11, 65 }, { 1, 62 }, { 12, 49 }, { -4, 73 },
+ { 17, 50 },
+
+ /* 24 - 39 */
+ { 18, 64 }, { 9, 43 }, { 29, 0 }, { 26, 67 },
+ { 16, 90 }, { 9, 104 }, { -46, 127 }, { -20, 104 },
+ { 1, 67 }, { -13, 78 }, { -11, 65 }, { 1, 62 },
+ { -6, 86 }, { -17, 95 }, { -6, 61 }, { 9, 45 },
+
+ /* 40 - 53 */
+ { -3, 69 }, { -6, 81 }, { -11, 96 }, { 6, 55 },
+ { 7, 67 }, { -5, 86 }, { 2, 88 }, { 0, 58 },
+ { -3, 76 }, { -10, 94 }, { 5, 54 }, { 4, 69 },
+ { -3, 81 }, { 0, 88 },
+
+ /* 54 - 59 */
+ { -7, 67 }, { -5, 74 }, { -4, 74 }, { -5, 80 },
+ { -7, 72 }, { 1, 58 },
+
+ /* 60 - 69 */
+ { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
+ { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
+ { 13, 41 }, { 3, 62 },
+
+ /* 70 - 87 */
+ { 0, 45 }, { -4, 78 }, { -3, 96 }, { -27, 126 },
+ { -28, 98 }, { -25, 101 }, { -23, 67 }, { -28, 82 },
+ { -20, 94 }, { -16, 83 }, { -22, 110 }, { -21, 91 },
+ { -18, 102 }, { -13, 93 }, { -29, 127 }, { -7, 92 },
+ { -5, 89 }, { -7, 96 }, { -13, 108 }, { -3, 46 },
+ { -1, 65 }, { -1, 57 }, { -9, 93 }, { -3, 74 },
+ { -9, 92 }, { -8, 87 }, { -23, 126 }, { 5, 54 },
+ { 6, 60 }, { 6, 59 }, { 6, 69 }, { -1, 48 },
+ { 0, 68 }, { -4, 69 }, { -8, 88 },
+
+ /* 105 -> 165 */
+ { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
+ { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
+ { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
+ { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
+ { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
+ { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
+ { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
+ { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
+ { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
+ { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
+ { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
+ { 3, 64 }, { 1, 61 }, { 9, 63 }, { 7, 50 },
+ { 16, 39 }, { 5, 44 }, { 4, 52 }, { 11, 48 },
+ { -5, 60 }, { -1, 59 }, { 0, 59 }, { 22, 33 },
+ { 5, 44 }, { 14, 43 }, { -1, 78 }, { 0, 60 },
+ { 9, 69 },
+
+ /* 166 - 226 */
+ { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
+ { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
+ { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
+ { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
+ { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
+ { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
+ { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
+ { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
+ { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
+ { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
+ { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
+ { 1, 67 }, { 5, 59 }, { 9, 67 }, { 16, 30 },
+ { 18, 32 }, { 18, 35 }, { 22, 29 }, { 24, 31 },
+ { 23, 38 }, { 18, 43 }, { 20, 41 }, { 11, 63 },
+ { 9, 59 }, { 9, 64 }, { -1, 94 }, { -2, 89 },
+ { -9, 108 },
+
+ /* 227 - 275 */
+ { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
+ { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
+ { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
+ { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
+ { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
+ { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
+ { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
+ { -3, 74 }, { -10, 90 }, { 0, 70 }, { -4, 29 },
+ { 5, 31 }, { 7, 42 }, { 1, 59 }, { -2, 58 },
+ { -3, 72 }, { -3, 81 }, { -11, 97 }, { 0, 58 },
+ { 8, 5 }, { 10, 14 }, { 14, 18 }, { 13, 27 },
+ { 2, 40 }, { 0, 58 }, { -3, 70 }, { -6, 79 },
+ { -8, 85 },
+
+ /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
+ { 0, 0 },
+
+ /* 277 - 337 */
+ { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
+ { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
+ { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
+ { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
+ { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
+ { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
+ { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
+ { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
+ { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
+ { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
+ { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
+ { -2, 69 }, { -2, 59 }, { 6, 70 }, { 10, 44 },
+ { 9, 31 }, { 12, 43 }, { 3, 53 }, { 14, 34 },
+ { 10, 38 }, { -3, 52 }, { 13, 40 }, { 17, 32 },
+ { 7, 44 }, { 7, 38 }, { 13, 50 }, { 10, 57 },
+ { 26, 43 },
+
+ /* 338 - 398 */
+ { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
+ { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
+ { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
+ { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
+ { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
+ { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
+ { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
+ { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
+ { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
+ { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
+ { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
+ { 8, 60 }, { 6, 63 }, { 17, 65 }, { 21, 24 },
+ { 23, 20 }, { 26, 23 }, { 27, 32 }, { 28, 23 },
+ { 28, 24 }, { 23, 40 }, { 24, 32 }, { 28, 29 },
+ { 23, 42 }, { 19, 57 }, { 22, 53 }, { 22, 61 },
+ { 11, 86 },
+
+ /* 399 -> 435 */
+ { 12, 40 }, { 11, 51 }, { 14, 59 },
+ { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
+ { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
+ { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
+ { -16, 66 }, { -22, 65 }, { -20, 63 }, { 9, -2 },
+ { 26, -9 }, { 33, -9 }, { 39, -7 }, { 41, -2 },
+ { 45, 3 }, { 49, 9 }, { 45, 27 }, { 36, 59 },
+ { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
+ { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
+ { -8, 66 }, { -8, 76 },
+
+ /* 436 -> 459 */
+ { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
+ { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
+ { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
+ { -14, 66 }, { 0, 59 }, { 2, 59 }, { 21, -13 },
+ { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
+ { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
+
+ /* 460 - 1024 */
+ { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
+ { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
+ { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
+ { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 },
+ { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 },
+ { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
+ { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
+ { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
+ { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
+ { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
+ { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
+ { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
+ { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
+ { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
+ { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
+ { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
+ { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
+ { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 },
+ { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 },
+ { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 },
+ { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 },
+ { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 },
+ { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 },
+ { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 },
+ { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 },
+ { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 },
+ { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 },
+ { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 },
+ { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
+ { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
+ { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
+ { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
+ { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
+ { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
+ { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
+ { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
+ { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
+ { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
+ { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
+ { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 },
+ { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 },
+ { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 },
+ { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 },
+ { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 },
+ { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 },
+ { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 },
+ { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 },
+ { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 },
+ { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 },
+ { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 },
+ { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 },
+ { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 },
+ { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 },
+ { -16, 66 }, { -22, 65 }, { -20, 63 }, { -5, 85 },
+ { -6, 81 }, { -10, 77 }, { -7, 81 }, { -17, 80 },
+ { -18, 73 }, { -4, 74 }, { -10, 83 }, { -9, 71 },
+ { -9, 67 }, { -1, 61 }, { -8, 66 }, { -14, 66 },
+ { 0, 59 }, { 2, 59 }, { 9, -2 }, { 26, -9 },
+ { 33, -9 }, { 39, -7 }, { 41, -2 }, { 45, 3 },
+ { 49, 9 }, { 45, 27 }, { 36, 59 }, { 21, -13 },
+ { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 },
+ { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 },
+ { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 },
+ { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 },
+ { -8, 66 }, { -8, 76 }, { -4, 79 }, { -7, 71 },
+ { -5, 69 }, { -9, 70 }, { -8, 66 }, { -10, 68 },
+ { -19, 73 }, { -12, 69 }, { -16, 70 }, { -15, 67 },
+ { -20, 62 }, { -19, 70 }, { -16, 66 }, { -22, 65 },
+ { -20, 63 }, { -5, 85 }, { -6, 81 }, { -10, 77 },
+ { -7, 81 }, { -17, 80 }, { -18, 73 }, { -4, 74 },
+ { -10, 83 }, { -9, 71 }, { -9, 67 }, { -1, 61 },
+ { -8, 66 }, { -14, 66 }, { 0, 59 }, { 2, 59 },
+ { 9, -2 }, { 26, -9 }, { 33, -9 }, { 39, -7 },
+ { 41, -2 }, { 45, 3 }, { 49, 9 }, { 45, 27 },
+ { 36, 59 }, { 21, -13 }, { 33, -14 }, { 39, -7 },
+ { 46, -2 }, { 51, 2 }, { 60, 6 }, { 61, 17 },
+ { 55, 34 }, { 42, 62 }, { -6, 66 }, { -7, 35 },
+ { -7, 42 }, { -8, 45 }, { -5, 48 }, { -12, 56 },
+ { -6, 60 }, { -5, 62 }, { -8, 66 }, { -8, 76 },
+ { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
+ { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
+ { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
+ { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
+ { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
+ { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
+ { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
+ { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
+ { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
+ { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
+ { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
+ { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 },
+ { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 },
+ { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
+ { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 },
+ { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 },
+ { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 },
+ { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 },
+ { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 },
+ { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 },
+ { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 },
+ { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 },
+ { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
+ { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
+ { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
+ { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
+ { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
+ { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
+ { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
+ { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
+ { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
+ { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
+ { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
+ { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 },
+ { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 },
+ { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 },
+ { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 },
+ { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 },
+ { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 },
+ { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 },
+ { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 },
+ { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 },
+ { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 },
+ { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 },
+ { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 },
+ { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 },
+ { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 },
+ { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 },
+ { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 },
+ { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 },
+ { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 },
+ { -3, 74 }, { -10, 90 }, { -6, 76 }, { -2, 44 },
+ { 0, 45 }, { 0, 52 }, { -3, 64 }, { -2, 59 },
+ { -4, 70 }, { -4, 75 }, { -8, 82 }, { -17, 102 },
+ { -9, 77 }, { 3, 24 }, { 0, 42 }, { 0, 48 },
+ { 0, 55 }, { -6, 59 }, { -7, 71 }, { -12, 83 },
+ { -11, 87 }, { -30, 119 }, { 1, 58 }, { -3, 29 },
+ { -1, 36 }, { 1, 38 }, { 2, 43 }, { -6, 55 },
+ { 0, 58 }, { 0, 64 }, { -3, 74 }, { -10, 90 },
+ { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
+ { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 },
+ { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }
+ },
+
+ /* i_cabac_init_idc == 1 */
+ {
+ /* 0 - 10 */
+ { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
+ { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
+ { -6, 53 }, { -1, 54 }, { 7, 51 },
+
+ /* 11 - 23 */
+ { 22, 25 }, { 34, 0 }, { 16, 0 }, { -2, 9 },
+ { 4, 41 }, { -29, 118 }, { 2, 65 }, { -6, 71 },
+ { -13, 79 }, { 5, 52 }, { 9, 50 }, { -3, 70 },
+ { 10, 54 },
+
+ /* 24 - 39 */
+ { 26, 34 }, { 19, 22 }, { 40, 0 }, { 57, 2 },
+ { 41, 36 }, { 26, 69 }, { -45, 127 }, { -15, 101 },
+ { -4, 76 }, { -6, 71 }, { -13, 79 }, { 5, 52 },
+ { 6, 69 }, { -13, 90 }, { 0, 52 }, { 8, 43 },
+
+ /* 40 - 53 */
+ { -2, 69 },{ -5, 82 },{ -10, 96 },{ 2, 59 },
+ { 2, 75 },{ -3, 87 },{ -3, 100 },{ 1, 56 },
+ { -3, 74 },{ -6, 85 },{ 0, 59 },{ -3, 81 },
+ { -7, 86 },{ -5, 95 },
+
+ /* 54 - 59 */
+ { -1, 66 },{ -1, 77 },{ 1, 70 },{ -2, 86 },
+ { -5, 72 },{ 0, 61 },
+
+ /* 60 - 69 */
+ { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
+ { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
+ { 13, 41 }, { 3, 62 },
+
+ /* 70 - 104 */
+ { 13, 15 }, { 7, 51 }, { 2, 80 }, { -39, 127 },
+ { -18, 91 }, { -17, 96 }, { -26, 81 }, { -35, 98 },
+ { -24, 102 }, { -23, 97 }, { -27, 119 }, { -24, 99 },
+ { -21, 110 }, { -18, 102 }, { -36, 127 }, { 0, 80 },
+ { -5, 89 }, { -7, 94 }, { -4, 92 }, { 0, 39 },
+ { 0, 65 }, { -15, 84 }, { -35, 127 }, { -2, 73 },
+ { -12, 104 }, { -9, 91 }, { -31, 127 }, { 3, 55 },
+ { 7, 56 }, { 7, 55 }, { 8, 61 }, { -3, 53 },
+ { 0, 68 }, { -7, 74 }, { -9, 88 },
+
+ /* 105 -> 165 */
+ { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
+ { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
+ { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
+ { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
+ { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
+ { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
+ { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
+ { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
+ { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
+ { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
+ { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
+ { -4, 71 }, { 0, 58 }, { 7, 61 }, { 9, 41 },
+ { 18, 25 }, { 9, 32 }, { 5, 43 }, { 9, 47 },
+ { 0, 44 }, { 0, 51 }, { 2, 46 }, { 19, 38 },
+ { -4, 66 }, { 15, 38 }, { 12, 42 }, { 9, 34 },
+ { 0, 89 },
+
+ /* 166 - 226 */
+ { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
+ { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
+ { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
+ { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
+ { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
+ { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
+ { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
+ { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
+ { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
+ { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
+ { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
+ { 0, 75 }, { 2, 72 }, { 8, 77 }, { 14, 35 },
+ { 18, 31 }, { 17, 35 }, { 21, 30 }, { 17, 45 },
+ { 20, 42 }, { 18, 45 }, { 27, 26 }, { 16, 54 },
+ { 7, 66 }, { 16, 56 }, { 11, 73 }, { 10, 67 },
+ { -10, 116 },
+
+ /* 227 - 275 */
+ { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
+ { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
+ { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
+ { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
+ { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
+ { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
+ { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
+ { -5, 74 }, { -9, 86 }, { 2, 66 }, { -9, 34 },
+ { 1, 32 }, { 11, 31 }, { 5, 52 }, { -2, 55 },
+ { -2, 67 }, { 0, 73 }, { -8, 89 }, { 3, 52 },
+ { 7, 4 }, { 10, 8 }, { 17, 8 }, { 16, 19 },
+ { 3, 37 }, { -1, 61 }, { -5, 73 }, { -1, 70 },
+ { -4, 78 },
+
+ /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
+ { 0, 0 },
+
+ /* 277 - 337 */
+ { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
+ { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
+ { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
+ { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
+ { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
+ { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
+ { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
+ { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
+ { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
+ { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
+ { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
+ { -1, 70 }, { -9, 72 }, { 14, 60 }, { 16, 37 },
+ { 0, 47 }, { 18, 35 }, { 11, 37 }, { 12, 41 },
+ { 10, 41 }, { 2, 48 }, { 12, 41 }, { 13, 41 },
+ { 0, 59 }, { 3, 50 }, { 19, 40 }, { 3, 66 },
+ { 18, 50 },
+
+ /* 338 - 398 */
+ { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
+ { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
+ { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
+ { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
+ { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
+ { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
+ { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
+ { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
+ { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
+ { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
+ { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
+ { 12, 48 }, { 11, 49 }, { 26, 45 }, { 22, 22 },
+ { 23, 22 }, { 27, 21 }, { 33, 20 }, { 26, 28 },
+ { 30, 24 }, { 27, 34 }, { 18, 42 }, { 25, 39 },
+ { 18, 50 }, { 12, 70 }, { 21, 54 }, { 14, 71 },
+ { 11, 83 },
+
+ /* 399 -> 435 */
+ { 25, 32 }, { 21, 49 }, { 21, 54 },
+ { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
+ { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
+ { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
+ { -14, 66 }, { 0, 59 }, { 2, 59 }, { 17, -10 },
+ { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
+ { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
+ { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
+ { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
+ { -4, 67 }, { -7, 82 },
+
+ /* 436 -> 459 */
+ { -3, 81 }, { -3, 76 }, { -7, 72 }, { -6, 78 },
+ { -12, 72 }, { -14, 68 }, { -3, 70 }, { -6, 76 },
+ { -5, 66 }, { -5, 62 }, { 0, 57 }, { -4, 61 },
+ { -9, 60 }, { 1, 54 }, { 2, 58 }, { 17, -10 },
+ { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
+ { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
+
+ /* 460 - 1024 */
+ { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
+ { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
+ { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
+ { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 },
+ { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 },
+ { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
+ { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
+ { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
+ { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
+ { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
+ { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
+ { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
+ { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
+ { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
+ { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
+ { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
+ { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
+ { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 },
+ { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 },
+ { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 },
+ { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 },
+ { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 },
+ { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 },
+ { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 },
+ { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 },
+ { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 },
+ { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 },
+ { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 },
+ { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
+ { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
+ { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
+ { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
+ { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
+ { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
+ { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
+ { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
+ { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
+ { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
+ { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
+ { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 },
+ { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 },
+ { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 },
+ { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 },
+ { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 },
+ { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 },
+ { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 },
+ { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 },
+ { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 },
+ { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 },
+ { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 },
+ { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 },
+ { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 },
+ { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 },
+ { -14, 66 }, { 0, 59 }, { 2, 59 }, { -3, 81 },
+ { -3, 76 }, { -7, 72 }, { -6, 78 }, { -12, 72 },
+ { -14, 68 }, { -3, 70 }, { -6, 76 }, { -5, 66 },
+ { -5, 62 }, { 0, 57 }, { -4, 61 }, { -9, 60 },
+ { 1, 54 }, { 2, 58 }, { 17, -10 }, { 32, -13 },
+ { 42, -9 }, { 49, -5 }, { 53, 0 }, { 64, 3 },
+ { 68, 10 }, { 66, 27 }, { 47, 57 }, { 17, -10 },
+ { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 },
+ { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 },
+ { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 },
+ { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 },
+ { -4, 67 }, { -7, 82 }, { -5, 85 }, { -6, 81 },
+ { -10, 77 }, { -7, 81 }, { -17, 80 }, { -18, 73 },
+ { -4, 74 }, { -10, 83 }, { -9, 71 }, { -9, 67 },
+ { -1, 61 }, { -8, 66 }, { -14, 66 }, { 0, 59 },
+ { 2, 59 }, { -3, 81 }, { -3, 76 }, { -7, 72 },
+ { -6, 78 }, { -12, 72 }, { -14, 68 }, { -3, 70 },
+ { -6, 76 }, { -5, 66 }, { -5, 62 }, { 0, 57 },
+ { -4, 61 }, { -9, 60 }, { 1, 54 }, { 2, 58 },
+ { 17, -10 }, { 32, -13 }, { 42, -9 }, { 49, -5 },
+ { 53, 0 }, { 64, 3 }, { 68, 10 }, { 66, 27 },
+ { 47, 57 }, { 17, -10 }, { 32, -13 }, { 42, -9 },
+ { 49, -5 }, { 53, 0 }, { 64, 3 }, { 68, 10 },
+ { 66, 27 }, { 47, 57 }, { -5, 71 }, { 0, 24 },
+ { -1, 36 }, { -2, 42 }, { -2, 52 }, { -9, 57 },
+ { -6, 63 }, { -4, 65 }, { -4, 67 }, { -7, 82 },
+ { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
+ { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
+ { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
+ { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
+ { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
+ { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
+ { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
+ { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
+ { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
+ { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
+ { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
+ { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
+ { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
+ { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
+ { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 },
+ { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 },
+ { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 },
+ { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 },
+ { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 },
+ { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 },
+ { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 },
+ { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 },
+ { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
+ { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
+ { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
+ { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
+ { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
+ { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
+ { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
+ { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
+ { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
+ { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
+ { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
+ { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 },
+ { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 },
+ { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 },
+ { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 },
+ { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 },
+ { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 },
+ { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 },
+ { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 },
+ { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 },
+ { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 },
+ { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 },
+ { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 },
+ { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 },
+ { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 },
+ { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 },
+ { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
+ { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 },
+ { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 },
+ { -5, 74 }, { -9, 86 }, { -23, 112 }, { -15, 71 },
+ { -7, 61 }, { 0, 53 }, { -5, 66 }, { -11, 77 },
+ { -9, 80 }, { -9, 84 }, { -10, 87 }, { -34, 127 },
+ { -21, 101 }, { -3, 39 }, { -5, 53 }, { -7, 61 },
+ { -11, 75 }, { -15, 77 }, { -17, 91 }, { -25, 107 },
+ { -25, 111 }, { -28, 122 }, { -11, 76 }, { -10, 44 },
+ { -10, 52 }, { -10, 57 }, { -9, 58 }, { -16, 72 },
+ { -7, 69 }, { -4, 69 }, { -5, 74 }, { -9, 86 },
+ { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
+ { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 },
+ { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }
+ },
+
+ /* i_cabac_init_idc == 2 */
+ {
+ /* 0 - 10 */
+ { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 },
+ { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 },
+ { -6, 53 }, { -1, 54 }, { 7, 51 },
+
+ /* 11 - 23 */
+ { 29, 16 }, { 25, 0 }, { 14, 0 }, { -10, 51 },
+ { -3, 62 }, { -27, 99 }, { 26, 16 }, { -4, 85 },
+ { -24, 102 }, { 5, 57 }, { 6, 57 }, { -17, 73 },
+ { 14, 57 },
+
+ /* 24 - 39 */
+ { 20, 40 }, { 20, 10 }, { 29, 0 }, { 54, 0 },
+ { 37, 42 }, { 12, 97 }, { -32, 127 }, { -22, 117 },
+ { -2, 74 }, { -4, 85 }, { -24, 102 }, { 5, 57 },
+ { -6, 93 }, { -14, 88 }, { -6, 44 }, { 4, 55 },
+
+ /* 40 - 53 */
+ { -11, 89 },{ -15, 103 },{ -21, 116 },{ 19, 57 },
+ { 20, 58 },{ 4, 84 },{ 6, 96 },{ 1, 63 },
+ { -5, 85 },{ -13, 106 },{ 5, 63 },{ 6, 75 },
+ { -3, 90 },{ -1, 101 },
+
+ /* 54 - 59 */
+ { 3, 55 },{ -4, 79 },{ -2, 75 },{ -12, 97 },
+ { -7, 50 },{ 1, 60 },
+
+ /* 60 - 69 */
+ { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 },
+ { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 },
+ { 13, 41 }, { 3, 62 },
+
+ /* 70 - 104 */
+ { 7, 34 }, { -9, 88 }, { -20, 127 }, { -36, 127 },
+ { -17, 91 }, { -14, 95 }, { -25, 84 }, { -25, 86 },
+ { -12, 89 }, { -17, 91 }, { -31, 127 }, { -14, 76 },
+ { -18, 103 }, { -13, 90 }, { -37, 127 }, { 11, 80 },
+ { 5, 76 }, { 2, 84 }, { 5, 78 }, { -6, 55 },
+ { 4, 61 }, { -14, 83 }, { -37, 127 }, { -5, 79 },
+ { -11, 104 }, { -11, 91 }, { -30, 127 }, { 0, 65 },
+ { -2, 79 }, { 0, 72 }, { -4, 92 }, { -6, 56 },
+ { 3, 68 }, { -8, 71 }, { -13, 98 },
+
+ /* 105 -> 165 */
+ { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
+ { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
+ { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
+ { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
+ { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
+ { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
+ { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
+ { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
+ { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
+ { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
+ { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
+ { 3, 65 }, { -7, 69 }, { 8, 77 }, { -10, 66 },
+ { 3, 62 }, { -3, 68 }, { -20, 81 }, { 0, 30 },
+ { 1, 7 }, { -3, 23 }, { -21, 74 }, { 16, 66 },
+ { -23, 124 }, { 17, 37 }, { 44, -18 }, { 50, -34 },
+ { -22, 127 },
+
+ /* 166 - 226 */
+ { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
+ { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
+ { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
+ { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
+ { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
+ { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
+ { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
+ { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
+ { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
+ { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
+ { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
+ { 20, 34 }, { 19, 31 }, { 27, 44 }, { 19, 16 },
+ { 15, 36 }, { 15, 36 }, { 21, 28 }, { 25, 21 },
+ { 30, 20 }, { 31, 12 }, { 27, 16 }, { 24, 42 },
+ { 0, 93 }, { 14, 56 }, { 15, 57 }, { 26, 38 },
+ { -24, 127 },
+
+ /* 227 - 275 */
+ { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
+ { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
+ { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
+ { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
+ { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
+ { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
+ { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
+ { -12, 92 }, { -18, 108 }, { -4, 79 }, { -22, 69 },
+ { -16, 75 }, { -2, 58 }, { 1, 58 }, { -13, 78 },
+ { -9, 83 }, { -4, 81 }, { -13, 99 }, { -13, 81 },
+ { -6, 38 }, { -13, 62 }, { -6, 58 }, { -2, 59 },
+ { -16, 73 }, { -10, 76 }, { -13, 86 }, { -9, 83 },
+ { -10, 87 },
+
+ /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */
+ { 0, 0 },
+
+ /* 277 - 337 */
+ { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
+ { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
+ { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
+ { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
+ { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
+ { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
+ { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
+ { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
+ { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
+ { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
+ { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
+ { -2, 76 }, { -18, 86 }, { 12, 70 }, { 5, 64 },
+ { -12, 70 }, { 11, 55 }, { 5, 56 }, { 0, 69 },
+ { 2, 65 }, { -6, 74 }, { 5, 54 }, { 7, 54 },
+ { -6, 76 }, { -11, 82 }, { -2, 77 }, { -2, 77 },
+ { 25, 42 },
+
+ /* 338 - 398 */
+ { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
+ { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
+ { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
+ { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
+ { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
+ { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
+ { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
+ { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
+ { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
+ { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
+ { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
+ { 18, 31 }, { 19, 26 }, { 36, 24 }, { 24, 23 },
+ { 27, 16 }, { 24, 30 }, { 31, 29 }, { 22, 41 },
+ { 22, 42 }, { 16, 60 }, { 15, 52 }, { 14, 60 },
+ { 3, 78 }, { -16, 123 }, { 21, 53 }, { 22, 56 },
+ { 25, 61 },
+
+ /* 399 -> 435 */
+ { 21, 33 }, { 19, 50 }, { 17, 61 },
+ { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
+ { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
+ { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
+ { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
+ { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
+ { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
+ { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
+ { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
+ { -6, 68 }, { -10, 79 },
+
+ /* 436 -> 459 */
+ { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
+ { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
+ { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
+ { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 },
+ { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
+ { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
+
+ /* 460 - 1024 */
+ { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
+ { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
+ { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
+ { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 },
+ { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 },
+ { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
+ { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
+ { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
+ { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
+ { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
+ { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
+ { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
+ { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
+ { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
+ { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
+ { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
+ { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
+ { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 },
+ { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 },
+ { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 },
+ { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 },
+ { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 },
+ { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 },
+ { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 },
+ { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 },
+ { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 },
+ { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 },
+ { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 },
+ { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
+ { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
+ { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
+ { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
+ { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
+ { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
+ { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
+ { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
+ { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
+ { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
+ { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
+ { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 },
+ { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 },
+ { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 },
+ { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 },
+ { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 },
+ { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 },
+ { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 },
+ { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 },
+ { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 },
+ { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 },
+ { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 },
+ { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 },
+ { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 },
+ { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 },
+ { -14, 59 }, { -9, 52 }, { -11, 68 }, { -3, 78 },
+ { -8, 74 }, { -9, 72 }, { -10, 72 }, { -18, 75 },
+ { -12, 71 }, { -11, 63 }, { -5, 70 }, { -17, 75 },
+ { -14, 72 }, { -16, 67 }, { -8, 53 }, { -14, 59 },
+ { -9, 52 }, { -11, 68 }, { 9, -2 }, { 30, -10 },
+ { 31, -4 }, { 33, -1 }, { 33, 7 }, { 31, 12 },
+ { 37, 23 }, { 31, 38 }, { 20, 64 }, { 9, -2 },
+ { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 },
+ { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 },
+ { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 },
+ { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 },
+ { -6, 68 }, { -10, 79 }, { -3, 78 }, { -8, 74 },
+ { -9, 72 }, { -10, 72 }, { -18, 75 }, { -12, 71 },
+ { -11, 63 }, { -5, 70 }, { -17, 75 }, { -14, 72 },
+ { -16, 67 }, { -8, 53 }, { -14, 59 }, { -9, 52 },
+ { -11, 68 }, { -3, 78 }, { -8, 74 }, { -9, 72 },
+ { -10, 72 }, { -18, 75 }, { -12, 71 }, { -11, 63 },
+ { -5, 70 }, { -17, 75 }, { -14, 72 }, { -16, 67 },
+ { -8, 53 }, { -14, 59 }, { -9, 52 }, { -11, 68 },
+ { 9, -2 }, { 30, -10 }, { 31, -4 }, { 33, -1 },
+ { 33, 7 }, { 31, 12 }, { 37, 23 }, { 31, 38 },
+ { 20, 64 }, { 9, -2 }, { 30, -10 }, { 31, -4 },
+ { 33, -1 }, { 33, 7 }, { 31, 12 }, { 37, 23 },
+ { 31, 38 }, { 20, 64 }, { -9, 71 }, { -7, 37 },
+ { -8, 44 }, { -11, 49 }, { -10, 56 }, { -12, 59 },
+ { -8, 63 }, { -9, 67 }, { -6, 68 }, { -10, 79 },
+ { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
+ { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
+ { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
+ { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
+ { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
+ { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
+ { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
+ { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
+ { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
+ { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
+ { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
+ { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
+ { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
+ { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
+ { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 },
+ { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 },
+ { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 },
+ { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 },
+ { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 },
+ { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 },
+ { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 },
+ { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 },
+ { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
+ { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
+ { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
+ { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
+ { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
+ { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
+ { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
+ { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
+ { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
+ { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
+ { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
+ { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 },
+ { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 },
+ { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 },
+ { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 },
+ { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 },
+ { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 },
+ { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 },
+ { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 },
+ { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 },
+ { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 },
+ { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 },
+ { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 },
+ { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 },
+ { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 },
+ { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 },
+ { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 },
+ { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 },
+ { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 },
+ { -12, 92 }, { -18, 108 }, { -24, 115 }, { -22, 82 },
+ { -9, 62 }, { 0, 53 }, { 0, 59 }, { -14, 85 },
+ { -13, 89 }, { -13, 94 }, { -11, 92 }, { -29, 127 },
+ { -21, 100 }, { -14, 57 }, { -12, 67 }, { -11, 71 },
+ { -10, 77 }, { -21, 85 }, { -16, 88 }, { -23, 104 },
+ { -15, 98 }, { -37, 127 }, { -10, 82 }, { -8, 48 },
+ { -8, 61 }, { -8, 66 }, { -7, 70 }, { -14, 75 },
+ { -10, 79 }, { -9, 83 }, { -12, 92 }, { -18, 108 },
+ { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
+ { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 },
+ { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }
+ }
+};
+
+const uint8_t x264_cabac_range_lps[64][4] =
+{
+ { 2, 2, 2, 2}, { 6, 7, 8, 9}, { 6, 7, 9, 10}, { 6, 8, 9, 11},
+ { 7, 8, 10, 11}, { 7, 9, 10, 12}, { 7, 9, 11, 12}, { 8, 9, 11, 13},
+ { 8, 10, 12, 14}, { 9, 11, 12, 14}, { 9, 11, 13, 15}, { 10, 12, 14, 16},
+ { 10, 12, 15, 17}, { 11, 13, 15, 18}, { 11, 14, 16, 19}, { 12, 14, 17, 20},
+ { 12, 15, 18, 21}, { 13, 16, 19, 22}, { 14, 17, 20, 23}, { 14, 18, 21, 24},
+ { 15, 19, 22, 25}, { 16, 20, 23, 27}, { 17, 21, 25, 28}, { 18, 22, 26, 30},
+ { 19, 23, 27, 31}, { 20, 24, 29, 33}, { 21, 26, 30, 35}, { 22, 27, 32, 37},
+ { 23, 28, 33, 39}, { 24, 30, 35, 41}, { 26, 31, 37, 43}, { 27, 33, 39, 45},
+ { 29, 35, 41, 48}, { 30, 37, 43, 50}, { 32, 39, 46, 53}, { 33, 41, 48, 56},
+ { 35, 43, 51, 59}, { 37, 45, 54, 62}, { 39, 48, 56, 65}, { 41, 50, 59, 69},
+ { 43, 53, 63, 72}, { 46, 56, 66, 76}, { 48, 59, 69, 80}, { 51, 62, 73, 85},
+ { 53, 65, 77, 89}, { 56, 69, 81, 94}, { 59, 72, 86, 99}, { 62, 76, 90, 104},
+ { 66, 80, 95, 110}, { 69, 85, 100, 116}, { 73, 89, 105, 122}, { 77, 94, 111, 128},
+ { 81, 99, 117, 135}, { 85, 104, 123, 142}, { 90, 110, 130, 150}, { 95, 116, 137, 158},
+ {100, 122, 144, 166}, {105, 128, 152, 175}, {111, 135, 160, 185}, {116, 142, 169, 195},
+ {123, 150, 178, 205}, {128, 158, 187, 216}, {128, 167, 197, 227}, {128, 176, 208, 240}
+};
+
+const uint8_t x264_cabac_transition[128][2] =
+{
+ { 0, 0}, { 1, 1}, { 2, 50}, { 51, 3}, { 2, 50}, { 51, 3}, { 4, 52}, { 53, 5},
+ { 6, 52}, { 53, 7}, { 8, 52}, { 53, 9}, { 10, 54}, { 55, 11}, { 12, 54}, { 55, 13},
+ { 14, 54}, { 55, 15}, { 16, 56}, { 57, 17}, { 18, 56}, { 57, 19}, { 20, 56}, { 57, 21},
+ { 22, 58}, { 59, 23}, { 24, 58}, { 59, 25}, { 26, 60}, { 61, 27}, { 28, 60}, { 61, 29},
+ { 30, 60}, { 61, 31}, { 32, 62}, { 63, 33}, { 34, 62}, { 63, 35}, { 36, 64}, { 65, 37},
+ { 38, 66}, { 67, 39}, { 40, 66}, { 67, 41}, { 42, 66}, { 67, 43}, { 44, 68}, { 69, 45},
+ { 46, 68}, { 69, 47}, { 48, 70}, { 71, 49}, { 50, 72}, { 73, 51}, { 52, 72}, { 73, 53},
+ { 54, 74}, { 75, 55}, { 56, 74}, { 75, 57}, { 58, 76}, { 77, 59}, { 60, 78}, { 79, 61},
+ { 62, 78}, { 79, 63}, { 64, 80}, { 81, 65}, { 66, 82}, { 83, 67}, { 68, 82}, { 83, 69},
+ { 70, 84}, { 85, 71}, { 72, 84}, { 85, 73}, { 74, 88}, { 89, 75}, { 76, 88}, { 89, 77},
+ { 78, 90}, { 91, 79}, { 80, 90}, { 91, 81}, { 82, 94}, { 95, 83}, { 84, 94}, { 95, 85},
+ { 86, 96}, { 97, 87}, { 88, 96}, { 97, 89}, { 90, 100}, {101, 91}, { 92, 100}, {101, 93},
+ { 94, 102}, {103, 95}, { 96, 104}, {105, 97}, { 98, 104}, {105, 99}, {100, 108}, {109, 101},
+ {102, 108}, {109, 103}, {104, 110}, {111, 105}, {106, 112}, {113, 107}, {108, 114}, {115, 109},
+ {110, 116}, {117, 111}, {112, 118}, {119, 113}, {114, 118}, {119, 115}, {116, 122}, {123, 117},
+ {118, 122}, {123, 119}, {120, 124}, {125, 121}, {122, 126}, {127, 123}, {124, 127}, {126, 125}
+};
+
+const uint8_t x264_cabac_renorm_shift[64] =
+{
+ 6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+/* -ln2(probability) */
+const uint16_t x264_cabac_entropy[128] =
+{
+ FIX8(0.0273), FIX8(5.7370), FIX8(0.0288), FIX8(5.6618),
+ FIX8(0.0303), FIX8(5.5866), FIX8(0.0320), FIX8(5.5114),
+ FIX8(0.0337), FIX8(5.4362), FIX8(0.0355), FIX8(5.3610),
+ FIX8(0.0375), FIX8(5.2859), FIX8(0.0395), FIX8(5.2106),
+ FIX8(0.0416), FIX8(5.1354), FIX8(0.0439), FIX8(5.0602),
+ FIX8(0.0463), FIX8(4.9851), FIX8(0.0488), FIX8(4.9099),
+ FIX8(0.0515), FIX8(4.8347), FIX8(0.0543), FIX8(4.7595),
+ FIX8(0.0572), FIX8(4.6843), FIX8(0.0604), FIX8(4.6091),
+ FIX8(0.0637), FIX8(4.5339), FIX8(0.0671), FIX8(4.4588),
+ FIX8(0.0708), FIX8(4.3836), FIX8(0.0747), FIX8(4.3083),
+ FIX8(0.0788), FIX8(4.2332), FIX8(0.0832), FIX8(4.1580),
+ FIX8(0.0878), FIX8(4.0828), FIX8(0.0926), FIX8(4.0076),
+ FIX8(0.0977), FIX8(3.9324), FIX8(0.1032), FIX8(3.8572),
+ FIX8(0.1089), FIX8(3.7820), FIX8(0.1149), FIX8(3.7068),
+ FIX8(0.1214), FIX8(3.6316), FIX8(0.1282), FIX8(3.5565),
+ FIX8(0.1353), FIX8(3.4813), FIX8(0.1429), FIX8(3.4061),
+ FIX8(0.1510), FIX8(3.3309), FIX8(0.1596), FIX8(3.2557),
+ FIX8(0.1686), FIX8(3.1805), FIX8(0.1782), FIX8(3.1053),
+ FIX8(0.1884), FIX8(3.0301), FIX8(0.1992), FIX8(2.9549),
+ FIX8(0.2107), FIX8(2.8797), FIX8(0.2229), FIX8(2.8046),
+ FIX8(0.2358), FIX8(2.7294), FIX8(0.2496), FIX8(2.6542),
+ FIX8(0.2642), FIX8(2.5790), FIX8(0.2798), FIX8(2.5038),
+ FIX8(0.2964), FIX8(2.4286), FIX8(0.3142), FIX8(2.3534),
+ FIX8(0.3331), FIX8(2.2782), FIX8(0.3532), FIX8(2.2030),
+ FIX8(0.3748), FIX8(2.1278), FIX8(0.3979), FIX8(2.0527),
+ FIX8(0.4226), FIX8(1.9775), FIX8(0.4491), FIX8(1.9023),
+ FIX8(0.4776), FIX8(1.8271), FIX8(0.5082), FIX8(1.7519),
+ FIX8(0.5412), FIX8(1.6767), FIX8(0.5768), FIX8(1.6015),
+ FIX8(0.6152), FIX8(1.5263), FIX8(0.6568), FIX8(1.4511),
+ FIX8(0.7020), FIX8(1.3759), FIX8(0.7513), FIX8(1.3008),
+ FIX8(0.8050), FIX8(1.2256), FIX8(0.8638), FIX8(1.1504),
+ FIX8(0.9285), FIX8(1.0752), FIX8(1.0000), FIX8(1.0000)
+};
+
+/*****************************************************************************
+ * RDO
+ *****************************************************************************/
+
+/* Padded to [64] for easier addressing */
+const uint8_t x264_significant_coeff_flag_offset_8x8[2][64] =
+{{
+ 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
+ 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
+ 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
+ 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12
+},{
+ 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
+ 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
+ 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
+ 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14
+}};
+const uint8_t x264_last_coeff_flag_offset_8x8[63] =
+{
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
+};
+const uint8_t x264_coeff_flag_offset_chroma_422_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; /* MIN( i/2, 2 ) */
+const uint16_t x264_significant_coeff_flag_offset[2][16] =
+{
+ { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718, 0, 0 },
+ { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733, 0, 0 }
+};
+const uint16_t x264_last_coeff_flag_offset[2][16] =
+{
+ { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748, 0, 0 },
+ { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757, 0, 0 }
+};
+const uint16_t x264_coeff_abs_level_m1_offset[16] =
+{
+ 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766
+};
+const uint8_t x264_count_cat_m1[14] = {15, 14, 15, 3, 14, 63, 15, 14, 15, 63, 15, 14, 15, 63};
+
+/*****************************************************************************
+ * VLC
+ *****************************************************************************/
+
+/* [nC] */
+const vlc_t x264_coeff0_token[6] =
+{
+ { 0x1, 1 }, /* str=1 */
+ { 0x3, 2 }, /* str=11 */
+ { 0xf, 4 }, /* str=1111 */
+ { 0x3, 6 }, /* str=000011 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 1 }, /* str=1 */
+};
+
+/* [nC][i_total_coeff-1][i_trailing] */
+const vlc_t x264_coeff_token[6][16][4] =
+{
+ { /* table 0 */
+ { /* i_total 1 */
+ { 0x5, 6 }, /* str=000101 */
+ { 0x1, 2 }, /* str=01 */
+ },
+ { /* i_total 2 */
+ { 0x7, 8 }, /* str=00000111 */
+ { 0x4, 6 }, /* str=000100 */
+ { 0x1, 3 }, /* str=001 */
+ },
+ { /* i_total 3 */
+ { 0x7, 9 }, /* str=000000111 */
+ { 0x6, 8 }, /* str=00000110 */
+ { 0x5, 7 }, /* str=0000101 */
+ { 0x3, 5 }, /* str=00011 */
+ },
+ { /* i_total 4 */
+ { 0x7, 10 }, /* str=0000000111 */
+ { 0x6, 9 }, /* str=000000110 */
+ { 0x5, 8 }, /* str=00000101 */
+ { 0x3, 6 }, /* str=000011 */
+ },
+ { /* i_total 5 */
+ { 0x7, 11 }, /* str=00000000111 */
+ { 0x6, 10 }, /* str=0000000110 */
+ { 0x5, 9 }, /* str=000000101 */
+ { 0x4, 7 }, /* str=0000100 */
+ },
+ { /* i_total 6 */
+ { 0xf, 13 }, /* str=0000000001111 */
+ { 0x6, 11 }, /* str=00000000110 */
+ { 0x5, 10 }, /* str=0000000101 */
+ { 0x4, 8 }, /* str=00000100 */
+ },
+ { /* i_total 7 */
+ { 0xb, 13 }, /* str=0000000001011 */
+ { 0xe, 13 }, /* str=0000000001110 */
+ { 0x5, 11 }, /* str=00000000101 */
+ { 0x4, 9 }, /* str=000000100 */
+ },
+ { /* i_total 8 */
+ { 0x8, 13 }, /* str=0000000001000 */
+ { 0xa, 13 }, /* str=0000000001010 */
+ { 0xd, 13 }, /* str=0000000001101 */
+ { 0x4, 10 }, /* str=0000000100 */
+ },
+ { /* i_total 9 */
+ { 0xf, 14 }, /* str=00000000001111 */
+ { 0xe, 14 }, /* str=00000000001110 */
+ { 0x9, 13 }, /* str=0000000001001 */
+ { 0x4, 11 }, /* str=00000000100 */
+ },
+ { /* i_total 10 */
+ { 0xb, 14 }, /* str=00000000001011 */
+ { 0xa, 14 }, /* str=00000000001010 */
+ { 0xd, 14 }, /* str=00000000001101 */
+ { 0xc, 13 }, /* str=0000000001100 */
+ },
+ { /* i_total 14 */
+ { 0xf, 15 }, /* str=000000000001111 */
+ { 0xe, 15 }, /* str=000000000001110 */
+ { 0x9, 14 }, /* str=00000000001001 */
+ { 0xc, 14 }, /* str=00000000001100 */
+ },
+ { /* i_total 12 */
+ { 0xb, 15 }, /* str=000000000001011 */
+ { 0xa, 15 }, /* str=000000000001010 */
+ { 0xd, 15 }, /* str=000000000001101 */
+ { 0x8, 14 }, /* str=00000000001000 */
+ },
+ { /* i_total 13 */
+ { 0xf, 16 }, /* str=0000000000001111 */
+ { 0x1, 15 }, /* str=000000000000001 */
+ { 0x9, 15 }, /* str=000000000001001 */
+ { 0xc, 15 }, /* str=000000000001100 */
+ },
+ { /* i_total 14 */
+ { 0xb, 16 }, /* str=0000000000001011 */
+ { 0xe, 16 }, /* str=0000000000001110 */
+ { 0xd, 16 }, /* str=0000000000001101 */
+ { 0x8, 15 }, /* str=000000000001000 */
+ },
+ { /* i_total 15 */
+ { 0x7, 16 }, /* str=0000000000000111 */
+ { 0xa, 16 }, /* str=0000000000001010 */
+ { 0x9, 16 }, /* str=0000000000001001 */
+ { 0xc, 16 }, /* str=0000000000001100 */
+ },
+ { /* i_total 16 */
+ { 0x4, 16 }, /* str=0000000000000100 */
+ { 0x6, 16 }, /* str=0000000000000110 */
+ { 0x5, 16 }, /* str=0000000000000101 */
+ { 0x8, 16 }, /* str=0000000000001000 */
+ },
+ },
+ { /* table 1 */
+ { /* i_total 1 */
+ { 0xb, 6 }, /* str=001011 */
+ { 0x2, 2 }, /* str=10 */
+ },
+ { /* i_total 2 */
+ { 0x7, 6 }, /* str=000111 */
+ { 0x7, 5 }, /* str=00111 */
+ { 0x3, 3 }, /* str=011 */
+ },
+ { /* i_total 3 */
+ { 0x7, 7 }, /* str=0000111 */
+ { 0xa, 6 }, /* str=001010 */
+ { 0x9, 6 }, /* str=001001 */
+ { 0x5, 4 }, /* str=0101 */
+ },
+ { /* i_total 4 */
+ { 0x7, 8 }, /* str=00000111 */
+ { 0x6, 6 }, /* str=000110 */
+ { 0x5, 6 }, /* str=000101 */
+ { 0x4, 4 }, /* str=0100 */
+ },
+ { /* i_total 5 */
+ { 0x4, 8 }, /* str=00000100 */
+ { 0x6, 7 }, /* str=0000110 */
+ { 0x5, 7 }, /* str=0000101 */
+ { 0x6, 5 }, /* str=00110 */
+ },
+ { /* i_total 6 */
+ { 0x7, 9 }, /* str=000000111 */
+ { 0x6, 8 }, /* str=00000110 */
+ { 0x5, 8 }, /* str=00000101 */
+ { 0x8, 6 }, /* str=001000 */
+ },
+ { /* i_total 7 */
+ { 0xf, 11 }, /* str=00000001111 */
+ { 0x6, 9 }, /* str=000000110 */
+ { 0x5, 9 }, /* str=000000101 */
+ { 0x4, 6 }, /* str=000100 */
+ },
+ { /* i_total 8 */
+ { 0xb, 11 }, /* str=00000001011 */
+ { 0xe, 11 }, /* str=00000001110 */
+ { 0xd, 11 }, /* str=00000001101 */
+ { 0x4, 7 }, /* str=0000100 */
+ },
+ { /* i_total 9 */
+ { 0xf, 12 }, /* str=000000001111 */
+ { 0xa, 11 }, /* str=00000001010 */
+ { 0x9, 11 }, /* str=00000001001 */
+ { 0x4, 9 }, /* str=000000100 */
+ },
+ { /* i_total 10 */
+ { 0xb, 12 }, /* str=000000001011 */
+ { 0xe, 12 }, /* str=000000001110 */
+ { 0xd, 12 }, /* str=000000001101 */
+ { 0xc, 11 }, /* str=00000001100 */
+ },
+ { /* i_total 11 */
+ { 0x8, 12 }, /* str=000000001000 */
+ { 0xa, 12 }, /* str=000000001010 */
+ { 0x9, 12 }, /* str=000000001001 */
+ { 0x8, 11 }, /* str=00000001000 */
+ },
+ { /* i_total 12 */
+ { 0xf, 13 }, /* str=0000000001111 */
+ { 0xe, 13 }, /* str=0000000001110 */
+ { 0xd, 13 }, /* str=0000000001101 */
+ { 0xc, 12 }, /* str=000000001100 */
+ },
+ { /* i_total 13 */
+ { 0xb, 13 }, /* str=0000000001011 */
+ { 0xa, 13 }, /* str=0000000001010 */
+ { 0x9, 13 }, /* str=0000000001001 */
+ { 0xc, 13 }, /* str=0000000001100 */
+ },
+ { /* i_total 14 */
+ { 0x7, 13 }, /* str=0000000000111 */
+ { 0xb, 14 }, /* str=00000000001011 */
+ { 0x6, 13 }, /* str=0000000000110 */
+ { 0x8, 13 }, /* str=0000000001000 */
+ },
+ { /* i_total 15 */
+ { 0x9, 14 }, /* str=00000000001001 */
+ { 0x8, 14 }, /* str=00000000001000 */
+ { 0xa, 14 }, /* str=00000000001010 */
+ { 0x1, 13 }, /* str=0000000000001 */
+ },
+ { /* i_total 16 */
+ { 0x7, 14 }, /* str=00000000000111 */
+ { 0x6, 14 }, /* str=00000000000110 */
+ { 0x5, 14 }, /* str=00000000000101 */
+ { 0x4, 14 }, /* str=00000000000100 */
+ },
+ },
+ { /* table 2 */
+ { /* i_total 1 */
+ { 0xf, 6 }, /* str=001111 */
+ { 0xe, 4 }, /* str=1110 */
+ },
+ { /* i_total 2 */
+ { 0xb, 6 }, /* str=001011 */
+ { 0xf, 5 }, /* str=01111 */
+ { 0xd, 4 }, /* str=1101 */
+ },
+ { /* i_total 3 */
+ { 0x8, 6 }, /* str=001000 */
+ { 0xc, 5 }, /* str=01100 */
+ { 0xe, 5 }, /* str=01110 */
+ { 0xc, 4 }, /* str=1100 */
+ },
+ { /* i_total 4 */
+ { 0xf, 7 }, /* str=0001111 */
+ { 0xa, 5 }, /* str=01010 */
+ { 0xb, 5 }, /* str=01011 */
+ { 0xb, 4 }, /* str=1011 */
+ },
+ { /* i_total 5 */
+ { 0xb, 7 }, /* str=0001011 */
+ { 0x8, 5 }, /* str=01000 */
+ { 0x9, 5 }, /* str=01001 */
+ { 0xa, 4 }, /* str=1010 */
+ },
+ { /* i_total 6 */
+ { 0x9, 7 }, /* str=0001001 */
+ { 0xe, 6 }, /* str=001110 */
+ { 0xd, 6 }, /* str=001101 */
+ { 0x9, 4 }, /* str=1001 */
+ },
+ { /* i_total 7 */
+ { 0x8, 7 }, /* str=0001000 */
+ { 0xa, 6 }, /* str=001010 */
+ { 0x9, 6 }, /* str=001001 */
+ { 0x8, 4 }, /* str=1000 */
+ },
+ { /* i_total 8 */
+ { 0xf, 8 }, /* str=00001111 */
+ { 0xe, 7 }, /* str=0001110 */
+ { 0xd, 7 }, /* str=0001101 */
+ { 0xd, 5 }, /* str=01101 */
+ },
+ { /* i_total 9 */
+ { 0xb, 8 }, /* str=00001011 */
+ { 0xe, 8 }, /* str=00001110 */
+ { 0xa, 7 }, /* str=0001010 */
+ { 0xc, 6 }, /* str=001100 */
+ },
+ { /* i_total 10 */
+ { 0xf, 9 }, /* str=000001111 */
+ { 0xa, 8 }, /* str=00001010 */
+ { 0xd, 8 }, /* str=00001101 */
+ { 0xc, 7 }, /* str=0001100 */
+ },
+ { /* i_total 11 */
+ { 0xb, 9 }, /* str=000001011 */
+ { 0xe, 9 }, /* str=000001110 */
+ { 0x9, 8 }, /* str=00001001 */
+ { 0xc, 8 }, /* str=00001100 */
+ },
+ { /* i_total 12 */
+ { 0x8, 9 }, /* str=000001000 */
+ { 0xa, 9 }, /* str=000001010 */
+ { 0xd, 9 }, /* str=000001101 */
+ { 0x8, 8 }, /* str=00001000 */
+ },
+ { /* i_total 13 */
+ { 0xd, 10 }, /* str=0000001101 */
+ { 0x7, 9 }, /* str=000000111 */
+ { 0x9, 9 }, /* str=000001001 */
+ { 0xc, 9 }, /* str=000001100 */
+ },
+ { /* i_total 14 */
+ { 0x9, 10 }, /* str=0000001001 */
+ { 0xc, 10 }, /* str=0000001100 */
+ { 0xb, 10 }, /* str=0000001011 */
+ { 0xa, 10 }, /* str=0000001010 */
+ },
+ { /* i_total 15 */
+ { 0x5, 10 }, /* str=0000000101 */
+ { 0x8, 10 }, /* str=0000001000 */
+ { 0x7, 10 }, /* str=0000000111 */
+ { 0x6, 10 }, /* str=0000000110 */
+ },
+ { /* i_total 16 */
+ { 0x1, 10 }, /* str=0000000001 */
+ { 0x4, 10 }, /* str=0000000100 */
+ { 0x3, 10 }, /* str=0000000011 */
+ { 0x2, 10 }, /* str=0000000010 */
+ },
+ },
+ { /* table 3 */
+ { /* i_total 1 */
+ { 0x0, 6 }, /* str=000000 */
+ { 0x1, 6 }, /* str=000001 */
+ },
+ { /* i_total 2 */
+ { 0x4, 6 }, /* str=000100 */
+ { 0x5, 6 }, /* str=000101 */
+ { 0x6, 6 }, /* str=000110 */
+ },
+ { /* i_total 3 */
+ { 0x8, 6 }, /* str=001000 */
+ { 0x9, 6 }, /* str=001001 */
+ { 0xa, 6 }, /* str=001010 */
+ { 0xb, 6 }, /* str=001011 */
+ },
+ { /* i_total 4 */
+ { 0xc, 6 }, /* str=001100 */
+ { 0xd, 6 }, /* str=001101 */
+ { 0xe, 6 }, /* str=001110 */
+ { 0xf, 6 }, /* str=001111 */
+ },
+ { /* i_total 5 */
+ { 0x10, 6 }, /* str=010000 */
+ { 0x11, 6 }, /* str=010001 */
+ { 0x12, 6 }, /* str=010010 */
+ { 0x13, 6 }, /* str=010011 */
+ },
+ { /* i_total 6 */
+ { 0x14, 6 }, /* str=010100 */
+ { 0x15, 6 }, /* str=010101 */
+ { 0x16, 6 }, /* str=010110 */
+ { 0x17, 6 }, /* str=010111 */
+ },
+ { /* i_total 7 */
+ { 0x18, 6 }, /* str=011000 */
+ { 0x19, 6 }, /* str=011001 */
+ { 0x1a, 6 }, /* str=011010 */
+ { 0x1b, 6 }, /* str=011011 */
+ },
+ { /* i_total 8 */
+ { 0x1c, 6 }, /* str=011100 */
+ { 0x1d, 6 }, /* str=011101 */
+ { 0x1e, 6 }, /* str=011110 */
+ { 0x1f, 6 }, /* str=011111 */
+ },
+ { /* i_total 9 */
+ { 0x20, 6 }, /* str=100000 */
+ { 0x21, 6 }, /* str=100001 */
+ { 0x22, 6 }, /* str=100010 */
+ { 0x23, 6 }, /* str=100011 */
+ },
+ { /* i_total 10 */
+ { 0x24, 6 }, /* str=100100 */
+ { 0x25, 6 }, /* str=100101 */
+ { 0x26, 6 }, /* str=100110 */
+ { 0x27, 6 }, /* str=100111 */
+ },
+ { /* i_total 11 */
+ { 0x28, 6 }, /* str=101000 */
+ { 0x29, 6 }, /* str=101001 */
+ { 0x2a, 6 }, /* str=101010 */
+ { 0x2b, 6 }, /* str=101011 */
+ },
+ { /* i_total 12 */
+ { 0x2c, 6 }, /* str=101100 */
+ { 0x2d, 6 }, /* str=101101 */
+ { 0x2e, 6 }, /* str=101110 */
+ { 0x2f, 6 }, /* str=101111 */
+ },
+ { /* i_total 13 */
+ { 0x30, 6 }, /* str=110000 */
+ { 0x31, 6 }, /* str=110001 */
+ { 0x32, 6 }, /* str=110010 */
+ { 0x33, 6 }, /* str=110011 */
+ },
+ { /* i_total 14 */
+ { 0x34, 6 }, /* str=110100 */
+ { 0x35, 6 }, /* str=110101 */
+ { 0x36, 6 }, /* str=110110 */
+ { 0x37, 6 }, /* str=110111 */
+ },
+ { /* i_total 15 */
+ { 0x38, 6 }, /* str=111000 */
+ { 0x39, 6 }, /* str=111001 */
+ { 0x3a, 6 }, /* str=111010 */
+ { 0x3b, 6 }, /* str=111011 */
+ },
+ { /* i_total 16 */
+ { 0x3c, 6 }, /* str=111100 */
+ { 0x3d, 6 }, /* str=111101 */
+ { 0x3e, 6 }, /* str=111110 */
+ { 0x3f, 6 }, /* str=111111 */
+ },
+ },
+ { /* table 4 */
+ { /* i_total 1 */
+ { 0x7, 6 }, /* str=000111 */
+ { 0x1, 1 }, /* str=1 */
+ },
+ { /* i_total 2 */
+ { 0x4, 6 }, /* str=000100 */
+ { 0x6, 6 }, /* str=000110 */
+ { 0x1, 3 }, /* str=001 */
+ },
+ { /* i_total 3 */
+ { 0x3, 6 }, /* str=000011 */
+ { 0x3, 7 }, /* str=0000011 */
+ { 0x2, 7 }, /* str=0000010 */
+ { 0x5, 6 }, /* str=000101 */
+ },
+ { /* i_total 4 */
+ { 0x2, 6 }, /* str=000010 */
+ { 0x3, 8 }, /* str=00000011 */
+ { 0x2, 8 }, /* str=00000010 */
+ { 0x0, 7 }, /* str=0000000 */
+ },
+ },
+ { /* table 5 */
+ { /* i_total 1 */
+ { 0xf, 7 }, /* str=0001111 */
+ { 0x1, 2 }, /* str=01 */
+ },
+ { /* i_total 2 */
+ { 0xe, 7 }, /* str=0001110 */
+ { 0xd, 7 }, /* str=0001101 */
+ { 0x1, 3 }, /* str=001 */
+ },
+ { /* i_total 3 */
+ { 0x7, 9 }, /* str=000000111 */
+ { 0xc, 7 }, /* str=0001100 */
+ { 0xb, 7 }, /* str=0001011 */
+ { 0x1, 5 }, /* str=00001 */
+ },
+ { /* i_total 4 */
+ { 0x6, 9 }, /* str=000000110 */
+ { 0x5, 9 }, /* str=000000101 */
+ { 0xa, 7 }, /* str=0001010 */
+ { 0x1, 6 }, /* str=000001 */
+ },
+ { /* i_total 5 */
+ { 0x7, 10 }, /* str=0000000111 */
+ { 0x6, 10 }, /* str=0000000110 */
+ { 0x4, 9 }, /* str=000000100 */
+ { 0x9, 7 }, /* str=0001001 */
+ },
+ { /* i_total 6 */
+ { 0x7, 11 }, /* str=00000000111 */
+ { 0x6, 11 }, /* str=00000000110 */
+ { 0x5, 10 }, /* str=0000000101 */
+ { 0x8, 7 }, /* str=0001000 */
+ },
+ { /* i_total 7 */
+ { 0x7, 12 }, /* str=000000000111 */
+ { 0x6, 12 }, /* str=000000000110 */
+ { 0x5, 11 }, /* str=00000000101 */
+ { 0x4, 10 }, /* str=0000000100 */
+ },
+ { /* i_total 8 */
+ { 0x7, 13 }, /* str=0000000000111 */
+ { 0x5, 12 }, /* str=000000000101 */
+ { 0x4, 12 }, /* str=000000000100 */
+ { 0x4, 11 }, /* str=00000000100 */
+ },
+ },
+};
+
+/* [i_total_coeff-1][i_total_zeros] */
+const vlc_t x264_total_zeros[15][16] =
+{
+ { /* i_total 1 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x3, 4 }, /* str=0011 */
+ { 0x2, 4 }, /* str=0010 */
+ { 0x3, 5 }, /* str=00011 */
+ { 0x2, 5 }, /* str=00010 */
+ { 0x3, 6 }, /* str=000011 */
+ { 0x2, 6 }, /* str=000010 */
+ { 0x3, 7 }, /* str=0000011 */
+ { 0x2, 7 }, /* str=0000010 */
+ { 0x3, 8 }, /* str=00000011 */
+ { 0x2, 8 }, /* str=00000010 */
+ { 0x3, 9 }, /* str=000000011 */
+ { 0x2, 9 }, /* str=000000010 */
+ { 0x1, 9 }, /* str=000000001 */
+ },
+ { /* i_total 2 */
+ { 0x7, 3 }, /* str=111 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x5, 4 }, /* str=0101 */
+ { 0x4, 4 }, /* str=0100 */
+ { 0x3, 4 }, /* str=0011 */
+ { 0x2, 4 }, /* str=0010 */
+ { 0x3, 5 }, /* str=00011 */
+ { 0x2, 5 }, /* str=00010 */
+ { 0x3, 6 }, /* str=000011 */
+ { 0x2, 6 }, /* str=000010 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x0, 6 }, /* str=000000 */
+ },
+ { /* i_total 3 */
+ { 0x5, 4 }, /* str=0101 */
+ { 0x7, 3 }, /* str=111 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 4 }, /* str=0100 */
+ { 0x3, 4 }, /* str=0011 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 4 }, /* str=0010 */
+ { 0x3, 5 }, /* str=00011 */
+ { 0x2, 5 }, /* str=00010 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x0, 6 }, /* str=000000 */
+ },
+ { /* i_total 4 */
+ { 0x3, 5 }, /* str=00011 */
+ { 0x7, 3 }, /* str=111 */
+ { 0x5, 4 }, /* str=0101 */
+ { 0x4, 4 }, /* str=0100 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 4 }, /* str=0011 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 4 }, /* str=0010 */
+ { 0x2, 5 }, /* str=00010 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x0, 5 }, /* str=00000 */
+ },
+ { /* i_total 5 */
+ { 0x5, 4 }, /* str=0101 */
+ { 0x4, 4 }, /* str=0100 */
+ { 0x3, 4 }, /* str=0011 */
+ { 0x7, 3 }, /* str=111 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 4 }, /* str=0010 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x0, 5 }, /* str=00000 */
+ },
+ { /* i_total 6 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x7, 3 }, /* str=111 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x0, 6 }, /* str=000000 */
+ },
+ { /* i_total 7 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x0, 6 }, /* str=000000 */
+ },
+ { /* i_total 8 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x0, 6 }, /* str=000000 */
+ },
+ { /* i_total 9 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x0, 6 }, /* str=000000 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 5 }, /* str=00001 */
+ },
+ { /* i_total 10 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x0, 5 }, /* str=00000 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 4 }, /* str=0001 */
+ },
+ { /* i_total 11 */
+ { 0x0, 4 }, /* str=0000 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x3, 3 }, /* str=011 */
+ },
+ { /* i_total 12 */
+ { 0x0, 4 }, /* str=0000 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x1, 3 }, /* str=001 */
+ },
+ { /* i_total 13 */
+ { 0x0, 3 }, /* str=000 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x1, 2 }, /* str=01 */
+ },
+ { /* i_total 14 */
+ { 0x0, 2 }, /* str=00 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 1 }, /* str=1 */
+ },
+ { /* i_total 15 */
+ { 0x0, 1 }, /* str=0 */
+ { 0x1, 1 }, /* str=1 */
+ },
+};
+
+/* [i_total_coeff-1][i_total_zeros] */
+const vlc_t x264_total_zeros_2x2_dc[3][4] =
+{
+ { /* i_total 1 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x0, 3 } /* str=000 */
+ },
+ { /* i_total 2 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x0, 2 }, /* str=00 */
+ },
+ { /* i_total 3 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x0, 1 }, /* str=0 */
+ },
+};
+
+/* [i_total_coeff-1][i_total_zeros] */
+const vlc_t x264_total_zeros_2x4_dc[7][8] =
+{
+ { /* i_total 1 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 4 }, /* str=0010 */
+ { 0x3, 4 }, /* str=0011 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x0, 5 }, /* str=00000 */
+ },
+ { /* i_total 2 */
+ { 0x0, 3 }, /* str=000 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x7, 3 }, /* str=111 */
+ },
+ { /* i_total 3 */
+ { 0x0, 3 }, /* str=000 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x7, 3 }, /* str=111 */
+ },
+ { /* i_total 4 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x0, 2 }, /* str=00 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x7, 3 }, /* str=111 */
+ },
+ { /* i_total 5 */
+ { 0x0, 2 }, /* str=00 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x3, 2 }, /* str=11 */
+ },
+ { /* i_total 6 */
+ { 0x0, 2 }, /* str=00 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 1 }, /* str=1 */
+ },
+ { /* i_total 7 */
+ { 0x0, 1 }, /* str=0 */
+ { 0x1, 1 }, /* str=1 */
+ }
+};
+
+/* [MIN( i_zero_left-1, 6 )][run_before] */
+const vlc_t x264_run_before_init[7][16] =
+{
+ { /* i_zero_left 1 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x0, 1 }, /* str=0 */
+ },
+ { /* i_zero_left 2 */
+ { 0x1, 1 }, /* str=1 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x0, 2 }, /* str=00 */
+ },
+ { /* i_zero_left 3 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x0, 2 }, /* str=00 */
+ },
+ { /* i_zero_left 4 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x1, 2 }, /* str=01 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x0, 3 }, /* str=000 */
+ },
+ { /* i_zero_left 5 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x2, 2 }, /* str=10 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x0, 3 }, /* str=000 */
+ },
+ { /* i_zero_left 6 */
+ { 0x3, 2 }, /* str=11 */
+ { 0x0, 3 }, /* str=000 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ },
+ { /* i_zero_left >6 */
+ { 0x7, 3 }, /* str=111 */
+ { 0x6, 3 }, /* str=110 */
+ { 0x5, 3 }, /* str=101 */
+ { 0x4, 3 }, /* str=100 */
+ { 0x3, 3 }, /* str=011 */
+ { 0x2, 3 }, /* str=010 */
+ { 0x1, 3 }, /* str=001 */
+ { 0x1, 4 }, /* str=0001 */
+ { 0x1, 5 }, /* str=00001 */
+ { 0x1, 6 }, /* str=000001 */
+ { 0x1, 7 }, /* str=0000001 */
+ { 0x1, 8 }, /* str=00000001 */
+ { 0x1, 9 }, /* str=000000001 */
+ { 0x1, 10 }, /* str=0000000001 */
+ { 0x1, 11 }, /* str=00000000001 */
+ },
+};
--- /dev/null
+/*****************************************************************************
+ * tables.h: const tables
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Laurent Aimar <fenrir@via.ecp.fr>
+ * Loren Merritt <lorenm@u.washington.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_TABLES_H
+#define X264_TABLES_H
+
+typedef struct
+{
+ uint8_t i_bits;
+ uint8_t i_size;
+} vlc_t;
+
+extern const x264_level_t x264_levels[];
+
+extern const uint8_t x264_exp2_lut[64];
+extern const float x264_log2_lut[128];
+extern const float x264_log2_lz_lut[32];
+
+#define QP_MAX_MAX (51+6*2+18)
+extern const uint16_t x264_lambda_tab[QP_MAX_MAX+1];
+extern const int x264_lambda2_tab[QP_MAX_MAX+1];
+extern const int x264_trellis_lambda2_tab[2][QP_MAX_MAX+1];
+#define MAX_CHROMA_LAMBDA_OFFSET 36
+extern const uint16_t x264_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1];
+
+extern const uint8_t x264_hpel_ref0[16];
+extern const uint8_t x264_hpel_ref1[16];
+
+extern const uint8_t x264_cqm_jvt4i[16];
+extern const uint8_t x264_cqm_jvt4p[16];
+extern const uint8_t x264_cqm_jvt8i[64];
+extern const uint8_t x264_cqm_jvt8p[64];
+extern const uint8_t x264_cqm_flat16[64];
+extern const uint8_t * const x264_cqm_jvt[8];
+extern const uint8_t x264_cqm_avci50_4ic[16];
+extern const uint8_t x264_cqm_avci50_p_8iy[64];
+extern const uint8_t x264_cqm_avci50_1080i_8iy[64];
+extern const uint8_t x264_cqm_avci100_720p_4ic[16];
+extern const uint8_t x264_cqm_avci100_720p_8iy[64];
+extern const uint8_t x264_cqm_avci100_1080_4ic[16];
+extern const uint8_t x264_cqm_avci100_1080i_8iy[64];
+extern const uint8_t x264_cqm_avci100_1080p_8iy[64];
+
+extern const uint8_t x264_decimate_table4[16];
+extern const uint8_t x264_decimate_table8[64];
+
+extern const uint32_t x264_dct4_weight_tab[16];
+extern const uint32_t x264_dct8_weight_tab[64];
+extern const uint32_t x264_dct4_weight2_tab[16];
+extern const uint32_t x264_dct8_weight2_tab[64];
+
+extern const int8_t x264_cabac_context_init_I[1024][2];
+extern const int8_t x264_cabac_context_init_PB[3][1024][2];
+extern const uint8_t x264_cabac_range_lps[64][4];
+extern const uint8_t x264_cabac_transition[128][2];
+extern const uint8_t x264_cabac_renorm_shift[64];
+extern const uint16_t x264_cabac_entropy[128];
+
+extern const uint8_t x264_significant_coeff_flag_offset_8x8[2][64];
+extern const uint8_t x264_last_coeff_flag_offset_8x8[63];
+extern const uint8_t x264_coeff_flag_offset_chroma_422_dc[7];
+extern const uint16_t x264_significant_coeff_flag_offset[2][16];
+extern const uint16_t x264_last_coeff_flag_offset[2][16];
+extern const uint16_t x264_coeff_abs_level_m1_offset[16];
+extern const uint8_t x264_count_cat_m1[14];
+
+extern const vlc_t x264_coeff0_token[6];
+extern const vlc_t x264_coeff_token[6][16][4];
+extern const vlc_t x264_total_zeros[15][16];
+extern const vlc_t x264_total_zeros_2x2_dc[3][4];
+extern const vlc_t x264_total_zeros_2x4_dc[7][8];
+extern const vlc_t x264_run_before_init[7][16];
+
+#endif
typedef struct x264_threadpool_t x264_threadpool_t;
#if HAVE_THREAD
+#define x264_threadpool_init x264_template(threadpool_init)
int x264_threadpool_init( x264_threadpool_t **p_pool, int threads,
void (*init_func)(void *), void *init_arg );
+#define x264_threadpool_run x264_template(threadpool_run)
void x264_threadpool_run( x264_threadpool_t *pool, void *(*func)(void *), void *arg );
+#define x264_threadpool_wait x264_template(threadpool_wait)
void *x264_threadpool_wait( x264_threadpool_t *pool, void *arg );
+#define x264_threadpool_delete x264_template(threadpool_delete)
void x264_threadpool_delete( x264_threadpool_t *pool );
#else
#define x264_threadpool_init(p,t,f,a) -1
#include "common.h"
-/* [nC] */
-const vlc_t x264_coeff0_token[6] =
-{
- { 0x1, 1 }, /* str=1 */
- { 0x3, 2 }, /* str=11 */
- { 0xf, 4 }, /* str=1111 */
- { 0x3, 6 }, /* str=000011 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
-};
-
-/* [nC][i_total_coeff-1][i_trailing] */
-const vlc_t x264_coeff_token[6][16][4] =
-{
- { /* table 0 */
- { /* i_total 1 */
- { 0x5, 6 }, /* str=000101 */
- { 0x1, 2 }, /* str=01 */
- },
- { /* i_total 2 */
- { 0x7, 8 }, /* str=00000111 */
- { 0x4, 6 }, /* str=000100 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 3 */
- { 0x7, 9 }, /* str=000000111 */
- { 0x6, 8 }, /* str=00000110 */
- { 0x5, 7 }, /* str=0000101 */
- { 0x3, 5 }, /* str=00011 */
- },
- { /* i_total 4 */
- { 0x7, 10 }, /* str=0000000111 */
- { 0x6, 9 }, /* str=000000110 */
- { 0x5, 8 }, /* str=00000101 */
- { 0x3, 6 }, /* str=000011 */
- },
- { /* i_total 5 */
- { 0x7, 11 }, /* str=00000000111 */
- { 0x6, 10 }, /* str=0000000110 */
- { 0x5, 9 }, /* str=000000101 */
- { 0x4, 7 }, /* str=0000100 */
- },
- { /* i_total 6 */
- { 0xf, 13 }, /* str=0000000001111 */
- { 0x6, 11 }, /* str=00000000110 */
- { 0x5, 10 }, /* str=0000000101 */
- { 0x4, 8 }, /* str=00000100 */
- },
- { /* i_total 7 */
- { 0xb, 13 }, /* str=0000000001011 */
- { 0xe, 13 }, /* str=0000000001110 */
- { 0x5, 11 }, /* str=00000000101 */
- { 0x4, 9 }, /* str=000000100 */
- },
- { /* i_total 8 */
- { 0x8, 13 }, /* str=0000000001000 */
- { 0xa, 13 }, /* str=0000000001010 */
- { 0xd, 13 }, /* str=0000000001101 */
- { 0x4, 10 }, /* str=0000000100 */
- },
- { /* i_total 9 */
- { 0xf, 14 }, /* str=00000000001111 */
- { 0xe, 14 }, /* str=00000000001110 */
- { 0x9, 13 }, /* str=0000000001001 */
- { 0x4, 11 }, /* str=00000000100 */
- },
- { /* i_total 10 */
- { 0xb, 14 }, /* str=00000000001011 */
- { 0xa, 14 }, /* str=00000000001010 */
- { 0xd, 14 }, /* str=00000000001101 */
- { 0xc, 13 }, /* str=0000000001100 */
- },
- { /* i_total 14 */
- { 0xf, 15 }, /* str=000000000001111 */
- { 0xe, 15 }, /* str=000000000001110 */
- { 0x9, 14 }, /* str=00000000001001 */
- { 0xc, 14 }, /* str=00000000001100 */
- },
- { /* i_total 12 */
- { 0xb, 15 }, /* str=000000000001011 */
- { 0xa, 15 }, /* str=000000000001010 */
- { 0xd, 15 }, /* str=000000000001101 */
- { 0x8, 14 }, /* str=00000000001000 */
- },
- { /* i_total 13 */
- { 0xf, 16 }, /* str=0000000000001111 */
- { 0x1, 15 }, /* str=000000000000001 */
- { 0x9, 15 }, /* str=000000000001001 */
- { 0xc, 15 }, /* str=000000000001100 */
- },
- { /* i_total 14 */
- { 0xb, 16 }, /* str=0000000000001011 */
- { 0xe, 16 }, /* str=0000000000001110 */
- { 0xd, 16 }, /* str=0000000000001101 */
- { 0x8, 15 }, /* str=000000000001000 */
- },
- { /* i_total 15 */
- { 0x7, 16 }, /* str=0000000000000111 */
- { 0xa, 16 }, /* str=0000000000001010 */
- { 0x9, 16 }, /* str=0000000000001001 */
- { 0xc, 16 }, /* str=0000000000001100 */
- },
- { /* i_total 16 */
- { 0x4, 16 }, /* str=0000000000000100 */
- { 0x6, 16 }, /* str=0000000000000110 */
- { 0x5, 16 }, /* str=0000000000000101 */
- { 0x8, 16 }, /* str=0000000000001000 */
- },
- },
- { /* table 1 */
- { /* i_total 1 */
- { 0xb, 6 }, /* str=001011 */
- { 0x2, 2 }, /* str=10 */
- },
- { /* i_total 2 */
- { 0x7, 6 }, /* str=000111 */
- { 0x7, 5 }, /* str=00111 */
- { 0x3, 3 }, /* str=011 */
- },
- { /* i_total 3 */
- { 0x7, 7 }, /* str=0000111 */
- { 0xa, 6 }, /* str=001010 */
- { 0x9, 6 }, /* str=001001 */
- { 0x5, 4 }, /* str=0101 */
- },
- { /* i_total 4 */
- { 0x7, 8 }, /* str=00000111 */
- { 0x6, 6 }, /* str=000110 */
- { 0x5, 6 }, /* str=000101 */
- { 0x4, 4 }, /* str=0100 */
- },
- { /* i_total 5 */
- { 0x4, 8 }, /* str=00000100 */
- { 0x6, 7 }, /* str=0000110 */
- { 0x5, 7 }, /* str=0000101 */
- { 0x6, 5 }, /* str=00110 */
- },
- { /* i_total 6 */
- { 0x7, 9 }, /* str=000000111 */
- { 0x6, 8 }, /* str=00000110 */
- { 0x5, 8 }, /* str=00000101 */
- { 0x8, 6 }, /* str=001000 */
- },
- { /* i_total 7 */
- { 0xf, 11 }, /* str=00000001111 */
- { 0x6, 9 }, /* str=000000110 */
- { 0x5, 9 }, /* str=000000101 */
- { 0x4, 6 }, /* str=000100 */
- },
- { /* i_total 8 */
- { 0xb, 11 }, /* str=00000001011 */
- { 0xe, 11 }, /* str=00000001110 */
- { 0xd, 11 }, /* str=00000001101 */
- { 0x4, 7 }, /* str=0000100 */
- },
- { /* i_total 9 */
- { 0xf, 12 }, /* str=000000001111 */
- { 0xa, 11 }, /* str=00000001010 */
- { 0x9, 11 }, /* str=00000001001 */
- { 0x4, 9 }, /* str=000000100 */
- },
- { /* i_total 10 */
- { 0xb, 12 }, /* str=000000001011 */
- { 0xe, 12 }, /* str=000000001110 */
- { 0xd, 12 }, /* str=000000001101 */
- { 0xc, 11 }, /* str=00000001100 */
- },
- { /* i_total 11 */
- { 0x8, 12 }, /* str=000000001000 */
- { 0xa, 12 }, /* str=000000001010 */
- { 0x9, 12 }, /* str=000000001001 */
- { 0x8, 11 }, /* str=00000001000 */
- },
- { /* i_total 12 */
- { 0xf, 13 }, /* str=0000000001111 */
- { 0xe, 13 }, /* str=0000000001110 */
- { 0xd, 13 }, /* str=0000000001101 */
- { 0xc, 12 }, /* str=000000001100 */
- },
- { /* i_total 13 */
- { 0xb, 13 }, /* str=0000000001011 */
- { 0xa, 13 }, /* str=0000000001010 */
- { 0x9, 13 }, /* str=0000000001001 */
- { 0xc, 13 }, /* str=0000000001100 */
- },
- { /* i_total 14 */
- { 0x7, 13 }, /* str=0000000000111 */
- { 0xb, 14 }, /* str=00000000001011 */
- { 0x6, 13 }, /* str=0000000000110 */
- { 0x8, 13 }, /* str=0000000001000 */
- },
- { /* i_total 15 */
- { 0x9, 14 }, /* str=00000000001001 */
- { 0x8, 14 }, /* str=00000000001000 */
- { 0xa, 14 }, /* str=00000000001010 */
- { 0x1, 13 }, /* str=0000000000001 */
- },
- { /* i_total 16 */
- { 0x7, 14 }, /* str=00000000000111 */
- { 0x6, 14 }, /* str=00000000000110 */
- { 0x5, 14 }, /* str=00000000000101 */
- { 0x4, 14 }, /* str=00000000000100 */
- },
- },
- { /* table 2 */
- { /* i_total 1 */
- { 0xf, 6 }, /* str=001111 */
- { 0xe, 4 }, /* str=1110 */
- },
- { /* i_total 2 */
- { 0xb, 6 }, /* str=001011 */
- { 0xf, 5 }, /* str=01111 */
- { 0xd, 4 }, /* str=1101 */
- },
- { /* i_total 3 */
- { 0x8, 6 }, /* str=001000 */
- { 0xc, 5 }, /* str=01100 */
- { 0xe, 5 }, /* str=01110 */
- { 0xc, 4 }, /* str=1100 */
- },
- { /* i_total 4 */
- { 0xf, 7 }, /* str=0001111 */
- { 0xa, 5 }, /* str=01010 */
- { 0xb, 5 }, /* str=01011 */
- { 0xb, 4 }, /* str=1011 */
- },
- { /* i_total 5 */
- { 0xb, 7 }, /* str=0001011 */
- { 0x8, 5 }, /* str=01000 */
- { 0x9, 5 }, /* str=01001 */
- { 0xa, 4 }, /* str=1010 */
- },
- { /* i_total 6 */
- { 0x9, 7 }, /* str=0001001 */
- { 0xe, 6 }, /* str=001110 */
- { 0xd, 6 }, /* str=001101 */
- { 0x9, 4 }, /* str=1001 */
- },
- { /* i_total 7 */
- { 0x8, 7 }, /* str=0001000 */
- { 0xa, 6 }, /* str=001010 */
- { 0x9, 6 }, /* str=001001 */
- { 0x8, 4 }, /* str=1000 */
- },
- { /* i_total 8 */
- { 0xf, 8 }, /* str=00001111 */
- { 0xe, 7 }, /* str=0001110 */
- { 0xd, 7 }, /* str=0001101 */
- { 0xd, 5 }, /* str=01101 */
- },
- { /* i_total 9 */
- { 0xb, 8 }, /* str=00001011 */
- { 0xe, 8 }, /* str=00001110 */
- { 0xa, 7 }, /* str=0001010 */
- { 0xc, 6 }, /* str=001100 */
- },
- { /* i_total 10 */
- { 0xf, 9 }, /* str=000001111 */
- { 0xa, 8 }, /* str=00001010 */
- { 0xd, 8 }, /* str=00001101 */
- { 0xc, 7 }, /* str=0001100 */
- },
- { /* i_total 11 */
- { 0xb, 9 }, /* str=000001011 */
- { 0xe, 9 }, /* str=000001110 */
- { 0x9, 8 }, /* str=00001001 */
- { 0xc, 8 }, /* str=00001100 */
- },
- { /* i_total 12 */
- { 0x8, 9 }, /* str=000001000 */
- { 0xa, 9 }, /* str=000001010 */
- { 0xd, 9 }, /* str=000001101 */
- { 0x8, 8 }, /* str=00001000 */
- },
- { /* i_total 13 */
- { 0xd, 10 }, /* str=0000001101 */
- { 0x7, 9 }, /* str=000000111 */
- { 0x9, 9 }, /* str=000001001 */
- { 0xc, 9 }, /* str=000001100 */
- },
- { /* i_total 14 */
- { 0x9, 10 }, /* str=0000001001 */
- { 0xc, 10 }, /* str=0000001100 */
- { 0xb, 10 }, /* str=0000001011 */
- { 0xa, 10 }, /* str=0000001010 */
- },
- { /* i_total 15 */
- { 0x5, 10 }, /* str=0000000101 */
- { 0x8, 10 }, /* str=0000001000 */
- { 0x7, 10 }, /* str=0000000111 */
- { 0x6, 10 }, /* str=0000000110 */
- },
- { /* i_total 16 */
- { 0x1, 10 }, /* str=0000000001 */
- { 0x4, 10 }, /* str=0000000100 */
- { 0x3, 10 }, /* str=0000000011 */
- { 0x2, 10 }, /* str=0000000010 */
- },
- },
- { /* table 3 */
- { /* i_total 1 */
- { 0x0, 6 }, /* str=000000 */
- { 0x1, 6 }, /* str=000001 */
- },
- { /* i_total 2 */
- { 0x4, 6 }, /* str=000100 */
- { 0x5, 6 }, /* str=000101 */
- { 0x6, 6 }, /* str=000110 */
- },
- { /* i_total 3 */
- { 0x8, 6 }, /* str=001000 */
- { 0x9, 6 }, /* str=001001 */
- { 0xa, 6 }, /* str=001010 */
- { 0xb, 6 }, /* str=001011 */
- },
- { /* i_total 4 */
- { 0xc, 6 }, /* str=001100 */
- { 0xd, 6 }, /* str=001101 */
- { 0xe, 6 }, /* str=001110 */
- { 0xf, 6 }, /* str=001111 */
- },
- { /* i_total 5 */
- { 0x10, 6 }, /* str=010000 */
- { 0x11, 6 }, /* str=010001 */
- { 0x12, 6 }, /* str=010010 */
- { 0x13, 6 }, /* str=010011 */
- },
- { /* i_total 6 */
- { 0x14, 6 }, /* str=010100 */
- { 0x15, 6 }, /* str=010101 */
- { 0x16, 6 }, /* str=010110 */
- { 0x17, 6 }, /* str=010111 */
- },
- { /* i_total 7 */
- { 0x18, 6 }, /* str=011000 */
- { 0x19, 6 }, /* str=011001 */
- { 0x1a, 6 }, /* str=011010 */
- { 0x1b, 6 }, /* str=011011 */
- },
- { /* i_total 8 */
- { 0x1c, 6 }, /* str=011100 */
- { 0x1d, 6 }, /* str=011101 */
- { 0x1e, 6 }, /* str=011110 */
- { 0x1f, 6 }, /* str=011111 */
- },
- { /* i_total 9 */
- { 0x20, 6 }, /* str=100000 */
- { 0x21, 6 }, /* str=100001 */
- { 0x22, 6 }, /* str=100010 */
- { 0x23, 6 }, /* str=100011 */
- },
- { /* i_total 10 */
- { 0x24, 6 }, /* str=100100 */
- { 0x25, 6 }, /* str=100101 */
- { 0x26, 6 }, /* str=100110 */
- { 0x27, 6 }, /* str=100111 */
- },
- { /* i_total 11 */
- { 0x28, 6 }, /* str=101000 */
- { 0x29, 6 }, /* str=101001 */
- { 0x2a, 6 }, /* str=101010 */
- { 0x2b, 6 }, /* str=101011 */
- },
- { /* i_total 12 */
- { 0x2c, 6 }, /* str=101100 */
- { 0x2d, 6 }, /* str=101101 */
- { 0x2e, 6 }, /* str=101110 */
- { 0x2f, 6 }, /* str=101111 */
- },
- { /* i_total 13 */
- { 0x30, 6 }, /* str=110000 */
- { 0x31, 6 }, /* str=110001 */
- { 0x32, 6 }, /* str=110010 */
- { 0x33, 6 }, /* str=110011 */
- },
- { /* i_total 14 */
- { 0x34, 6 }, /* str=110100 */
- { 0x35, 6 }, /* str=110101 */
- { 0x36, 6 }, /* str=110110 */
- { 0x37, 6 }, /* str=110111 */
- },
- { /* i_total 15 */
- { 0x38, 6 }, /* str=111000 */
- { 0x39, 6 }, /* str=111001 */
- { 0x3a, 6 }, /* str=111010 */
- { 0x3b, 6 }, /* str=111011 */
- },
- { /* i_total 16 */
- { 0x3c, 6 }, /* str=111100 */
- { 0x3d, 6 }, /* str=111101 */
- { 0x3e, 6 }, /* str=111110 */
- { 0x3f, 6 }, /* str=111111 */
- },
- },
- { /* table 4 */
- { /* i_total 1 */
- { 0x7, 6 }, /* str=000111 */
- { 0x1, 1 }, /* str=1 */
- },
- { /* i_total 2 */
- { 0x4, 6 }, /* str=000100 */
- { 0x6, 6 }, /* str=000110 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 3 */
- { 0x3, 6 }, /* str=000011 */
- { 0x3, 7 }, /* str=0000011 */
- { 0x2, 7 }, /* str=0000010 */
- { 0x5, 6 }, /* str=000101 */
- },
- { /* i_total 4 */
- { 0x2, 6 }, /* str=000010 */
- { 0x3, 8 }, /* str=00000011 */
- { 0x2, 8 }, /* str=00000010 */
- { 0x0, 7 }, /* str=0000000 */
- },
- },
- { /* table 5 */
- { /* i_total 1 */
- { 0xf, 7 }, /* str=0001111 */
- { 0x1, 2 }, /* str=01 */
- },
- { /* i_total 2 */
- { 0xe, 7 }, /* str=0001110 */
- { 0xd, 7 }, /* str=0001101 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 3 */
- { 0x7, 9 }, /* str=000000111 */
- { 0xc, 7 }, /* str=0001100 */
- { 0xb, 7 }, /* str=0001011 */
- { 0x1, 5 }, /* str=00001 */
- },
- { /* i_total 4 */
- { 0x6, 9 }, /* str=000000110 */
- { 0x5, 9 }, /* str=000000101 */
- { 0xa, 7 }, /* str=0001010 */
- { 0x1, 6 }, /* str=000001 */
- },
- { /* i_total 5 */
- { 0x7, 10 }, /* str=0000000111 */
- { 0x6, 10 }, /* str=0000000110 */
- { 0x4, 9 }, /* str=000000100 */
- { 0x9, 7 }, /* str=0001001 */
- },
- { /* i_total 6 */
- { 0x7, 11 }, /* str=00000000111 */
- { 0x6, 11 }, /* str=00000000110 */
- { 0x5, 10 }, /* str=0000000101 */
- { 0x8, 7 }, /* str=0001000 */
- },
- { /* i_total 7 */
- { 0x7, 12 }, /* str=000000000111 */
- { 0x6, 12 }, /* str=000000000110 */
- { 0x5, 11 }, /* str=00000000101 */
- { 0x4, 10 }, /* str=0000000100 */
- },
- { /* i_total 8 */
- { 0x7, 13 }, /* str=0000000000111 */
- { 0x5, 12 }, /* str=000000000101 */
- { 0x4, 12 }, /* str=000000000100 */
- { 0x4, 11 }, /* str=00000000100 */
- },
- },
-};
-
-/* [i_total_coeff-1][i_total_zeros] */
-const vlc_t x264_total_zeros[15][16] =
-{
- { /* i_total 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x3, 4 }, /* str=0011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 5 }, /* str=00011 */
- { 0x2, 5 }, /* str=00010 */
- { 0x3, 6 }, /* str=000011 */
- { 0x2, 6 }, /* str=000010 */
- { 0x3, 7 }, /* str=0000011 */
- { 0x2, 7 }, /* str=0000010 */
- { 0x3, 8 }, /* str=00000011 */
- { 0x2, 8 }, /* str=00000010 */
- { 0x3, 9 }, /* str=000000011 */
- { 0x2, 9 }, /* str=000000010 */
- { 0x1, 9 }, /* str=000000001 */
- },
- { /* i_total 2 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x5, 4 }, /* str=0101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 5 }, /* str=00011 */
- { 0x2, 5 }, /* str=00010 */
- { 0x3, 6 }, /* str=000011 */
- { 0x2, 6 }, /* str=000010 */
- { 0x1, 6 }, /* str=000001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 3 */
- { 0x5, 4 }, /* str=0101 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 5 }, /* str=00011 */
- { 0x2, 5 }, /* str=00010 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 4 */
- { 0x3, 5 }, /* str=00011 */
- { 0x7, 3 }, /* str=111 */
- { 0x5, 4 }, /* str=0101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x2, 5 }, /* str=00010 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 5 }, /* str=00000 */
- },
- { /* i_total 5 */
- { 0x5, 4 }, /* str=0101 */
- { 0x4, 4 }, /* str=0100 */
- { 0x3, 4 }, /* str=0011 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x1, 5 }, /* str=00001 */
- { 0x1, 4 }, /* str=0001 */
- { 0x0, 5 }, /* str=00000 */
- },
- { /* i_total 6 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 7 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 8 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x3, 3 }, /* str=011 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 6 }, /* str=000000 */
- },
- { /* i_total 9 */
- { 0x1, 6 }, /* str=000001 */
- { 0x0, 6 }, /* str=000000 */
- { 0x1, 4 }, /* str=0001 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 5 }, /* str=00001 */
- },
- { /* i_total 10 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 5 }, /* str=00000 */
- { 0x1, 3 }, /* str=001 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 4 }, /* str=0001 */
- },
- { /* i_total 11 */
- { 0x0, 4 }, /* str=0000 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 3 }, /* str=001 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 1 }, /* str=1 */
- { 0x3, 3 }, /* str=011 */
- },
- { /* i_total 12 */
- { 0x0, 4 }, /* str=0000 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 3 }, /* str=001 */
- },
- { /* i_total 13 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- },
- { /* i_total 14 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
- },
- { /* i_total 15 */
- { 0x0, 1 }, /* str=0 */
- { 0x1, 1 }, /* str=1 */
- },
-};
-
-/* [i_total_coeff-1][i_total_zeros] */
-const vlc_t x264_total_zeros_2x2_dc[3][4] =
-{
- { /* i_total 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 3 } /* str=000 */
- },
- { /* i_total 2 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- { 0x0, 2 }, /* str=00 */
- },
- { /* i_total 3 */
- { 0x1, 1 }, /* str=1 */
- { 0x0, 1 }, /* str=0 */
- },
-};
-
-/* [i_total_coeff-1][i_total_zeros] */
-const vlc_t x264_total_zeros_2x4_dc[7][8] =
-{
- { /* i_total 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x2, 3 }, /* str=010 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 4 }, /* str=0010 */
- { 0x3, 4 }, /* str=0011 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x0, 5 }, /* str=00000 */
- },
- { /* i_total 2 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 3 }, /* str=001 */
- { 0x4, 3 }, /* str=100 */
- { 0x5, 3 }, /* str=101 */
- { 0x6, 3 }, /* str=110 */
- { 0x7, 3 }, /* str=111 */
- },
- { /* i_total 3 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 2 }, /* str=01 */
- { 0x2, 2 }, /* str=10 */
- { 0x6, 3 }, /* str=110 */
- { 0x7, 3 }, /* str=111 */
- },
- { /* i_total 4 */
- { 0x6, 3 }, /* str=110 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x2, 2 }, /* str=10 */
- { 0x7, 3 }, /* str=111 */
- },
- { /* i_total 5 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x2, 2 }, /* str=10 */
- { 0x3, 2 }, /* str=11 */
- },
- { /* i_total 6 */
- { 0x0, 2 }, /* str=00 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 1 }, /* str=1 */
- },
- { /* i_total 7 */
- { 0x0, 1 }, /* str=0 */
- { 0x1, 1 }, /* str=1 */
- }
-};
-
-/* [MIN( i_zero_left-1, 6 )][run_before] */
-static const vlc_t run_before[7][16] =
-{
- { /* i_zero_left 1 */
- { 0x1, 1 }, /* str=1 */
- { 0x0, 1 }, /* str=0 */
- },
- { /* i_zero_left 2 */
- { 0x1, 1 }, /* str=1 */
- { 0x1, 2 }, /* str=01 */
- { 0x0, 2 }, /* str=00 */
- },
- { /* i_zero_left 3 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 2 }, /* str=01 */
- { 0x0, 2 }, /* str=00 */
- },
- { /* i_zero_left 4 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x1, 2 }, /* str=01 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 3 }, /* str=000 */
- },
- { /* i_zero_left 5 */
- { 0x3, 2 }, /* str=11 */
- { 0x2, 2 }, /* str=10 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 3 }, /* str=001 */
- { 0x0, 3 }, /* str=000 */
- },
- { /* i_zero_left 6 */
- { 0x3, 2 }, /* str=11 */
- { 0x0, 3 }, /* str=000 */
- { 0x1, 3 }, /* str=001 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- },
- { /* i_zero_left >6 */
- { 0x7, 3 }, /* str=111 */
- { 0x6, 3 }, /* str=110 */
- { 0x5, 3 }, /* str=101 */
- { 0x4, 3 }, /* str=100 */
- { 0x3, 3 }, /* str=011 */
- { 0x2, 3 }, /* str=010 */
- { 0x1, 3 }, /* str=001 */
- { 0x1, 4 }, /* str=0001 */
- { 0x1, 5 }, /* str=00001 */
- { 0x1, 6 }, /* str=000001 */
- { 0x1, 7 }, /* str=0000001 */
- { 0x1, 8 }, /* str=00000001 */
- { 0x1, 9 }, /* str=000000001 */
- { 0x1, 10 }, /* str=0000000001 */
- { 0x1, 11 }, /* str=00000000001 */
- },
-};
-
vlc_large_t x264_level_token[7][LEVEL_TABLE_SIZE];
uint32_t x264_run_before[1<<16];
{
int idx = X264_MIN(zeros, 7) - 1;
int run = x264_clz( mask );
- int len = run_before[idx][run].i_size;
+ int len = x264_run_before_init[idx][run].i_size;
size += len;
bits <<= len;
- bits |= run_before[idx][run].i_bits;
+ bits |= x264_run_before_init[idx][run].i_bits;
zeros -= run;
mask <<= run + 1;
}
/* Based on the agreed standing that x264 does not need to utilize >64 logical cpus,
* this API does not detect nor utilize more than 64 cpus for systems that have them. */
-#include "common.h"
+#include "base.h"
#if HAVE_WINRT
/* _beginthreadex() is technically the correct option, but it's only available for Desktop applications.
--- /dev/null
+/*****************************************************************************
+ * bitstream.h: x86 bitstream functions
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_X86_BITSTREAM_H
+#define X264_X86_BITSTREAM_H
+
+#define x264_nal_escape_mmx2 x264_template(nal_escape_mmx2)
+uint8_t *x264_nal_escape_mmx2( uint8_t *dst, uint8_t *src, uint8_t *end );
+#define x264_nal_escape_sse2 x264_template(nal_escape_sse2)
+uint8_t *x264_nal_escape_sse2( uint8_t *dst, uint8_t *src, uint8_t *end );
+#define x264_nal_escape_avx2 x264_template(nal_escape_avx2)
+uint8_t *x264_nal_escape_avx2( uint8_t *dst, uint8_t *src, uint8_t *end );
+#define x264_cabac_block_residual_rd_internal_sse2 x264_template(cabac_block_residual_rd_internal_sse2)
+void x264_cabac_block_residual_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_rd_internal_lzcnt x264_template(cabac_block_residual_rd_internal_lzcnt)
+void x264_cabac_block_residual_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_rd_internal_ssse3 x264_template(cabac_block_residual_rd_internal_ssse3)
+void x264_cabac_block_residual_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_rd_internal_ssse3_lzcnt x264_template(cabac_block_residual_rd_internal_ssse3_lzcnt)
+void x264_cabac_block_residual_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_rd_internal_avx512 x264_template(cabac_block_residual_rd_internal_avx512)
+void x264_cabac_block_residual_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_8x8_rd_internal_sse2 x264_template(cabac_block_residual_8x8_rd_internal_sse2)
+void x264_cabac_block_residual_8x8_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_8x8_rd_internal_lzcnt x264_template(cabac_block_residual_8x8_rd_internal_lzcnt)
+void x264_cabac_block_residual_8x8_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_8x8_rd_internal_ssse3 x264_template(cabac_block_residual_8x8_rd_internal_ssse3)
+void x264_cabac_block_residual_8x8_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_8x8_rd_internal_ssse3_lzcnt x264_template(cabac_block_residual_8x8_rd_internal_ssse3_lzcnt)
+void x264_cabac_block_residual_8x8_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_8x8_rd_internal_avx512 x264_template(cabac_block_residual_8x8_rd_internal_avx512)
+void x264_cabac_block_residual_8x8_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_internal_sse2 x264_template(cabac_block_residual_internal_sse2)
+void x264_cabac_block_residual_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_internal_lzcnt x264_template(cabac_block_residual_internal_lzcnt)
+void x264_cabac_block_residual_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_internal_avx2 x264_template(cabac_block_residual_internal_avx2)
+void x264_cabac_block_residual_internal_avx2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+#define x264_cabac_block_residual_internal_avx512 x264_template(cabac_block_residual_internal_avx512)
+void x264_cabac_block_residual_internal_avx512( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb );
+
+#endif
SECTION .text
-cextern cabac_range_lps
-cextern cabac_transition
-cextern cabac_renorm_shift
-cextern cabac_entropy
+cextern_common cabac_range_lps
+cextern_common cabac_transition
+cextern_common cabac_renorm_shift
+cextern_common cabac_entropy
cextern cabac_size_unary
cextern cabac_transition_unary
-cextern significant_coeff_flag_offset
-cextern significant_coeff_flag_offset_8x8
-cextern last_coeff_flag_offset
-cextern last_coeff_flag_offset_8x8
-cextern coeff_abs_level_m1_offset
-cextern count_cat_m1
+cextern_common significant_coeff_flag_offset
+cextern_common significant_coeff_flag_offset_8x8
+cextern_common last_coeff_flag_offset
+cextern_common last_coeff_flag_offset_8x8
+cextern_common coeff_abs_level_m1_offset
+cextern_common count_cat_m1
cextern cabac_encode_ue_bypass
%if ARCH_X86_64
#ifndef X264_I386_DCT_H
#define X264_I386_DCT_H
+#define x264_sub4x4_dct_mmx x264_template(sub4x4_dct_mmx)
void x264_sub4x4_dct_mmx ( dctcoef dct [16], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct_mmx x264_template(sub8x8_dct_mmx)
void x264_sub8x8_dct_mmx ( dctcoef dct[ 4][16], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct_mmx x264_template(sub16x16_dct_mmx)
void x264_sub16x16_dct_mmx ( dctcoef dct[16][16], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct_sse2 x264_template(sub8x8_dct_sse2)
void x264_sub8x8_dct_sse2 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_sse2 x264_template(sub16x16_dct_sse2)
void x264_sub16x16_dct_sse2 ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub4x4_dct_ssse3 x264_template(sub4x4_dct_ssse3)
void x264_sub4x4_dct_ssse3 ( int16_t dct [16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub4x4_dct_avx512 x264_template(sub4x4_dct_avx512)
void x264_sub4x4_dct_avx512 ( int16_t dct [16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_ssse3 x264_template(sub8x8_dct_ssse3)
void x264_sub8x8_dct_ssse3 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_ssse3 x264_template(sub16x16_dct_ssse3)
void x264_sub16x16_dct_ssse3( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_avx x264_template(sub8x8_dct_avx)
void x264_sub8x8_dct_avx ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_avx x264_template(sub16x16_dct_avx)
void x264_sub16x16_dct_avx ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_xop x264_template(sub8x8_dct_xop)
void x264_sub8x8_dct_xop ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_xop x264_template(sub16x16_dct_xop)
void x264_sub16x16_dct_xop ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_avx2 x264_template(sub8x8_dct_avx2)
void x264_sub8x8_dct_avx2 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_avx512 x264_template(sub8x8_dct_avx512)
void x264_sub8x8_dct_avx512 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_avx2 x264_template(sub16x16_dct_avx2)
void x264_sub16x16_dct_avx2 ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct_avx512 x264_template(sub16x16_dct_avx512)
void x264_sub16x16_dct_avx512( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_dc_mmx2 x264_template(sub8x8_dct_dc_mmx2)
void x264_sub8x8_dct_dc_mmx2 ( int16_t dct [ 4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct_dc_sse2 x264_template(sub8x8_dct_dc_sse2)
void x264_sub8x8_dct_dc_sse2 ( dctcoef dct [ 4], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct_dc_avx512 x264_template(sub8x8_dct_dc_avx512)
void x264_sub8x8_dct_dc_avx512 ( int16_t dct [ 4], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_sse2 x264_template(sub8x16_dct_dc_sse2)
void x264_sub8x16_dct_dc_sse2 ( dctcoef dct [ 8], pixel *pix1, pixel *pix2 );
+#define x264_sub8x16_dct_dc_ssse3 x264_template(sub8x16_dct_dc_ssse3)
void x264_sub8x16_dct_dc_ssse3 ( int16_t dct [ 8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x16_dct_dc_avx x264_template(sub8x16_dct_dc_avx)
void x264_sub8x16_dct_dc_avx ( dctcoef dct [ 8], pixel *pix1, pixel *pix2 );
+#define x264_sub8x16_dct_dc_avx512 x264_template(sub8x16_dct_dc_avx512)
void x264_sub8x16_dct_dc_avx512( int16_t dct [ 8], uint8_t *pix1, uint8_t *pix2 );
+#define x264_add4x4_idct_mmx x264_template(add4x4_idct_mmx)
void x264_add4x4_idct_mmx ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add4x4_idct_sse2 x264_template(add4x4_idct_sse2)
void x264_add4x4_idct_sse2 ( uint16_t *p_dst, int32_t dct [16] );
+#define x264_add4x4_idct_sse4 x264_template(add4x4_idct_sse4)
void x264_add4x4_idct_sse4 ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add4x4_idct_avx x264_template(add4x4_idct_avx)
void x264_add4x4_idct_avx ( pixel *p_dst, dctcoef dct [16] );
+#define x264_add8x8_idct_mmx x264_template(add8x8_idct_mmx)
void x264_add8x8_idct_mmx ( uint8_t *p_dst, int16_t dct[ 4][16] );
+#define x264_add8x8_idct_dc_mmx2 x264_template(add8x8_idct_dc_mmx2)
void x264_add8x8_idct_dc_mmx2 ( uint8_t *p_dst, int16_t dct [ 4] );
+#define x264_add16x16_idct_mmx x264_template(add16x16_idct_mmx)
void x264_add16x16_idct_mmx ( uint8_t *p_dst, int16_t dct[16][16] );
+#define x264_add16x16_idct_dc_mmx2 x264_template(add16x16_idct_dc_mmx2)
void x264_add16x16_idct_dc_mmx2 ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add8x8_idct_sse2 x264_template(add8x8_idct_sse2)
void x264_add8x8_idct_sse2 ( pixel *p_dst, dctcoef dct[ 4][16] );
+#define x264_add8x8_idct_avx x264_template(add8x8_idct_avx)
void x264_add8x8_idct_avx ( pixel *p_dst, dctcoef dct[ 4][16] );
+#define x264_add8x8_idct_avx2 x264_template(add8x8_idct_avx2)
void x264_add8x8_idct_avx2 ( pixel *p_dst, dctcoef dct[ 4][16] );
+#define x264_add8x8_idct_avx512 x264_template(add8x8_idct_avx512)
void x264_add8x8_idct_avx512 ( uint8_t *p_dst, int16_t dct[ 4][16] );
+#define x264_add16x16_idct_sse2 x264_template(add16x16_idct_sse2)
void x264_add16x16_idct_sse2 ( pixel *p_dst, dctcoef dct[16][16] );
+#define x264_add16x16_idct_avx x264_template(add16x16_idct_avx)
void x264_add16x16_idct_avx ( pixel *p_dst, dctcoef dct[16][16] );
+#define x264_add16x16_idct_avx2 x264_template(add16x16_idct_avx2)
void x264_add16x16_idct_avx2 ( pixel *p_dst, dctcoef dct[16][16] );
+#define x264_add8x8_idct_dc_sse2 x264_template(add8x8_idct_dc_sse2)
void x264_add8x8_idct_dc_sse2 ( pixel *p_dst, dctcoef dct [ 4] );
+#define x264_add16x16_idct_dc_sse2 x264_template(add16x16_idct_dc_sse2)
void x264_add16x16_idct_dc_sse2 ( pixel *p_dst, dctcoef dct [16] );
+#define x264_add8x8_idct_dc_ssse3 x264_template(add8x8_idct_dc_ssse3)
void x264_add8x8_idct_dc_ssse3 ( uint8_t *p_dst, int16_t dct [ 4] );
+#define x264_add16x16_idct_dc_ssse3 x264_template(add16x16_idct_dc_ssse3)
void x264_add16x16_idct_dc_ssse3( uint8_t *p_dst, int16_t dct [16] );
+#define x264_add8x8_idct_dc_avx x264_template(add8x8_idct_dc_avx)
void x264_add8x8_idct_dc_avx ( pixel *p_dst, dctcoef dct [ 4] );
+#define x264_add16x16_idct_dc_avx x264_template(add16x16_idct_dc_avx)
void x264_add16x16_idct_dc_avx ( pixel *p_dst, dctcoef dct [16] );
+#define x264_add16x16_idct_dc_avx2 x264_template(add16x16_idct_dc_avx2)
void x264_add16x16_idct_dc_avx2 ( uint8_t *p_dst, int16_t dct [16] );
+#define x264_dct4x4dc_mmx2 x264_template(dct4x4dc_mmx2)
void x264_dct4x4dc_mmx2 ( int16_t d[16] );
+#define x264_dct4x4dc_sse2 x264_template(dct4x4dc_sse2)
void x264_dct4x4dc_sse2 ( int32_t d[16] );
+#define x264_dct4x4dc_avx x264_template(dct4x4dc_avx)
void x264_dct4x4dc_avx ( int32_t d[16] );
+#define x264_idct4x4dc_mmx x264_template(idct4x4dc_mmx)
void x264_idct4x4dc_mmx ( int16_t d[16] );
+#define x264_idct4x4dc_sse2 x264_template(idct4x4dc_sse2)
void x264_idct4x4dc_sse2 ( int32_t d[16] );
+#define x264_idct4x4dc_avx x264_template(idct4x4dc_avx)
void x264_idct4x4dc_avx ( int32_t d[16] );
+#define x264_dct2x4dc_mmx2 x264_template(dct2x4dc_mmx2)
void x264_dct2x4dc_mmx2( dctcoef dct[8], dctcoef dct4x4[8][16] );
+#define x264_dct2x4dc_sse2 x264_template(dct2x4dc_sse2)
void x264_dct2x4dc_sse2( dctcoef dct[8], dctcoef dct4x4[8][16] );
+#define x264_dct2x4dc_avx x264_template(dct2x4dc_avx)
void x264_dct2x4dc_avx ( dctcoef dct[8], dctcoef dct4x4[8][16] );
+#define x264_sub8x8_dct8_mmx x264_template(sub8x8_dct8_mmx)
void x264_sub8x8_dct8_mmx ( int16_t dct [64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_mmx x264_template(sub16x16_dct8_mmx)
void x264_sub16x16_dct8_mmx ( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_sse2 x264_template(sub8x8_dct8_sse2)
void x264_sub8x8_dct8_sse2 ( dctcoef dct [64], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct8_sse2 x264_template(sub16x16_dct8_sse2)
void x264_sub16x16_dct8_sse2 ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
+#define x264_sub8x8_dct8_ssse3 x264_template(sub8x8_dct8_ssse3)
void x264_sub8x8_dct8_ssse3 ( int16_t dct [64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub16x16_dct8_ssse3 x264_template(sub16x16_dct8_ssse3)
void x264_sub16x16_dct8_ssse3( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 );
+#define x264_sub8x8_dct8_sse4 x264_template(sub8x8_dct8_sse4)
void x264_sub8x8_dct8_sse4 ( int32_t dct [64], uint16_t *pix1, uint16_t *pix2 );
+#define x264_sub16x16_dct8_sse4 x264_template(sub16x16_dct8_sse4)
void x264_sub16x16_dct8_sse4 ( int32_t dct[4][64], uint16_t *pix1, uint16_t *pix2 );
+#define x264_sub8x8_dct8_avx x264_template(sub8x8_dct8_avx)
void x264_sub8x8_dct8_avx ( dctcoef dct [64], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct8_avx x264_template(sub16x16_dct8_avx)
void x264_sub16x16_dct8_avx ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
+#define x264_sub16x16_dct8_avx2 x264_template(sub16x16_dct8_avx2)
void x264_sub16x16_dct8_avx2 ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
+#define x264_add8x8_idct8_mmx x264_template(add8x8_idct8_mmx)
void x264_add8x8_idct8_mmx ( uint8_t *dst, int16_t dct [64] );
+#define x264_add16x16_idct8_mmx x264_template(add16x16_idct8_mmx)
void x264_add16x16_idct8_mmx ( uint8_t *dst, int16_t dct[4][64] );
+#define x264_add8x8_idct8_sse2 x264_template(add8x8_idct8_sse2)
void x264_add8x8_idct8_sse2 ( pixel *dst, dctcoef dct [64] );
+#define x264_add16x16_idct8_sse2 x264_template(add16x16_idct8_sse2)
void x264_add16x16_idct8_sse2( pixel *dst, dctcoef dct[4][64] );
+#define x264_add8x8_idct8_avx x264_template(add8x8_idct8_avx)
void x264_add8x8_idct8_avx ( pixel *dst, dctcoef dct [64] );
+#define x264_add16x16_idct8_avx x264_template(add16x16_idct8_avx)
void x264_add16x16_idct8_avx ( pixel *dst, dctcoef dct[4][64] );
+#define x264_zigzag_scan_8x8_frame_mmx2 x264_template(zigzag_scan_8x8_frame_mmx2)
void x264_zigzag_scan_8x8_frame_mmx2 ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_frame_sse2 x264_template(zigzag_scan_8x8_frame_sse2)
void x264_zigzag_scan_8x8_frame_sse2 ( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_scan_8x8_frame_ssse3 x264_template(zigzag_scan_8x8_frame_ssse3)
void x264_zigzag_scan_8x8_frame_ssse3 ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_frame_avx x264_template(zigzag_scan_8x8_frame_avx)
void x264_zigzag_scan_8x8_frame_avx ( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_scan_8x8_frame_xop x264_template(zigzag_scan_8x8_frame_xop)
void x264_zigzag_scan_8x8_frame_xop ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_frame_avx512 x264_template(zigzag_scan_8x8_frame_avx512)
void x264_zigzag_scan_8x8_frame_avx512( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_scan_4x4_frame_mmx x264_template(zigzag_scan_4x4_frame_mmx)
void x264_zigzag_scan_4x4_frame_mmx ( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_frame_sse2 x264_template(zigzag_scan_4x4_frame_sse2)
void x264_zigzag_scan_4x4_frame_sse2 ( int32_t level[16], int32_t dct[16] );
+#define x264_zigzag_scan_4x4_frame_ssse3 x264_template(zigzag_scan_4x4_frame_ssse3)
void x264_zigzag_scan_4x4_frame_ssse3 ( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_frame_avx x264_template(zigzag_scan_4x4_frame_avx)
void x264_zigzag_scan_4x4_frame_avx ( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_4x4_frame_xop x264_template(zigzag_scan_4x4_frame_xop)
void x264_zigzag_scan_4x4_frame_xop ( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_4x4_frame_avx512 x264_template(zigzag_scan_4x4_frame_avx512)
void x264_zigzag_scan_4x4_frame_avx512( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_4x4_field_sse x264_template(zigzag_scan_4x4_field_sse)
void x264_zigzag_scan_4x4_field_sse ( int16_t level[16], int16_t dct[16] );
+#define x264_zigzag_scan_4x4_field_sse2 x264_template(zigzag_scan_4x4_field_sse2)
void x264_zigzag_scan_4x4_field_sse2 ( int32_t level[16], int32_t dct[16] );
+#define x264_zigzag_scan_4x4_field_avx512 x264_template(zigzag_scan_4x4_field_avx512)
void x264_zigzag_scan_4x4_field_avx512( dctcoef level[16], dctcoef dct[16] );
+#define x264_zigzag_scan_8x8_field_mmx2 x264_template(zigzag_scan_8x8_field_mmx2)
void x264_zigzag_scan_8x8_field_mmx2 ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_field_sse4 x264_template(zigzag_scan_8x8_field_sse4)
void x264_zigzag_scan_8x8_field_sse4 ( int32_t level[64], int32_t dct[64] );
+#define x264_zigzag_scan_8x8_field_avx x264_template(zigzag_scan_8x8_field_avx)
void x264_zigzag_scan_8x8_field_avx ( int32_t level[64], int32_t dct[64] );
+#define x264_zigzag_scan_8x8_field_xop x264_template(zigzag_scan_8x8_field_xop)
void x264_zigzag_scan_8x8_field_xop ( int16_t level[64], int16_t dct[64] );
+#define x264_zigzag_scan_8x8_field_avx512 x264_template(zigzag_scan_8x8_field_avx512)
void x264_zigzag_scan_8x8_field_avx512( dctcoef level[64], dctcoef dct[64] );
+#define x264_zigzag_sub_4x4_frame_avx x264_template(zigzag_sub_4x4_frame_avx)
int x264_zigzag_sub_4x4_frame_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4_frame_ssse3 x264_template(zigzag_sub_4x4_frame_ssse3)
int x264_zigzag_sub_4x4_frame_ssse3 ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4ac_frame_avx x264_template(zigzag_sub_4x4ac_frame_avx)
int x264_zigzag_sub_4x4ac_frame_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_sub_4x4ac_frame_ssse3 x264_template(zigzag_sub_4x4ac_frame_ssse3)
int x264_zigzag_sub_4x4ac_frame_ssse3( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_sub_4x4_field_avx x264_template(zigzag_sub_4x4_field_avx)
int x264_zigzag_sub_4x4_field_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4_field_ssse3 x264_template(zigzag_sub_4x4_field_ssse3)
int x264_zigzag_sub_4x4_field_ssse3 ( int16_t level[16], const uint8_t *src, uint8_t *dst );
+#define x264_zigzag_sub_4x4ac_field_avx x264_template(zigzag_sub_4x4ac_field_avx)
int x264_zigzag_sub_4x4ac_field_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_sub_4x4ac_field_ssse3 x264_template(zigzag_sub_4x4ac_field_ssse3)
int x264_zigzag_sub_4x4ac_field_ssse3( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc );
+#define x264_zigzag_interleave_8x8_cavlc_mmx x264_template(zigzag_interleave_8x8_cavlc_mmx)
void x264_zigzag_interleave_8x8_cavlc_mmx ( int16_t *dst, int16_t *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_sse2 x264_template(zigzag_interleave_8x8_cavlc_sse2)
void x264_zigzag_interleave_8x8_cavlc_sse2 ( dctcoef *dst, dctcoef *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_avx x264_template(zigzag_interleave_8x8_cavlc_avx)
void x264_zigzag_interleave_8x8_cavlc_avx ( dctcoef *dst, dctcoef *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_avx2 x264_template(zigzag_interleave_8x8_cavlc_avx2)
void x264_zigzag_interleave_8x8_cavlc_avx2 ( int16_t *dst, int16_t *src, uint8_t *nnz );
+#define x264_zigzag_interleave_8x8_cavlc_avx512 x264_template(zigzag_interleave_8x8_cavlc_avx512)
void x264_zigzag_interleave_8x8_cavlc_avx512( dctcoef *dst, dctcoef *src, uint8_t *nnz );
#endif
--- /dev/null
+/*****************************************************************************
+ * deblock.h: x86 deblocking
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_X86_DEBLOCK_H
+#define X264_X86_DEBLOCK_H
+
+#define x264_deblock_v_luma_sse2 x264_template(deblock_v_luma_sse2)
+void x264_deblock_v_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_luma_avx x264_template(deblock_v_luma_avx)
+void x264_deblock_v_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_sse2 x264_template(deblock_h_luma_sse2)
+void x264_deblock_h_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_avx x264_template(deblock_h_luma_avx)
+void x264_deblock_h_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_chroma_sse2 x264_template(deblock_v_chroma_sse2)
+void x264_deblock_v_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_chroma_avx x264_template(deblock_v_chroma_avx)
+void x264_deblock_v_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_sse2 x264_template(deblock_h_chroma_sse2)
+void x264_deblock_h_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_avx x264_template(deblock_h_chroma_avx)
+void x264_deblock_h_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_mbaff_sse2 x264_template(deblock_h_chroma_mbaff_sse2)
+void x264_deblock_h_chroma_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_mbaff_avx x264_template(deblock_h_chroma_mbaff_avx)
+void x264_deblock_h_chroma_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_422_mmx2 x264_template(deblock_h_chroma_422_mmx2)
+void x264_deblock_h_chroma_422_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_422_sse2 x264_template(deblock_h_chroma_422_sse2)
+void x264_deblock_h_chroma_422_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_422_avx x264_template(deblock_h_chroma_422_avx)
+void x264_deblock_h_chroma_422_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_luma_intra_sse2 x264_template(deblock_v_luma_intra_sse2)
+void x264_deblock_v_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_luma_intra_avx x264_template(deblock_v_luma_intra_avx)
+void x264_deblock_v_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_luma_intra_sse2 x264_template(deblock_h_luma_intra_sse2)
+void x264_deblock_h_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_luma_intra_avx x264_template(deblock_h_luma_intra_avx)
+void x264_deblock_h_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_sse2 x264_template(deblock_v_chroma_intra_sse2)
+void x264_deblock_v_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_avx x264_template(deblock_v_chroma_intra_avx)
+void x264_deblock_v_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_sse2 x264_template(deblock_h_chroma_intra_sse2)
+void x264_deblock_h_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_avx x264_template(deblock_h_chroma_intra_avx)
+void x264_deblock_h_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_422_intra_mmx2 x264_template(deblock_h_chroma_422_intra_mmx2)
+void x264_deblock_h_chroma_422_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_422_intra_sse2 x264_template(deblock_h_chroma_422_intra_sse2)
+void x264_deblock_h_chroma_422_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_422_intra_avx x264_template(deblock_h_chroma_422_intra_avx)
+void x264_deblock_h_chroma_422_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_strength_sse2 x264_template(deblock_strength_sse2)
+void x264_deblock_strength_sse2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+#define x264_deblock_strength_ssse3 x264_template(deblock_strength_ssse3)
+void x264_deblock_strength_ssse3 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+#define x264_deblock_strength_avx x264_template(deblock_strength_avx)
+void x264_deblock_strength_avx ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+#define x264_deblock_strength_avx2 x264_template(deblock_strength_avx2)
+void x264_deblock_strength_avx2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+#define x264_deblock_strength_avx512 x264_template(deblock_strength_avx512)
+void x264_deblock_strength_avx512( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE],
+ int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4],
+ int mvy_limit, int bframe );
+
+#define x264_deblock_h_chroma_intra_mbaff_mmx2 x264_template(deblock_h_chroma_intra_mbaff_mmx2)
+void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_mbaff_sse2 x264_template(deblock_h_chroma_intra_mbaff_sse2)
+void x264_deblock_h_chroma_intra_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_mbaff_avx x264_template(deblock_h_chroma_intra_mbaff_avx)
+void x264_deblock_h_chroma_intra_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta );
+#if ARCH_X86
+#define x264_deblock_h_luma_mmx2 x264_template(deblock_h_luma_mmx2)
+void x264_deblock_h_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v8_luma_mmx2 x264_template(deblock_v8_luma_mmx2)
+void x264_deblock_v8_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_v_chroma_mmx2 x264_template(deblock_v_chroma_mmx2)
+void x264_deblock_v_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_mmx2 x264_template(deblock_h_chroma_mmx2)
+void x264_deblock_h_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_chroma_mbaff_mmx2 x264_template(deblock_h_chroma_mbaff_mmx2)
+void x264_deblock_h_chroma_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+#define x264_deblock_h_luma_intra_mmx2 x264_template(deblock_h_luma_intra_mmx2)
+void x264_deblock_h_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v8_luma_intra_mmx2 x264_template(deblock_v8_luma_intra_mmx2)
+void x264_deblock_v8_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_mmx2 x264_template(deblock_v_chroma_intra_mmx2)
+void x264_deblock_v_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_h_chroma_intra_mmx2 x264_template(deblock_h_chroma_intra_mmx2)
+void x264_deblock_h_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+#define x264_deblock_v_chroma_intra_mbaff_mmx2 x264_template(deblock_v_chroma_intra_mbaff_mmx2)
+void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+
+#define x264_deblock_v_luma_mmx2 x264_template(deblock_v_luma_mmx2)
+#define x264_deblock_v_luma_intra_mmx2 x264_template(deblock_v_luma_intra_mmx2)
+#if HIGH_BIT_DEPTH
+void x264_deblock_v_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 );
+void x264_deblock_v_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta );
+#else
+// FIXME this wrapper has a significant cpu cost
+static ALWAYS_INLINE void x264_deblock_v_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
+{
+ x264_deblock_v8_luma_mmx2( pix, stride, alpha, beta, tc0 );
+ x264_deblock_v8_luma_mmx2( pix+8, stride, alpha, beta, tc0+2 );
+}
+static ALWAYS_INLINE void x264_deblock_v_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta )
+{
+ x264_deblock_v8_luma_intra_mmx2( pix, stride, alpha, beta );
+ x264_deblock_v8_luma_intra_mmx2( pix+8, stride, alpha, beta );
+}
+#endif // HIGH_BIT_DEPTH
+#endif
+
+#endif
#include "common/common.h"
#include "mc.h"
+#define x264_pixel_avg_16x16_avx2 x264_template(pixel_avg_16x16_avx2)
+#define x264_pixel_avg_16x16_avx512 x264_template(pixel_avg_16x16_avx512)
+#define x264_pixel_avg_16x16_mmx2 x264_template(pixel_avg_16x16_mmx2)
+#define x264_pixel_avg_16x16_sse2 x264_template(pixel_avg_16x16_sse2)
+#define x264_pixel_avg_16x16_ssse3 x264_template(pixel_avg_16x16_ssse3)
+#define x264_pixel_avg_16x8_avx2 x264_template(pixel_avg_16x8_avx2)
+#define x264_pixel_avg_16x8_avx512 x264_template(pixel_avg_16x8_avx512)
+#define x264_pixel_avg_16x8_mmx2 x264_template(pixel_avg_16x8_mmx2)
+#define x264_pixel_avg_16x8_sse2 x264_template(pixel_avg_16x8_sse2)
+#define x264_pixel_avg_16x8_ssse3 x264_template(pixel_avg_16x8_ssse3)
+#define x264_pixel_avg_4x16_mmx2 x264_template(pixel_avg_4x16_mmx2)
+#define x264_pixel_avg_4x16_sse2 x264_template(pixel_avg_4x16_sse2)
+#define x264_pixel_avg_4x16_ssse3 x264_template(pixel_avg_4x16_ssse3)
+#define x264_pixel_avg_4x2_mmx2 x264_template(pixel_avg_4x2_mmx2)
+#define x264_pixel_avg_4x2_sse2 x264_template(pixel_avg_4x2_sse2)
+#define x264_pixel_avg_4x2_ssse3 x264_template(pixel_avg_4x2_ssse3)
+#define x264_pixel_avg_4x4_mmx2 x264_template(pixel_avg_4x4_mmx2)
+#define x264_pixel_avg_4x4_sse2 x264_template(pixel_avg_4x4_sse2)
+#define x264_pixel_avg_4x4_ssse3 x264_template(pixel_avg_4x4_ssse3)
+#define x264_pixel_avg_4x8_mmx2 x264_template(pixel_avg_4x8_mmx2)
+#define x264_pixel_avg_4x8_sse2 x264_template(pixel_avg_4x8_sse2)
+#define x264_pixel_avg_4x8_ssse3 x264_template(pixel_avg_4x8_ssse3)
+#define x264_pixel_avg_8x16_avx512 x264_template(pixel_avg_8x16_avx512)
+#define x264_pixel_avg_8x16_mmx2 x264_template(pixel_avg_8x16_mmx2)
+#define x264_pixel_avg_8x16_sse2 x264_template(pixel_avg_8x16_sse2)
+#define x264_pixel_avg_8x16_ssse3 x264_template(pixel_avg_8x16_ssse3)
+#define x264_pixel_avg_8x4_avx512 x264_template(pixel_avg_8x4_avx512)
+#define x264_pixel_avg_8x4_mmx2 x264_template(pixel_avg_8x4_mmx2)
+#define x264_pixel_avg_8x4_sse2 x264_template(pixel_avg_8x4_sse2)
+#define x264_pixel_avg_8x4_ssse3 x264_template(pixel_avg_8x4_ssse3)
+#define x264_pixel_avg_8x8_avx512 x264_template(pixel_avg_8x8_avx512)
+#define x264_pixel_avg_8x8_mmx2 x264_template(pixel_avg_8x8_mmx2)
+#define x264_pixel_avg_8x8_sse2 x264_template(pixel_avg_8x8_sse2)
+#define x264_pixel_avg_8x8_ssse3 x264_template(pixel_avg_8x8_ssse3)
#define DECL_SUF( func, args )\
void func##_mmx2 args;\
void func##_sse2 args;\
DECL_SUF( x264_pixel_avg_4x4, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int ))
DECL_SUF( x264_pixel_avg_4x2, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int ))
+#define x264_mc_weight_w12_mmx2 x264_template(mc_weight_w12_mmx2)
+#define x264_mc_weight_w12_sse2 x264_template(mc_weight_w12_sse2)
+#define x264_mc_weight_w16_avx2 x264_template(mc_weight_w16_avx2)
+#define x264_mc_weight_w16_mmx2 x264_template(mc_weight_w16_mmx2)
+#define x264_mc_weight_w16_sse2 x264_template(mc_weight_w16_sse2)
+#define x264_mc_weight_w16_ssse3 x264_template(mc_weight_w16_ssse3)
+#define x264_mc_weight_w20_avx2 x264_template(mc_weight_w20_avx2)
+#define x264_mc_weight_w20_mmx2 x264_template(mc_weight_w20_mmx2)
+#define x264_mc_weight_w20_sse2 x264_template(mc_weight_w20_sse2)
+#define x264_mc_weight_w20_ssse3 x264_template(mc_weight_w20_ssse3)
+#define x264_mc_weight_w4_mmx2 x264_template(mc_weight_w4_mmx2)
+#define x264_mc_weight_w4_ssse3 x264_template(mc_weight_w4_ssse3)
+#define x264_mc_weight_w8_avx2 x264_template(mc_weight_w8_avx2)
+#define x264_mc_weight_w8_mmx2 x264_template(mc_weight_w8_mmx2)
+#define x264_mc_weight_w8_sse2 x264_template(mc_weight_w8_sse2)
+#define x264_mc_weight_w8_ssse3 x264_template(mc_weight_w8_ssse3)
#define MC_WEIGHT(w,type) \
void x264_mc_weight_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int );
+#define x264_mc_offsetadd_w12_mmx2 x264_template(mc_offsetadd_w12_mmx2)
+#define x264_mc_offsetadd_w16_mmx2 x264_template(mc_offsetadd_w16_mmx2)
+#define x264_mc_offsetadd_w16_sse2 x264_template(mc_offsetadd_w16_sse2)
+#define x264_mc_offsetadd_w20_mmx2 x264_template(mc_offsetadd_w20_mmx2)
+#define x264_mc_offsetadd_w20_sse2 x264_template(mc_offsetadd_w20_sse2)
+#define x264_mc_offsetadd_w4_mmx2 x264_template(mc_offsetadd_w4_mmx2)
+#define x264_mc_offsetadd_w8_mmx2 x264_template(mc_offsetadd_w8_mmx2)
+#define x264_mc_offsetadd_w8_sse2 x264_template(mc_offsetadd_w8_sse2)
+#define x264_mc_offsetsub_w12_mmx2 x264_template(mc_offsetsub_w12_mmx2)
+#define x264_mc_offsetsub_w16_mmx2 x264_template(mc_offsetsub_w16_mmx2)
+#define x264_mc_offsetsub_w16_sse2 x264_template(mc_offsetsub_w16_sse2)
+#define x264_mc_offsetsub_w20_mmx2 x264_template(mc_offsetsub_w20_mmx2)
+#define x264_mc_offsetsub_w20_sse2 x264_template(mc_offsetsub_w20_sse2)
+#define x264_mc_offsetsub_w4_mmx2 x264_template(mc_offsetsub_w4_mmx2)
+#define x264_mc_offsetsub_w8_mmx2 x264_template(mc_offsetsub_w8_mmx2)
+#define x264_mc_offsetsub_w8_sse2 x264_template(mc_offsetsub_w8_sse2)
#define MC_WEIGHT_OFFSET(w,type) \
void x264_mc_offsetadd_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); \
void x264_mc_offsetsub_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); \
#undef MC_OFFSET
#undef MC_WEIGHT
+#define x264_mc_copy_w4_mmx x264_template(mc_copy_w4_mmx)
void x264_mc_copy_w4_mmx ( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w8_mmx x264_template(mc_copy_w8_mmx)
void x264_mc_copy_w8_mmx ( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w8_sse x264_template(mc_copy_w8_sse)
void x264_mc_copy_w8_sse ( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_mmx x264_template(mc_copy_w16_mmx)
void x264_mc_copy_w16_mmx( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_sse x264_template(mc_copy_w16_sse)
void x264_mc_copy_w16_sse( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_aligned_sse x264_template(mc_copy_w16_aligned_sse)
void x264_mc_copy_w16_aligned_sse( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_mc_copy_w16_avx x264_template(mc_copy_w16_avx)
void x264_mc_copy_w16_avx( uint16_t *, intptr_t, uint16_t *, intptr_t, int );
+#define x264_mc_copy_w16_aligned_avx x264_template(mc_copy_w16_aligned_avx)
void x264_mc_copy_w16_aligned_avx( uint16_t *, intptr_t, uint16_t *, intptr_t, int );
+#define x264_prefetch_fenc_420_mmx2 x264_template(prefetch_fenc_420_mmx2)
void x264_prefetch_fenc_420_mmx2( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_prefetch_fenc_422_mmx2 x264_template(prefetch_fenc_422_mmx2)
void x264_prefetch_fenc_422_mmx2( pixel *, intptr_t, pixel *, intptr_t, int );
+#define x264_prefetch_ref_mmx2 x264_template(prefetch_ref_mmx2)
void x264_prefetch_ref_mmx2( pixel *, intptr_t, int );
+#define x264_plane_copy_core_sse x264_template(plane_copy_core_sse)
void x264_plane_copy_core_sse( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_core_avx x264_template(plane_copy_core_avx)
void x264_plane_copy_core_avx( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_swap_core_ssse3 x264_template(plane_copy_swap_core_ssse3)
void x264_plane_copy_swap_core_ssse3( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_swap_core_avx2 x264_template(plane_copy_swap_core_avx2)
void x264_plane_copy_swap_core_avx2 ( pixel *, intptr_t, pixel *, intptr_t, int w, int h );
+#define x264_plane_copy_interleave_core_mmx2 x264_template(plane_copy_interleave_core_mmx2)
void x264_plane_copy_interleave_core_mmx2( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_interleave_core_sse2 x264_template(plane_copy_interleave_core_sse2)
void x264_plane_copy_interleave_core_sse2( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_interleave_core_avx x264_template(plane_copy_interleave_core_avx)
void x264_plane_copy_interleave_core_avx( pixel *dst, intptr_t i_dst,
pixel *srcu, intptr_t i_srcu,
pixel *srcv, intptr_t i_srcv, int w, int h );
+#define x264_plane_copy_deinterleave_sse2 x264_template(plane_copy_deinterleave_sse2)
void x264_plane_copy_deinterleave_sse2( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_ssse3 x264_template(plane_copy_deinterleave_ssse3)
void x264_plane_copy_deinterleave_ssse3( uint8_t *dsta, intptr_t i_dsta,
uint8_t *dstb, intptr_t i_dstb,
uint8_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_avx x264_template(plane_copy_deinterleave_avx)
void x264_plane_copy_deinterleave_avx( uint16_t *dsta, intptr_t i_dsta,
uint16_t *dstb, intptr_t i_dstb,
uint16_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_avx2 x264_template(plane_copy_deinterleave_avx2)
void x264_plane_copy_deinterleave_avx2( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_sse2 x264_template(plane_copy_deinterleave_rgb_sse2)
void x264_plane_copy_deinterleave_rgb_sse2 ( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_ssse3 x264_template(plane_copy_deinterleave_rgb_ssse3)
void x264_plane_copy_deinterleave_rgb_ssse3( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_deinterleave_rgb_avx2 x264_template(plane_copy_deinterleave_rgb_avx2)
void x264_plane_copy_deinterleave_rgb_avx2 ( pixel *dsta, intptr_t i_dsta,
pixel *dstb, intptr_t i_dstb,
pixel *dstc, intptr_t i_dstc,
pixel *src, intptr_t i_src, int pw, int w, int h );
+#define x264_plane_copy_deinterleave_v210_ssse3 x264_template(plane_copy_deinterleave_v210_ssse3)
void x264_plane_copy_deinterleave_v210_ssse3 ( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_v210_avx x264_template(plane_copy_deinterleave_v210_avx)
void x264_plane_copy_deinterleave_v210_avx ( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_v210_avx2 x264_template(plane_copy_deinterleave_v210_avx2)
void x264_plane_copy_deinterleave_v210_avx2 ( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_plane_copy_deinterleave_v210_avx512 x264_template(plane_copy_deinterleave_v210_avx512)
void x264_plane_copy_deinterleave_v210_avx512( uint16_t *dstu, intptr_t i_dstu,
uint16_t *dstv, intptr_t i_dstv,
uint32_t *src, intptr_t i_src, int w, int h );
+#define x264_store_interleave_chroma_mmx2 x264_template(store_interleave_chroma_mmx2)
void x264_store_interleave_chroma_mmx2( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_store_interleave_chroma_sse2 x264_template(store_interleave_chroma_sse2)
void x264_store_interleave_chroma_sse2( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_store_interleave_chroma_avx x264_template(store_interleave_chroma_avx)
void x264_store_interleave_chroma_avx ( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height );
+#define x264_load_deinterleave_chroma_fenc_sse2 x264_template(load_deinterleave_chroma_fenc_sse2)
void x264_load_deinterleave_chroma_fenc_sse2( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_ssse3 x264_template(load_deinterleave_chroma_fenc_ssse3)
void x264_load_deinterleave_chroma_fenc_ssse3( uint8_t *dst, uint8_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_avx x264_template(load_deinterleave_chroma_fenc_avx)
void x264_load_deinterleave_chroma_fenc_avx( uint16_t *dst, uint16_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fenc_avx2 x264_template(load_deinterleave_chroma_fenc_avx2)
void x264_load_deinterleave_chroma_fenc_avx2( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_sse2 x264_template(load_deinterleave_chroma_fdec_sse2)
void x264_load_deinterleave_chroma_fdec_sse2( pixel *dst, pixel *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_ssse3 x264_template(load_deinterleave_chroma_fdec_ssse3)
void x264_load_deinterleave_chroma_fdec_ssse3( uint8_t *dst, uint8_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_avx x264_template(load_deinterleave_chroma_fdec_avx)
void x264_load_deinterleave_chroma_fdec_avx( uint16_t *dst, uint16_t *src, intptr_t i_src, int height );
+#define x264_load_deinterleave_chroma_fdec_avx2 x264_template(load_deinterleave_chroma_fdec_avx2)
void x264_load_deinterleave_chroma_fdec_avx2( uint16_t *dst, uint16_t *src, intptr_t i_src, int height );
+#define x264_memcpy_aligned_sse x264_template(memcpy_aligned_sse)
void *x264_memcpy_aligned_sse ( void *dst, const void *src, size_t n );
+#define x264_memcpy_aligned_avx x264_template(memcpy_aligned_avx)
void *x264_memcpy_aligned_avx ( void *dst, const void *src, size_t n );
+#define x264_memcpy_aligned_avx512 x264_template(memcpy_aligned_avx512)
void *x264_memcpy_aligned_avx512( void *dst, const void *src, size_t n );
+#define x264_memzero_aligned_sse x264_template(memzero_aligned_sse)
void x264_memzero_aligned_sse ( void *dst, size_t n );
+#define x264_memzero_aligned_avx x264_template(memzero_aligned_avx)
void x264_memzero_aligned_avx ( void *dst, size_t n );
+#define x264_memzero_aligned_avx512 x264_template(memzero_aligned_avx512)
void x264_memzero_aligned_avx512( void *dst, size_t n );
+#define x264_integral_init4h_sse4 x264_template(integral_init4h_sse4)
void x264_integral_init4h_sse4( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init4h_avx2 x264_template(integral_init4h_avx2)
void x264_integral_init4h_avx2( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init8h_sse4 x264_template(integral_init8h_sse4)
void x264_integral_init8h_sse4( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init8h_avx x264_template(integral_init8h_avx)
void x264_integral_init8h_avx ( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init8h_avx2 x264_template(integral_init8h_avx2)
void x264_integral_init8h_avx2( uint16_t *sum, uint8_t *pix, intptr_t stride );
+#define x264_integral_init4v_mmx x264_template(integral_init4v_mmx)
void x264_integral_init4v_mmx ( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init4v_sse2 x264_template(integral_init4v_sse2)
void x264_integral_init4v_sse2 ( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init4v_ssse3 x264_template(integral_init4v_ssse3)
void x264_integral_init4v_ssse3( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init4v_avx2 x264_template(integral_init4v_avx2)
void x264_integral_init4v_avx2( uint16_t *sum8, uint16_t *sum4, intptr_t stride );
+#define x264_integral_init8v_mmx x264_template(integral_init8v_mmx)
void x264_integral_init8v_mmx ( uint16_t *sum8, intptr_t stride );
+#define x264_integral_init8v_sse2 x264_template(integral_init8v_sse2)
void x264_integral_init8v_sse2( uint16_t *sum8, intptr_t stride );
+#define x264_integral_init8v_avx2 x264_template(integral_init8v_avx2)
void x264_integral_init8v_avx2( uint16_t *sum8, intptr_t stride );
+#define x264_mbtree_propagate_cost_sse2 x264_template(mbtree_propagate_cost_sse2)
void x264_mbtree_propagate_cost_sse2 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_avx x264_template(mbtree_propagate_cost_avx)
void x264_mbtree_propagate_cost_avx ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_fma4 x264_template(mbtree_propagate_cost_fma4)
void x264_mbtree_propagate_cost_fma4 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_avx2 x264_template(mbtree_propagate_cost_avx2)
void x264_mbtree_propagate_cost_avx2 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_propagate_cost_avx512 x264_template(mbtree_propagate_cost_avx512)
void x264_mbtree_propagate_cost_avx512( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs,
uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len );
+#define x264_mbtree_fix8_pack_ssse3 x264_template(mbtree_fix8_pack_ssse3)
void x264_mbtree_fix8_pack_ssse3( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_pack_avx2 x264_template(mbtree_fix8_pack_avx2)
void x264_mbtree_fix8_pack_avx2 ( uint16_t *dst, float *src, int count );
+#define x264_mbtree_fix8_unpack_ssse3 x264_template(mbtree_fix8_unpack_ssse3)
void x264_mbtree_fix8_unpack_ssse3( float *dst, uint16_t *src, int count );
+#define x264_mbtree_fix8_unpack_avx2 x264_template(mbtree_fix8_unpack_avx2)
void x264_mbtree_fix8_unpack_avx2 ( float *dst, uint16_t *src, int count );
+#define x264_mc_chroma_avx x264_template(mc_chroma_avx)
+#define x264_mc_chroma_avx2 x264_template(mc_chroma_avx2)
+#define x264_mc_chroma_cache64_ssse3 x264_template(mc_chroma_cache64_ssse3)
+#define x264_mc_chroma_mmx2 x264_template(mc_chroma_mmx2)
+#define x264_mc_chroma_sse2 x264_template(mc_chroma_sse2)
+#define x264_mc_chroma_ssse3 x264_template(mc_chroma_ssse3)
#define MC_CHROMA(cpu)\
void x264_mc_chroma_##cpu( pixel *dstu, pixel *dstv, intptr_t i_dst, pixel *src, intptr_t i_src,\
int dx, int dy, int i_width, int i_height );
MC_CHROMA(avx)
MC_CHROMA(avx2)
+#define x264_frame_init_lowres_core_avx x264_template(frame_init_lowres_core_avx)
+#define x264_frame_init_lowres_core_avx2 x264_template(frame_init_lowres_core_avx2)
+#define x264_frame_init_lowres_core_mmx2 x264_template(frame_init_lowres_core_mmx2)
+#define x264_frame_init_lowres_core_cache32_mmx2 x264_template(frame_init_lowres_core_cache32_mmx2)
+#define x264_frame_init_lowres_core_sse2 x264_template(frame_init_lowres_core_sse2)
+#define x264_frame_init_lowres_core_ssse3 x264_template(frame_init_lowres_core_ssse3)
+#define x264_frame_init_lowres_core_xop x264_template(frame_init_lowres_core_xop)
#define LOWRES(cpu)\
void x264_frame_init_lowres_core_##cpu( pixel *src0, pixel *dst0, pixel *dsth, pixel *dstv, pixel *dstc,\
intptr_t src_stride, intptr_t dst_stride, int width, int height );
LOWRES(xop)
LOWRES(avx2)
+#define x264_pixel_avg2_w10_mmx2 x264_template(pixel_avg2_w10_mmx2)
+#define x264_pixel_avg2_w10_sse2 x264_template(pixel_avg2_w10_sse2)
+#define x264_pixel_avg2_w12_cache32_mmx2 x264_template(pixel_avg2_w12_cache32_mmx2)
+#define x264_pixel_avg2_w12_cache64_mmx2 x264_template(pixel_avg2_w12_cache64_mmx2)
+#define x264_pixel_avg2_w12_mmx2 x264_template(pixel_avg2_w12_mmx2)
+#define x264_pixel_avg2_w16_avx2 x264_template(pixel_avg2_w16_avx2)
+#define x264_pixel_avg2_w16_cache32_mmx2 x264_template(pixel_avg2_w16_cache32_mmx2)
+#define x264_pixel_avg2_w16_cache64_mmx2 x264_template(pixel_avg2_w16_cache64_mmx2)
+#define x264_pixel_avg2_w16_cache64_sse2 x264_template(pixel_avg2_w16_cache64_sse2)
+#define x264_pixel_avg2_w16_cache64_ssse3 x264_template(pixel_avg2_w16_cache64_ssse3)
+#define x264_pixel_avg2_w16_mmx2 x264_template(pixel_avg2_w16_mmx2)
+#define x264_pixel_avg2_w16_sse2 x264_template(pixel_avg2_w16_sse2)
+#define x264_pixel_avg2_w18_avx2 x264_template(pixel_avg2_w18_avx2)
+#define x264_pixel_avg2_w18_mmx2 x264_template(pixel_avg2_w18_mmx2)
+#define x264_pixel_avg2_w18_sse2 x264_template(pixel_avg2_w18_sse2)
+#define x264_pixel_avg2_w20_avx2 x264_template(pixel_avg2_w20_avx2)
+#define x264_pixel_avg2_w20_cache32_mmx2 x264_template(pixel_avg2_w20_cache32_mmx2)
+#define x264_pixel_avg2_w20_cache64_mmx2 x264_template(pixel_avg2_w20_cache64_mmx2)
+#define x264_pixel_avg2_w20_cache64_sse2 x264_template(pixel_avg2_w20_cache64_sse2)
+#define x264_pixel_avg2_w20_mmx2 x264_template(pixel_avg2_w20_mmx2)
+#define x264_pixel_avg2_w20_sse2 x264_template(pixel_avg2_w20_sse2)
+#define x264_pixel_avg2_w4_mmx2 x264_template(pixel_avg2_w4_mmx2)
+#define x264_pixel_avg2_w8_cache32_mmx2 x264_template(pixel_avg2_w8_cache32_mmx2)
+#define x264_pixel_avg2_w8_cache64_mmx2 x264_template(pixel_avg2_w8_cache64_mmx2)
+#define x264_pixel_avg2_w8_mmx2 x264_template(pixel_avg2_w8_mmx2)
+#define x264_pixel_avg2_w8_sse2 x264_template(pixel_avg2_w8_sse2)
#define PIXEL_AVG_W(width,cpu)\
void x264_pixel_avg2_w##width##_##cpu( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t );
/* This declares some functions that don't exist, but that isn't a problem. */
#if HIGH_BIT_DEPTH
/* we can replace w12/w20 with w10/w18 as only 9/17 pixels in fact are important */
+#undef x264_pixel_avg2_w12_mmx2
+#undef x264_pixel_avg2_w20_mmx2
+#undef x264_pixel_avg2_w20_sse2
+#undef x264_pixel_avg2_w20_avx2
#define x264_pixel_avg2_w12_mmx2 x264_pixel_avg2_w10_mmx2
#define x264_pixel_avg2_w20_mmx2 x264_pixel_avg2_w18_mmx2
#define x264_pixel_avg2_w12_sse2 x264_pixel_avg2_w10_sse2
GET_REF(cache64_ssse3_atom)
#endif // !HIGH_BIT_DEPTH
+#define x264_hpel_filter_avx x264_template(hpel_filter_avx)
+#define x264_hpel_filter_avx2 x264_template(hpel_filter_avx2)
+#define x264_hpel_filter_c_mmx2 x264_template(hpel_filter_c_mmx2)
+#define x264_hpel_filter_c_sse2 x264_template(hpel_filter_c_sse2)
+#define x264_hpel_filter_c_ssse3 x264_template(hpel_filter_c_ssse3)
+#define x264_hpel_filter_c_avx x264_template(hpel_filter_c_avx)
+#define x264_hpel_filter_c_avx2 x264_template(hpel_filter_c_avx2)
+#define x264_hpel_filter_h_mmx2 x264_template(hpel_filter_h_mmx2)
+#define x264_hpel_filter_h_sse2 x264_template(hpel_filter_h_sse2)
+#define x264_hpel_filter_h_ssse3 x264_template(hpel_filter_h_ssse3)
+#define x264_hpel_filter_h_avx x264_template(hpel_filter_h_avx)
+#define x264_hpel_filter_h_avx2 x264_template(hpel_filter_h_avx2)
+#define x264_hpel_filter_sse2 x264_template(hpel_filter_sse2)
+#define x264_hpel_filter_ssse3 x264_template(hpel_filter_ssse3)
+#define x264_hpel_filter_v_mmx2 x264_template(hpel_filter_v_mmx2)
+#define x264_hpel_filter_v_sse2 x264_template(hpel_filter_v_sse2)
+#define x264_hpel_filter_v_ssse3 x264_template(hpel_filter_v_ssse3)
+#define x264_hpel_filter_v_avx x264_template(hpel_filter_v_avx)
+#define x264_hpel_filter_v_avx2 x264_template(hpel_filter_v_avx2)
#define HPEL(align, cpu, cpuv, cpuc, cpuh)\
void x264_hpel_filter_v_##cpuv( pixel *dst, pixel *src, int16_t *buf, intptr_t stride, intptr_t width);\
void x264_hpel_filter_c_##cpuc( pixel *dst, int16_t *buf, intptr_t width );\
} while( 0 )
#endif
+#define x264_mbtree_propagate_list_internal_ssse3 x264_template(mbtree_propagate_list_internal_ssse3)
PROPAGATE_LIST(ssse3)
+#define x264_mbtree_propagate_list_internal_avx x264_template(mbtree_propagate_list_internal_avx)
PROPAGATE_LIST(avx)
+#define x264_mbtree_propagate_list_internal_avx2 x264_template(mbtree_propagate_list_internal_avx2)
PROPAGATE_LIST(avx2)
#if ARCH_X86_64
+#define x264_mbtree_propagate_list_internal_avx512 x264_template(mbtree_propagate_list_internal_avx512)
void x264_mbtree_propagate_list_internal_avx512( size_t len, uint16_t *ref_costs, int16_t (*mvs)[2], int16_t *propagate_amount,
uint16_t *lowres_costs, int bipred_weight, int mb_y,
int width, int height, int stride, int list_mask );
#ifndef X264_I386_MC_H
#define X264_I386_MC_H
+#define x264_mc_init_mmx x264_template(mc_init_mmx)
void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf );
#endif
SECTION .text
INIT_MMX mmx2
+%if HIGH_BIT_DEPTH == 0
+
%macro LOAD_DIFF_4x8P 1 ; dx
LOAD_DIFF m0, m7, none, [r0+%1], [r2+%1]
LOAD_DIFF m1, m6, none, [r0+%1+r1], [r2+%1+r3]
emms
RET
+%endif ; !HIGH_BIT_DEPTH
; instantiate satds
-%if ARCH_X86_64 == 0
+%if ARCH_X86_64 == 0 && HIGH_BIT_DEPTH == 0
cextern pixel_sa8d_8x8_internal_mmx2
INIT_MMX mmx2
SA8D
#ifndef X264_I386_PIXEL_H
#define X264_I386_PIXEL_H
+#define x264_pixel_ads1_avx x264_template(pixel_ads1_avx)
+#define x264_pixel_ads1_avx2 x264_template(pixel_ads1_avx2)
+#define x264_pixel_ads1_mmx2 x264_template(pixel_ads1_mmx2)
+#define x264_pixel_ads1_sse2 x264_template(pixel_ads1_sse2)
+#define x264_pixel_ads1_ssse3 x264_template(pixel_ads1_ssse3)
+#define x264_pixel_ads2_avx x264_template(pixel_ads2_avx)
+#define x264_pixel_ads2_avx2 x264_template(pixel_ads2_avx2)
+#define x264_pixel_ads2_mmx2 x264_template(pixel_ads2_mmx2)
+#define x264_pixel_ads2_sse2 x264_template(pixel_ads2_sse2)
+#define x264_pixel_ads2_ssse3 x264_template(pixel_ads2_ssse3)
+#define x264_pixel_ads4_avx x264_template(pixel_ads4_avx)
+#define x264_pixel_ads4_avx2 x264_template(pixel_ads4_avx2)
+#define x264_pixel_ads4_mmx2 x264_template(pixel_ads4_mmx2)
+#define x264_pixel_ads4_sse2 x264_template(pixel_ads4_sse2)
+#define x264_pixel_ads4_ssse3 x264_template(pixel_ads4_ssse3)
+#define x264_pixel_hadamard_ac_16x16_avx x264_template(pixel_hadamard_ac_16x16_avx)
+#define x264_pixel_hadamard_ac_16x16_avx2 x264_template(pixel_hadamard_ac_16x16_avx2)
+#define x264_pixel_hadamard_ac_16x16_mmx2 x264_template(pixel_hadamard_ac_16x16_mmx2)
+#define x264_pixel_hadamard_ac_16x16_sse2 x264_template(pixel_hadamard_ac_16x16_sse2)
+#define x264_pixel_hadamard_ac_16x16_sse4 x264_template(pixel_hadamard_ac_16x16_sse4)
+#define x264_pixel_hadamard_ac_16x16_ssse3 x264_template(pixel_hadamard_ac_16x16_ssse3)
+#define x264_pixel_hadamard_ac_16x16_ssse3_atom x264_template(pixel_hadamard_ac_16x16_ssse3_atom)
+#define x264_pixel_hadamard_ac_16x16_xop x264_template(pixel_hadamard_ac_16x16_xop)
+#define x264_pixel_hadamard_ac_16x8_avx x264_template(pixel_hadamard_ac_16x8_avx)
+#define x264_pixel_hadamard_ac_16x8_avx2 x264_template(pixel_hadamard_ac_16x8_avx2)
+#define x264_pixel_hadamard_ac_16x8_mmx2 x264_template(pixel_hadamard_ac_16x8_mmx2)
+#define x264_pixel_hadamard_ac_16x8_sse2 x264_template(pixel_hadamard_ac_16x8_sse2)
+#define x264_pixel_hadamard_ac_16x8_sse4 x264_template(pixel_hadamard_ac_16x8_sse4)
+#define x264_pixel_hadamard_ac_16x8_ssse3 x264_template(pixel_hadamard_ac_16x8_ssse3)
+#define x264_pixel_hadamard_ac_16x8_ssse3_atom x264_template(pixel_hadamard_ac_16x8_ssse3_atom)
+#define x264_pixel_hadamard_ac_16x8_xop x264_template(pixel_hadamard_ac_16x8_xop)
+#define x264_pixel_hadamard_ac_8x16_avx x264_template(pixel_hadamard_ac_8x16_avx)
+#define x264_pixel_hadamard_ac_8x16_mmx2 x264_template(pixel_hadamard_ac_8x16_mmx2)
+#define x264_pixel_hadamard_ac_8x16_sse2 x264_template(pixel_hadamard_ac_8x16_sse2)
+#define x264_pixel_hadamard_ac_8x16_sse4 x264_template(pixel_hadamard_ac_8x16_sse4)
+#define x264_pixel_hadamard_ac_8x16_ssse3 x264_template(pixel_hadamard_ac_8x16_ssse3)
+#define x264_pixel_hadamard_ac_8x16_ssse3_atom x264_template(pixel_hadamard_ac_8x16_ssse3_atom)
+#define x264_pixel_hadamard_ac_8x16_xop x264_template(pixel_hadamard_ac_8x16_xop)
+#define x264_pixel_hadamard_ac_8x8_avx x264_template(pixel_hadamard_ac_8x8_avx)
+#define x264_pixel_hadamard_ac_8x8_mmx2 x264_template(pixel_hadamard_ac_8x8_mmx2)
+#define x264_pixel_hadamard_ac_8x8_sse2 x264_template(pixel_hadamard_ac_8x8_sse2)
+#define x264_pixel_hadamard_ac_8x8_sse4 x264_template(pixel_hadamard_ac_8x8_sse4)
+#define x264_pixel_hadamard_ac_8x8_ssse3 x264_template(pixel_hadamard_ac_8x8_ssse3)
+#define x264_pixel_hadamard_ac_8x8_ssse3_atom x264_template(pixel_hadamard_ac_8x8_ssse3_atom)
+#define x264_pixel_hadamard_ac_8x8_xop x264_template(pixel_hadamard_ac_8x8_xop)
+#define x264_pixel_sa8d_16x16_mmx2 x264_template(pixel_sa8d_16x16_mmx2)
+#define x264_pixel_sa8d_16x16_avx x264_template(pixel_sa8d_16x16_avx)
+#define x264_pixel_sa8d_16x16_sse2 x264_template(pixel_sa8d_16x16_sse2)
+#define x264_pixel_sa8d_16x16_sse4 x264_template(pixel_sa8d_16x16_sse4)
+#define x264_pixel_sa8d_16x16_ssse3 x264_template(pixel_sa8d_16x16_ssse3)
+#define x264_pixel_sa8d_16x16_ssse3_atom x264_template(pixel_sa8d_16x16_ssse3_atom)
+#define x264_pixel_sa8d_16x16_xop x264_template(pixel_sa8d_16x16_xop)
+#define x264_pixel_sa8d_8x8_mmx2 x264_template(pixel_sa8d_8x8_mmx2)
+#define x264_pixel_sa8d_8x8_avx x264_template(pixel_sa8d_8x8_avx)
+#define x264_pixel_sa8d_8x8_avx2 x264_template(pixel_sa8d_8x8_avx2)
+#define x264_pixel_sa8d_8x8_avx512 x264_template(pixel_sa8d_8x8_avx512)
+#define x264_pixel_sa8d_8x8_sse2 x264_template(pixel_sa8d_8x8_sse2)
+#define x264_pixel_sa8d_8x8_sse4 x264_template(pixel_sa8d_8x8_sse4)
+#define x264_pixel_sa8d_8x8_ssse3 x264_template(pixel_sa8d_8x8_ssse3)
+#define x264_pixel_sa8d_8x8_ssse3_atom x264_template(pixel_sa8d_8x8_ssse3_atom)
+#define x264_pixel_sa8d_8x8_xop x264_template(pixel_sa8d_8x8_xop)
+#define x264_pixel_sad_16x16_avx2 x264_template(pixel_sad_16x16_avx2)
+#define x264_pixel_sad_16x16_avx512 x264_template(pixel_sad_16x16_avx512)
+#define x264_pixel_sad_16x16_cache32_mmx2 x264_template(pixel_sad_16x16_cache32_mmx2)
+#define x264_pixel_sad_16x16_cache64_mmx2 x264_template(pixel_sad_16x16_cache64_mmx2)
+#define x264_pixel_sad_16x16_cache64_sse2 x264_template(pixel_sad_16x16_cache64_sse2)
+#define x264_pixel_sad_16x16_cache64_ssse3 x264_template(pixel_sad_16x16_cache64_ssse3)
+#define x264_pixel_sad_16x16_mmx2 x264_template(pixel_sad_16x16_mmx2)
+#define x264_pixel_sad_16x16_sse2 x264_template(pixel_sad_16x16_sse2)
+#define x264_pixel_sad_16x16_sse2_aligned x264_template(pixel_sad_16x16_sse2_aligned)
+#define x264_pixel_sad_16x16_sse3 x264_template(pixel_sad_16x16_sse3)
+#define x264_pixel_sad_16x16_ssse3 x264_template(pixel_sad_16x16_ssse3)
+#define x264_pixel_sad_16x16_ssse3_aligned x264_template(pixel_sad_16x16_ssse3_aligned)
+#define x264_pixel_sad_16x8_avx2 x264_template(pixel_sad_16x8_avx2)
+#define x264_pixel_sad_16x8_avx512 x264_template(pixel_sad_16x8_avx512)
+#define x264_pixel_sad_16x8_cache32_mmx2 x264_template(pixel_sad_16x8_cache32_mmx2)
+#define x264_pixel_sad_16x8_cache64_mmx2 x264_template(pixel_sad_16x8_cache64_mmx2)
+#define x264_pixel_sad_16x8_cache64_sse2 x264_template(pixel_sad_16x8_cache64_sse2)
+#define x264_pixel_sad_16x8_cache64_ssse3 x264_template(pixel_sad_16x8_cache64_ssse3)
+#define x264_pixel_sad_16x8_mmx2 x264_template(pixel_sad_16x8_mmx2)
+#define x264_pixel_sad_16x8_sse2 x264_template(pixel_sad_16x8_sse2)
+#define x264_pixel_sad_16x8_sse2_aligned x264_template(pixel_sad_16x8_sse2_aligned)
+#define x264_pixel_sad_16x8_sse3 x264_template(pixel_sad_16x8_sse3)
+#define x264_pixel_sad_16x8_ssse3 x264_template(pixel_sad_16x8_ssse3)
+#define x264_pixel_sad_16x8_ssse3_aligned x264_template(pixel_sad_16x8_ssse3_aligned)
+#define x264_pixel_sad_4x16_avx512 x264_template(pixel_sad_4x16_avx512)
+#define x264_pixel_sad_4x16_mmx2 x264_template(pixel_sad_4x16_mmx2)
+#define x264_pixel_sad_4x4_avx512 x264_template(pixel_sad_4x4_avx512)
+#define x264_pixel_sad_4x4_mmx2 x264_template(pixel_sad_4x4_mmx2)
+#define x264_pixel_sad_4x4_ssse3 x264_template(pixel_sad_4x4_ssse3)
+#define x264_pixel_sad_4x8_avx512 x264_template(pixel_sad_4x8_avx512)
+#define x264_pixel_sad_4x8_mmx2 x264_template(pixel_sad_4x8_mmx2)
+#define x264_pixel_sad_4x8_ssse3 x264_template(pixel_sad_4x8_ssse3)
+#define x264_pixel_sad_8x16_avx512 x264_template(pixel_sad_8x16_avx512)
+#define x264_pixel_sad_8x16_cache32_mmx2 x264_template(pixel_sad_8x16_cache32_mmx2)
+#define x264_pixel_sad_8x16_cache64_mmx2 x264_template(pixel_sad_8x16_cache64_mmx2)
+#define x264_pixel_sad_8x16_mmx2 x264_template(pixel_sad_8x16_mmx2)
+#define x264_pixel_sad_8x16_sse2 x264_template(pixel_sad_8x16_sse2)
+#define x264_pixel_sad_8x16_sse2_aligned x264_template(pixel_sad_8x16_sse2_aligned)
+#define x264_pixel_sad_8x16_ssse3 x264_template(pixel_sad_8x16_ssse3)
+#define x264_pixel_sad_8x16_ssse3_aligned x264_template(pixel_sad_8x16_ssse3_aligned)
+#define x264_pixel_sad_8x4_avx512 x264_template(pixel_sad_8x4_avx512)
+#define x264_pixel_sad_8x4_cache32_mmx2 x264_template(pixel_sad_8x4_cache32_mmx2)
+#define x264_pixel_sad_8x4_cache64_mmx2 x264_template(pixel_sad_8x4_cache64_mmx2)
+#define x264_pixel_sad_8x4_mmx2 x264_template(pixel_sad_8x4_mmx2)
+#define x264_pixel_sad_8x4_sse2 x264_template(pixel_sad_8x4_sse2)
+#define x264_pixel_sad_8x4_ssse3 x264_template(pixel_sad_8x4_ssse3)
+#define x264_pixel_sad_8x8_avx512 x264_template(pixel_sad_8x8_avx512)
+#define x264_pixel_sad_8x8_cache32_mmx2 x264_template(pixel_sad_8x8_cache32_mmx2)
+#define x264_pixel_sad_8x8_cache64_mmx2 x264_template(pixel_sad_8x8_cache64_mmx2)
+#define x264_pixel_sad_8x8_mmx2 x264_template(pixel_sad_8x8_mmx2)
+#define x264_pixel_sad_8x8_sse2 x264_template(pixel_sad_8x8_sse2)
+#define x264_pixel_sad_8x8_sse2_aligned x264_template(pixel_sad_8x8_sse2_aligned)
+#define x264_pixel_sad_8x8_ssse3 x264_template(pixel_sad_8x8_ssse3)
+#define x264_pixel_sad_8x8_ssse3_aligned x264_template(pixel_sad_8x8_ssse3_aligned)
+#define x264_pixel_sad_x3_16x16_avx x264_template(pixel_sad_x3_16x16_avx)
+#define x264_pixel_sad_x3_16x16_avx2 x264_template(pixel_sad_x3_16x16_avx2)
+#define x264_pixel_sad_x3_16x16_avx512 x264_template(pixel_sad_x3_16x16_avx512)
+#define x264_pixel_sad_x3_16x16_cache32_mmx2 x264_template(pixel_sad_x3_16x16_cache32_mmx2)
+#define x264_pixel_sad_x3_16x16_cache64_mmx2 x264_template(pixel_sad_x3_16x16_cache64_mmx2)
+#define x264_pixel_sad_x3_16x16_cache64_sse2 x264_template(pixel_sad_x3_16x16_cache64_sse2)
+#define x264_pixel_sad_x3_16x16_cache64_ssse3 x264_template(pixel_sad_x3_16x16_cache64_ssse3)
+#define x264_pixel_sad_x3_16x16_mmx2 x264_template(pixel_sad_x3_16x16_mmx2)
+#define x264_pixel_sad_x3_16x16_sse2 x264_template(pixel_sad_x3_16x16_sse2)
+#define x264_pixel_sad_x3_16x16_sse3 x264_template(pixel_sad_x3_16x16_sse3)
+#define x264_pixel_sad_x3_16x16_ssse3 x264_template(pixel_sad_x3_16x16_ssse3)
+#define x264_pixel_sad_x3_16x16_xop x264_template(pixel_sad_x3_16x16_xop)
+#define x264_pixel_sad_x3_16x8_avx x264_template(pixel_sad_x3_16x8_avx)
+#define x264_pixel_sad_x3_16x8_avx2 x264_template(pixel_sad_x3_16x8_avx2)
+#define x264_pixel_sad_x3_16x8_avx512 x264_template(pixel_sad_x3_16x8_avx512)
+#define x264_pixel_sad_x3_16x8_cache32_mmx2 x264_template(pixel_sad_x3_16x8_cache32_mmx2)
+#define x264_pixel_sad_x3_16x8_cache64_mmx2 x264_template(pixel_sad_x3_16x8_cache64_mmx2)
+#define x264_pixel_sad_x3_16x8_cache64_sse2 x264_template(pixel_sad_x3_16x8_cache64_sse2)
+#define x264_pixel_sad_x3_16x8_cache64_ssse3 x264_template(pixel_sad_x3_16x8_cache64_ssse3)
+#define x264_pixel_sad_x3_16x8_mmx2 x264_template(pixel_sad_x3_16x8_mmx2)
+#define x264_pixel_sad_x3_16x8_sse2 x264_template(pixel_sad_x3_16x8_sse2)
+#define x264_pixel_sad_x3_16x8_sse3 x264_template(pixel_sad_x3_16x8_sse3)
+#define x264_pixel_sad_x3_16x8_ssse3 x264_template(pixel_sad_x3_16x8_ssse3)
+#define x264_pixel_sad_x3_16x8_xop x264_template(pixel_sad_x3_16x8_xop)
+#define x264_pixel_sad_x3_4x4_avx512 x264_template(pixel_sad_x3_4x4_avx512)
+#define x264_pixel_sad_x3_4x4_mmx2 x264_template(pixel_sad_x3_4x4_mmx2)
+#define x264_pixel_sad_x3_4x4_ssse3 x264_template(pixel_sad_x3_4x4_ssse3)
+#define x264_pixel_sad_x3_4x8_avx512 x264_template(pixel_sad_x3_4x8_avx512)
+#define x264_pixel_sad_x3_4x8_mmx2 x264_template(pixel_sad_x3_4x8_mmx2)
+#define x264_pixel_sad_x3_4x8_ssse3 x264_template(pixel_sad_x3_4x8_ssse3)
+#define x264_pixel_sad_x3_8x16_avx512 x264_template(pixel_sad_x3_8x16_avx512)
+#define x264_pixel_sad_x3_8x16_cache32_mmx2 x264_template(pixel_sad_x3_8x16_cache32_mmx2)
+#define x264_pixel_sad_x3_8x16_cache64_mmx2 x264_template(pixel_sad_x3_8x16_cache64_mmx2)
+#define x264_pixel_sad_x3_8x16_cache64_sse2 x264_template(pixel_sad_x3_8x16_cache64_sse2)
+#define x264_pixel_sad_x3_8x16_mmx2 x264_template(pixel_sad_x3_8x16_mmx2)
+#define x264_pixel_sad_x3_8x16_sse2 x264_template(pixel_sad_x3_8x16_sse2)
+#define x264_pixel_sad_x3_8x16_ssse3 x264_template(pixel_sad_x3_8x16_ssse3)
+#define x264_pixel_sad_x3_8x16_xop x264_template(pixel_sad_x3_8x16_xop)
+#define x264_pixel_sad_x3_8x4_avx512 x264_template(pixel_sad_x3_8x4_avx512)
+#define x264_pixel_sad_x3_8x4_mmx2 x264_template(pixel_sad_x3_8x4_mmx2)
+#define x264_pixel_sad_x3_8x4_sse2 x264_template(pixel_sad_x3_8x4_sse2)
+#define x264_pixel_sad_x3_8x4_ssse3 x264_template(pixel_sad_x3_8x4_ssse3)
+#define x264_pixel_sad_x3_8x4_xop x264_template(pixel_sad_x3_8x4_xop)
+#define x264_pixel_sad_x3_8x8_avx512 x264_template(pixel_sad_x3_8x8_avx512)
+#define x264_pixel_sad_x3_8x8_cache32_mmx2 x264_template(pixel_sad_x3_8x8_cache32_mmx2)
+#define x264_pixel_sad_x3_8x8_cache64_mmx2 x264_template(pixel_sad_x3_8x8_cache64_mmx2)
+#define x264_pixel_sad_x3_8x8_mmx2 x264_template(pixel_sad_x3_8x8_mmx2)
+#define x264_pixel_sad_x3_8x8_sse2 x264_template(pixel_sad_x3_8x8_sse2)
+#define x264_pixel_sad_x3_8x8_ssse3 x264_template(pixel_sad_x3_8x8_ssse3)
+#define x264_pixel_sad_x3_8x8_xop x264_template(pixel_sad_x3_8x8_xop)
+#define x264_pixel_sad_x4_16x16_avx x264_template(pixel_sad_x4_16x16_avx)
+#define x264_pixel_sad_x4_16x16_avx2 x264_template(pixel_sad_x4_16x16_avx2)
+#define x264_pixel_sad_x4_16x16_avx512 x264_template(pixel_sad_x4_16x16_avx512)
+#define x264_pixel_sad_x4_16x16_cache32_mmx2 x264_template(pixel_sad_x4_16x16_cache32_mmx2)
+#define x264_pixel_sad_x4_16x16_cache64_mmx2 x264_template(pixel_sad_x4_16x16_cache64_mmx2)
+#define x264_pixel_sad_x4_16x16_cache64_sse2 x264_template(pixel_sad_x4_16x16_cache64_sse2)
+#define x264_pixel_sad_x4_16x16_cache64_ssse3 x264_template(pixel_sad_x4_16x16_cache64_ssse3)
+#define x264_pixel_sad_x4_16x16_mmx2 x264_template(pixel_sad_x4_16x16_mmx2)
+#define x264_pixel_sad_x4_16x16_sse2 x264_template(pixel_sad_x4_16x16_sse2)
+#define x264_pixel_sad_x4_16x16_sse3 x264_template(pixel_sad_x4_16x16_sse3)
+#define x264_pixel_sad_x4_16x16_ssse3 x264_template(pixel_sad_x4_16x16_ssse3)
+#define x264_pixel_sad_x4_16x16_xop x264_template(pixel_sad_x4_16x16_xop)
+#define x264_pixel_sad_x4_16x8_avx x264_template(pixel_sad_x4_16x8_avx)
+#define x264_pixel_sad_x4_16x8_avx2 x264_template(pixel_sad_x4_16x8_avx2)
+#define x264_pixel_sad_x4_16x8_avx512 x264_template(pixel_sad_x4_16x8_avx512)
+#define x264_pixel_sad_x4_16x8_cache32_mmx2 x264_template(pixel_sad_x4_16x8_cache32_mmx2)
+#define x264_pixel_sad_x4_16x8_cache64_mmx2 x264_template(pixel_sad_x4_16x8_cache64_mmx2)
+#define x264_pixel_sad_x4_16x8_cache64_sse2 x264_template(pixel_sad_x4_16x8_cache64_sse2)
+#define x264_pixel_sad_x4_16x8_cache64_ssse3 x264_template(pixel_sad_x4_16x8_cache64_ssse3)
+#define x264_pixel_sad_x4_16x8_mmx2 x264_template(pixel_sad_x4_16x8_mmx2)
+#define x264_pixel_sad_x4_16x8_sse2 x264_template(pixel_sad_x4_16x8_sse2)
+#define x264_pixel_sad_x4_16x8_sse3 x264_template(pixel_sad_x4_16x8_sse3)
+#define x264_pixel_sad_x4_16x8_ssse3 x264_template(pixel_sad_x4_16x8_ssse3)
+#define x264_pixel_sad_x4_16x8_xop x264_template(pixel_sad_x4_16x8_xop)
+#define x264_pixel_sad_x4_4x4_avx512 x264_template(pixel_sad_x4_4x4_avx512)
+#define x264_pixel_sad_x4_4x4_mmx2 x264_template(pixel_sad_x4_4x4_mmx2)
+#define x264_pixel_sad_x4_4x4_ssse3 x264_template(pixel_sad_x4_4x4_ssse3)
+#define x264_pixel_sad_x4_4x8_avx512 x264_template(pixel_sad_x4_4x8_avx512)
+#define x264_pixel_sad_x4_4x8_mmx2 x264_template(pixel_sad_x4_4x8_mmx2)
+#define x264_pixel_sad_x4_4x8_ssse3 x264_template(pixel_sad_x4_4x8_ssse3)
+#define x264_pixel_sad_x4_8x16_avx512 x264_template(pixel_sad_x4_8x16_avx512)
+#define x264_pixel_sad_x4_8x16_cache32_mmx2 x264_template(pixel_sad_x4_8x16_cache32_mmx2)
+#define x264_pixel_sad_x4_8x16_cache64_mmx2 x264_template(pixel_sad_x4_8x16_cache64_mmx2)
+#define x264_pixel_sad_x4_8x16_cache64_sse2 x264_template(pixel_sad_x4_8x16_cache64_sse2)
+#define x264_pixel_sad_x4_8x16_mmx2 x264_template(pixel_sad_x4_8x16_mmx2)
+#define x264_pixel_sad_x4_8x16_sse2 x264_template(pixel_sad_x4_8x16_sse2)
+#define x264_pixel_sad_x4_8x16_ssse3 x264_template(pixel_sad_x4_8x16_ssse3)
+#define x264_pixel_sad_x4_8x16_xop x264_template(pixel_sad_x4_8x16_xop)
+#define x264_pixel_sad_x4_8x4_avx512 x264_template(pixel_sad_x4_8x4_avx512)
+#define x264_pixel_sad_x4_8x4_mmx2 x264_template(pixel_sad_x4_8x4_mmx2)
+#define x264_pixel_sad_x4_8x4_sse2 x264_template(pixel_sad_x4_8x4_sse2)
+#define x264_pixel_sad_x4_8x4_ssse3 x264_template(pixel_sad_x4_8x4_ssse3)
+#define x264_pixel_sad_x4_8x4_xop x264_template(pixel_sad_x4_8x4_xop)
+#define x264_pixel_sad_x4_8x8_avx512 x264_template(pixel_sad_x4_8x8_avx512)
+#define x264_pixel_sad_x4_8x8_cache32_mmx2 x264_template(pixel_sad_x4_8x8_cache32_mmx2)
+#define x264_pixel_sad_x4_8x8_cache64_mmx2 x264_template(pixel_sad_x4_8x8_cache64_mmx2)
+#define x264_pixel_sad_x4_8x8_mmx2 x264_template(pixel_sad_x4_8x8_mmx2)
+#define x264_pixel_sad_x4_8x8_sse2 x264_template(pixel_sad_x4_8x8_sse2)
+#define x264_pixel_sad_x4_8x8_ssse3 x264_template(pixel_sad_x4_8x8_ssse3)
+#define x264_pixel_sad_x4_8x8_xop x264_template(pixel_sad_x4_8x8_xop)
+#define x264_pixel_satd_16x16_avx x264_template(pixel_satd_16x16_avx)
+#define x264_pixel_satd_16x16_avx2 x264_template(pixel_satd_16x16_avx2)
+#define x264_pixel_satd_16x16_avx512 x264_template(pixel_satd_16x16_avx512)
+#define x264_pixel_satd_16x16_mmx2 x264_template(pixel_satd_16x16_mmx2)
+#define x264_pixel_satd_16x16_sse2 x264_template(pixel_satd_16x16_sse2)
+#define x264_pixel_satd_16x16_sse4 x264_template(pixel_satd_16x16_sse4)
+#define x264_pixel_satd_16x16_ssse3 x264_template(pixel_satd_16x16_ssse3)
+#define x264_pixel_satd_16x16_ssse3_atom x264_template(pixel_satd_16x16_ssse3_atom)
+#define x264_pixel_satd_16x16_xop x264_template(pixel_satd_16x16_xop)
+#define x264_pixel_satd_16x8_avx x264_template(pixel_satd_16x8_avx)
+#define x264_pixel_satd_16x8_avx2 x264_template(pixel_satd_16x8_avx2)
+#define x264_pixel_satd_16x8_avx512 x264_template(pixel_satd_16x8_avx512)
+#define x264_pixel_satd_16x8_mmx2 x264_template(pixel_satd_16x8_mmx2)
+#define x264_pixel_satd_16x8_sse2 x264_template(pixel_satd_16x8_sse2)
+#define x264_pixel_satd_16x8_sse4 x264_template(pixel_satd_16x8_sse4)
+#define x264_pixel_satd_16x8_ssse3 x264_template(pixel_satd_16x8_ssse3)
+#define x264_pixel_satd_16x8_ssse3_atom x264_template(pixel_satd_16x8_ssse3_atom)
+#define x264_pixel_satd_16x8_xop x264_template(pixel_satd_16x8_xop)
+#define x264_pixel_satd_4x16_avx x264_template(pixel_satd_4x16_avx)
+#define x264_pixel_satd_4x16_avx512 x264_template(pixel_satd_4x16_avx512)
+#define x264_pixel_satd_4x16_mmx2 x264_template(pixel_satd_4x16_mmx2)
+#define x264_pixel_satd_4x16_sse2 x264_template(pixel_satd_4x16_sse2)
+#define x264_pixel_satd_4x16_sse4 x264_template(pixel_satd_4x16_sse4)
+#define x264_pixel_satd_4x16_ssse3 x264_template(pixel_satd_4x16_ssse3)
+#define x264_pixel_satd_4x16_ssse3_atom x264_template(pixel_satd_4x16_ssse3_atom)
+#define x264_pixel_satd_4x4_avx x264_template(pixel_satd_4x4_avx)
+#define x264_pixel_satd_4x4_avx512 x264_template(pixel_satd_4x4_avx512)
+#define x264_pixel_satd_4x4_mmx2 x264_template(pixel_satd_4x4_mmx2)
+#define x264_pixel_satd_4x4_sse4 x264_template(pixel_satd_4x4_sse4)
+#define x264_pixel_satd_4x4_ssse3 x264_template(pixel_satd_4x4_ssse3)
+#define x264_pixel_satd_4x4_xop x264_template(pixel_satd_4x4_xop)
+#define x264_pixel_satd_4x8_avx x264_template(pixel_satd_4x8_avx)
+#define x264_pixel_satd_4x8_avx512 x264_template(pixel_satd_4x8_avx512)
+#define x264_pixel_satd_4x8_mmx2 x264_template(pixel_satd_4x8_mmx2)
+#define x264_pixel_satd_4x8_sse2 x264_template(pixel_satd_4x8_sse2)
+#define x264_pixel_satd_4x8_sse4 x264_template(pixel_satd_4x8_sse4)
+#define x264_pixel_satd_4x8_ssse3 x264_template(pixel_satd_4x8_ssse3)
+#define x264_pixel_satd_4x8_ssse3_atom x264_template(pixel_satd_4x8_ssse3_atom)
+#define x264_pixel_satd_4x8_xop x264_template(pixel_satd_4x8_xop)
+#define x264_pixel_satd_8x16_avx x264_template(pixel_satd_8x16_avx)
+#define x264_pixel_satd_8x16_avx2 x264_template(pixel_satd_8x16_avx2)
+#define x264_pixel_satd_8x16_avx512 x264_template(pixel_satd_8x16_avx512)
+#define x264_pixel_satd_8x16_mmx2 x264_template(pixel_satd_8x16_mmx2)
+#define x264_pixel_satd_8x16_sse2 x264_template(pixel_satd_8x16_sse2)
+#define x264_pixel_satd_8x16_sse4 x264_template(pixel_satd_8x16_sse4)
+#define x264_pixel_satd_8x16_ssse3 x264_template(pixel_satd_8x16_ssse3)
+#define x264_pixel_satd_8x16_ssse3_atom x264_template(pixel_satd_8x16_ssse3_atom)
+#define x264_pixel_satd_8x16_xop x264_template(pixel_satd_8x16_xop)
+#define x264_pixel_satd_8x4_avx x264_template(pixel_satd_8x4_avx)
+#define x264_pixel_satd_8x4_avx512 x264_template(pixel_satd_8x4_avx512)
+#define x264_pixel_satd_8x4_mmx2 x264_template(pixel_satd_8x4_mmx2)
+#define x264_pixel_satd_8x4_sse2 x264_template(pixel_satd_8x4_sse2)
+#define x264_pixel_satd_8x4_sse4 x264_template(pixel_satd_8x4_sse4)
+#define x264_pixel_satd_8x4_ssse3 x264_template(pixel_satd_8x4_ssse3)
+#define x264_pixel_satd_8x4_ssse3_atom x264_template(pixel_satd_8x4_ssse3_atom)
+#define x264_pixel_satd_8x4_xop x264_template(pixel_satd_8x4_xop)
+#define x264_pixel_satd_8x8_avx x264_template(pixel_satd_8x8_avx)
+#define x264_pixel_satd_8x8_avx2 x264_template(pixel_satd_8x8_avx2)
+#define x264_pixel_satd_8x8_avx512 x264_template(pixel_satd_8x8_avx512)
+#define x264_pixel_satd_8x8_mmx2 x264_template(pixel_satd_8x8_mmx2)
+#define x264_pixel_satd_8x8_sse2 x264_template(pixel_satd_8x8_sse2)
+#define x264_pixel_satd_8x8_sse4 x264_template(pixel_satd_8x8_sse4)
+#define x264_pixel_satd_8x8_ssse3 x264_template(pixel_satd_8x8_ssse3)
+#define x264_pixel_satd_8x8_ssse3_atom x264_template(pixel_satd_8x8_ssse3_atom)
+#define x264_pixel_satd_8x8_xop x264_template(pixel_satd_8x8_xop)
+#define x264_pixel_ssd_16x16_avx x264_template(pixel_ssd_16x16_avx)
+#define x264_pixel_ssd_16x16_avx2 x264_template(pixel_ssd_16x16_avx2)
+#define x264_pixel_ssd_16x16_mmx x264_template(pixel_ssd_16x16_mmx)
+#define x264_pixel_ssd_16x16_mmx2 x264_template(pixel_ssd_16x16_mmx2)
+#define x264_pixel_ssd_16x16_sse2 x264_template(pixel_ssd_16x16_sse2)
+#define x264_pixel_ssd_16x16_sse2slow x264_template(pixel_ssd_16x16_sse2slow)
+#define x264_pixel_ssd_16x16_ssse3 x264_template(pixel_ssd_16x16_ssse3)
+#define x264_pixel_ssd_16x16_xop x264_template(pixel_ssd_16x16_xop)
+#define x264_pixel_ssd_16x8_avx x264_template(pixel_ssd_16x8_avx)
+#define x264_pixel_ssd_16x8_avx2 x264_template(pixel_ssd_16x8_avx2)
+#define x264_pixel_ssd_16x8_mmx x264_template(pixel_ssd_16x8_mmx)
+#define x264_pixel_ssd_16x8_mmx2 x264_template(pixel_ssd_16x8_mmx2)
+#define x264_pixel_ssd_16x8_sse2 x264_template(pixel_ssd_16x8_sse2)
+#define x264_pixel_ssd_16x8_sse2slow x264_template(pixel_ssd_16x8_sse2slow)
+#define x264_pixel_ssd_16x8_ssse3 x264_template(pixel_ssd_16x8_ssse3)
+#define x264_pixel_ssd_16x8_xop x264_template(pixel_ssd_16x8_xop)
+#define x264_pixel_ssd_4x16_mmx x264_template(pixel_ssd_4x16_mmx)
+#define x264_pixel_ssd_4x16_mmx2 x264_template(pixel_ssd_4x16_mmx2)
+#define x264_pixel_ssd_4x16_ssse3 x264_template(pixel_ssd_4x16_ssse3)
+#define x264_pixel_ssd_4x4_mmx x264_template(pixel_ssd_4x4_mmx)
+#define x264_pixel_ssd_4x4_mmx2 x264_template(pixel_ssd_4x4_mmx2)
+#define x264_pixel_ssd_4x4_ssse3 x264_template(pixel_ssd_4x4_ssse3)
+#define x264_pixel_ssd_4x8_mmx x264_template(pixel_ssd_4x8_mmx)
+#define x264_pixel_ssd_4x8_mmx2 x264_template(pixel_ssd_4x8_mmx2)
+#define x264_pixel_ssd_4x8_ssse3 x264_template(pixel_ssd_4x8_ssse3)
+#define x264_pixel_ssd_8x16_avx x264_template(pixel_ssd_8x16_avx)
+#define x264_pixel_ssd_8x16_mmx x264_template(pixel_ssd_8x16_mmx)
+#define x264_pixel_ssd_8x16_mmx2 x264_template(pixel_ssd_8x16_mmx2)
+#define x264_pixel_ssd_8x16_sse2 x264_template(pixel_ssd_8x16_sse2)
+#define x264_pixel_ssd_8x16_sse2slow x264_template(pixel_ssd_8x16_sse2slow)
+#define x264_pixel_ssd_8x16_ssse3 x264_template(pixel_ssd_8x16_ssse3)
+#define x264_pixel_ssd_8x16_xop x264_template(pixel_ssd_8x16_xop)
+#define x264_pixel_ssd_8x4_avx x264_template(pixel_ssd_8x4_avx)
+#define x264_pixel_ssd_8x4_mmx x264_template(pixel_ssd_8x4_mmx)
+#define x264_pixel_ssd_8x4_mmx2 x264_template(pixel_ssd_8x4_mmx2)
+#define x264_pixel_ssd_8x4_sse2 x264_template(pixel_ssd_8x4_sse2)
+#define x264_pixel_ssd_8x4_sse2slow x264_template(pixel_ssd_8x4_sse2slow)
+#define x264_pixel_ssd_8x4_ssse3 x264_template(pixel_ssd_8x4_ssse3)
+#define x264_pixel_ssd_8x4_xop x264_template(pixel_ssd_8x4_xop)
+#define x264_pixel_ssd_8x8_avx x264_template(pixel_ssd_8x8_avx)
+#define x264_pixel_ssd_8x8_mmx x264_template(pixel_ssd_8x8_mmx)
+#define x264_pixel_ssd_8x8_mmx2 x264_template(pixel_ssd_8x8_mmx2)
+#define x264_pixel_ssd_8x8_sse2 x264_template(pixel_ssd_8x8_sse2)
+#define x264_pixel_ssd_8x8_sse2slow x264_template(pixel_ssd_8x8_sse2slow)
+#define x264_pixel_ssd_8x8_ssse3 x264_template(pixel_ssd_8x8_ssse3)
+#define x264_pixel_ssd_8x8_xop x264_template(pixel_ssd_8x8_xop)
+#define x264_pixel_var_16x16_avx x264_template(pixel_var_16x16_avx)
+#define x264_pixel_var_16x16_avx2 x264_template(pixel_var_16x16_avx2)
+#define x264_pixel_var_16x16_avx512 x264_template(pixel_var_16x16_avx512)
+#define x264_pixel_var_16x16_sse2 x264_template(pixel_var_16x16_sse2)
+#define x264_pixel_var_8x16_avx x264_template(pixel_var_8x16_avx)
+#define x264_pixel_var_8x16_avx512 x264_template(pixel_var_8x16_avx512)
+#define x264_pixel_var_8x16_sse2 x264_template(pixel_var_8x16_sse2)
+#define x264_pixel_var_8x8_avx x264_template(pixel_var_8x8_avx)
+#define x264_pixel_var_8x8_avx512 x264_template(pixel_var_8x8_avx512)
+#define x264_pixel_var_8x8_sse2 x264_template(pixel_var_8x8_sse2)
#define DECL_PIXELS( ret, name, suffix, args ) \
ret x264_pixel_##name##_16x16_##suffix args;\
ret x264_pixel_##name##_16x8_##suffix args;\
DECL_PIXELS( uint64_t, hadamard_ac, avx2, ( pixel *pix, intptr_t i_stride ))
+#define x264_intra_satd_x3_4x4_mmx2 x264_template(intra_satd_x3_4x4_mmx2)
void x264_intra_satd_x3_4x4_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_ssse3 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_4x4_avx ( pixel *, pixel *, int * );
+#define x264_intra_sad_x3_4x4_mmx2 x264_template(intra_sad_x3_4x4_mmx2)
+void x264_intra_sad_x3_4x4_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_4x4_sse2 x264_template(intra_sad_x3_4x4_sse2)
+void x264_intra_sad_x3_4x4_sse2 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_4x4_ssse3 x264_template(intra_sad_x3_4x4_ssse3)
+void x264_intra_sad_x3_4x4_ssse3 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_4x4_avx x264_template(intra_sad_x3_4x4_avx)
+void x264_intra_sad_x3_4x4_avx ( uint16_t*, uint16_t*, int * );
+#define x264_intra_satd_x3_8x8c_mmx2 x264_template(intra_satd_x3_8x8c_mmx2)
void x264_intra_satd_x3_8x8c_mmx2 ( pixel *, pixel *, int * );
+#define x264_intra_satd_x3_8x8c_ssse3 x264_template(intra_satd_x3_8x8c_ssse3)
void x264_intra_satd_x3_8x8c_ssse3 ( uint8_t *, uint8_t *, int * );
-void x264_intra_sad_x3_8x8c_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8c_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8c_ssse3 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8c_avx2 ( pixel *, pixel *, int * );
+#define x264_intra_sad_x3_8x8c_mmx2 x264_template(intra_sad_x3_8x8c_mmx2)
+void x264_intra_sad_x3_8x8c_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8c_ssse3 x264_template(intra_sad_x3_8x8c_ssse3)
+void x264_intra_sad_x3_8x8c_ssse3 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8c_avx2 x264_template(intra_sad_x3_8x8c_avx2)
+void x264_intra_sad_x3_8x8c_avx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_satd_x3_16x16_mmx2 x264_template(intra_satd_x3_16x16_mmx2)
void x264_intra_satd_x3_16x16_mmx2 ( pixel *, pixel *, int * );
+#define x264_intra_satd_x3_16x16_ssse3 x264_template(intra_satd_x3_16x16_ssse3)
void x264_intra_satd_x3_16x16_ssse3( uint8_t *, uint8_t *, int * );
-void x264_intra_sad_x3_16x16_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_16x16_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_16x16_ssse3 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_16x16_avx2 ( pixel *, pixel *, int * );
+#define x264_intra_sad_x3_16x16_mmx2 x264_template(intra_sad_x3_16x16_mmx2)
+void x264_intra_sad_x3_16x16_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_16x16_sse2 x264_template(intra_sad_x3_16x16_sse2)
+void x264_intra_sad_x3_16x16_sse2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_16x16_ssse3 x264_template(intra_sad_x3_16x16_ssse3)
+void x264_intra_sad_x3_16x16_ssse3 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_16x16_avx2 x264_template(intra_sad_x3_16x16_avx2)
+void x264_intra_sad_x3_16x16_avx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sa8d_x3_8x8_mmx2 x264_template(intra_sa8d_x3_8x8_mmx2)
void x264_intra_sa8d_x3_8x8_mmx2 ( uint8_t *, uint8_t *, int * );
-void x264_intra_sa8d_x3_8x8_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8_mmx2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8_sse2 ( pixel *, pixel *, int * );
-void x264_intra_sad_x3_8x8_ssse3 ( pixel *, pixel *, int * );
+#define x264_intra_sa8d_x3_8x8_sse2 x264_template(intra_sa8d_x3_8x8_sse2)
+void x264_intra_sa8d_x3_8x8_sse2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8_mmx2 x264_template(intra_sad_x3_8x8_mmx2)
+void x264_intra_sad_x3_8x8_mmx2 ( uint8_t *, uint8_t *, int * );
+#define x264_intra_sad_x3_8x8_sse2 x264_template(intra_sad_x3_8x8_sse2)
+void x264_intra_sad_x3_8x8_sse2 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_8x8_ssse3 x264_template(intra_sad_x3_8x8_ssse3)
+void x264_intra_sad_x3_8x8_ssse3 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_sad_x3_8x8_avx2 x264_template(intra_sad_x3_8x8_avx2)
void x264_intra_sad_x3_8x8_avx2 ( uint16_t*, uint16_t*, int * );
+#define x264_intra_satd_x9_4x4_ssse3 x264_template(intra_satd_x9_4x4_ssse3)
int x264_intra_satd_x9_4x4_ssse3( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_satd_x9_4x4_sse4 x264_template(intra_satd_x9_4x4_sse4)
int x264_intra_satd_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_satd_x9_4x4_avx x264_template(intra_satd_x9_4x4_avx)
int x264_intra_satd_x9_4x4_avx ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_satd_x9_4x4_xop x264_template(intra_satd_x9_4x4_xop)
int x264_intra_satd_x9_4x4_xop ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sad_x9_4x4_ssse3 x264_template(intra_sad_x9_4x4_ssse3)
int x264_intra_sad_x9_4x4_ssse3 ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sad_x9_4x4_sse4 x264_template(intra_sad_x9_4x4_sse4)
int x264_intra_sad_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sad_x9_4x4_avx x264_template(intra_sad_x9_4x4_avx)
int x264_intra_sad_x9_4x4_avx ( uint8_t *, uint8_t *, uint16_t * );
+#define x264_intra_sa8d_x9_8x8_ssse3 x264_template(intra_sa8d_x9_8x8_ssse3)
int x264_intra_sa8d_x9_8x8_ssse3( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sa8d_x9_8x8_sse4 x264_template(intra_sa8d_x9_8x8_sse4)
int x264_intra_sa8d_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sa8d_x9_8x8_avx x264_template(intra_sa8d_x9_8x8_avx)
int x264_intra_sa8d_x9_8x8_avx ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_ssse3 x264_template(intra_sad_x9_8x8_ssse3)
int x264_intra_sad_x9_8x8_ssse3 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_sse4 x264_template(intra_sad_x9_8x8_sse4)
int x264_intra_sad_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_avx x264_template(intra_sad_x9_8x8_avx)
int x264_intra_sad_x9_8x8_avx ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_intra_sad_x9_8x8_avx2 x264_template(intra_sad_x9_8x8_avx2)
int x264_intra_sad_x9_8x8_avx2 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * );
+#define x264_pixel_ssd_nv12_core_sse2 x264_template(pixel_ssd_nv12_core_sse2)
void x264_pixel_ssd_nv12_core_sse2( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_nv12_core_avx x264_template(pixel_ssd_nv12_core_avx)
void x264_pixel_ssd_nv12_core_avx ( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_nv12_core_xop x264_template(pixel_ssd_nv12_core_xop)
void x264_pixel_ssd_nv12_core_xop ( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssd_nv12_core_avx2 x264_template(pixel_ssd_nv12_core_avx2)
void x264_pixel_ssd_nv12_core_avx2( pixel *pixuv1, intptr_t stride1,
pixel *pixuv2, intptr_t stride2, int width,
int height, uint64_t *ssd_u, uint64_t *ssd_v );
+#define x264_pixel_ssim_4x4x2_core_mmx2 x264_template(pixel_ssim_4x4x2_core_mmx2)
void x264_pixel_ssim_4x4x2_core_mmx2( const uint8_t *pix1, intptr_t stride1,
const uint8_t *pix2, intptr_t stride2, int sums[2][4] );
+#define x264_pixel_ssim_4x4x2_core_sse2 x264_template(pixel_ssim_4x4x2_core_sse2)
void x264_pixel_ssim_4x4x2_core_sse2( const pixel *pix1, intptr_t stride1,
const pixel *pix2, intptr_t stride2, int sums[2][4] );
+#define x264_pixel_ssim_4x4x2_core_avx x264_template(pixel_ssim_4x4x2_core_avx)
void x264_pixel_ssim_4x4x2_core_avx ( const pixel *pix1, intptr_t stride1,
const pixel *pix2, intptr_t stride2, int sums[2][4] );
+#define x264_pixel_ssim_end4_sse2 x264_template(pixel_ssim_end4_sse2)
float x264_pixel_ssim_end4_sse2( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_ssim_end4_avx x264_template(pixel_ssim_end4_avx)
float x264_pixel_ssim_end4_avx ( int sum0[5][4], int sum1[5][4], int width );
+#define x264_pixel_var2_8x8_sse2 x264_template(pixel_var2_8x8_sse2)
int x264_pixel_var2_8x8_sse2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x8_ssse3 x264_template(pixel_var2_8x8_ssse3)
int x264_pixel_var2_8x8_ssse3 ( uint8_t *fenc, uint8_t *fdec, int ssd[2] );
+#define x264_pixel_var2_8x8_avx2 x264_template(pixel_var2_8x8_avx2)
int x264_pixel_var2_8x8_avx2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x8_avx512 x264_template(pixel_var2_8x8_avx512)
int x264_pixel_var2_8x8_avx512 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_sse2 x264_template(pixel_var2_8x16_sse2)
int x264_pixel_var2_8x16_sse2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_ssse3 x264_template(pixel_var2_8x16_ssse3)
int x264_pixel_var2_8x16_ssse3 ( uint8_t *fenc, uint8_t *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_avx2 x264_template(pixel_var2_8x16_avx2)
int x264_pixel_var2_8x16_avx2 ( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_var2_8x16_avx512 x264_template(pixel_var2_8x16_avx512)
int x264_pixel_var2_8x16_avx512( pixel *fenc, pixel *fdec, int ssd[2] );
+#define x264_pixel_vsad_mmx2 x264_template(pixel_vsad_mmx2)
int x264_pixel_vsad_mmx2 ( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_sse2 x264_template(pixel_vsad_sse2)
int x264_pixel_vsad_sse2 ( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_ssse3 x264_template(pixel_vsad_ssse3)
int x264_pixel_vsad_ssse3( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_xop x264_template(pixel_vsad_xop)
int x264_pixel_vsad_xop ( pixel *src, intptr_t stride, int height );
+#define x264_pixel_vsad_avx2 x264_template(pixel_vsad_avx2)
int x264_pixel_vsad_avx2 ( uint16_t *src, intptr_t stride, int height );
+#define x264_pixel_asd8_sse2 x264_template(pixel_asd8_sse2)
int x264_pixel_asd8_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+#define x264_pixel_asd8_ssse3 x264_template(pixel_asd8_ssse3)
int x264_pixel_asd8_ssse3( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+#define x264_pixel_asd8_xop x264_template(pixel_asd8_xop)
int x264_pixel_asd8_xop ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height );
+#define x264_pixel_sa8d_satd_16x16_sse2 x264_template(pixel_sa8d_satd_16x16_sse2)
uint64_t x264_pixel_sa8d_satd_16x16_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_ssse3 x264_template(pixel_sa8d_satd_16x16_ssse3)
uint64_t x264_pixel_sa8d_satd_16x16_ssse3 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_ssse3_atom x264_template(pixel_sa8d_satd_16x16_ssse3_atom)
uint64_t x264_pixel_sa8d_satd_16x16_ssse3_atom( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_sse4 x264_template(pixel_sa8d_satd_16x16_sse4)
uint64_t x264_pixel_sa8d_satd_16x16_sse4 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_avx x264_template(pixel_sa8d_satd_16x16_avx)
uint64_t x264_pixel_sa8d_satd_16x16_avx ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_xop x264_template(pixel_sa8d_satd_16x16_xop)
uint64_t x264_pixel_sa8d_satd_16x16_xop ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
+#define x264_pixel_sa8d_satd_16x16_avx2 x264_template(pixel_sa8d_satd_16x16_avx2)
uint64_t x264_pixel_sa8d_satd_16x16_avx2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 );
#ifndef X264_I386_PREDICT_H
#define X264_I386_PREDICT_H
+#define x264_predict_16x16_init_mmx x264_template(predict_16x16_init_mmx)
void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] );
+#define x264_predict_8x16c_init_mmx x264_template(predict_8x16c_init_mmx)
void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] );
+#define x264_predict_8x8c_init_mmx x264_template(predict_8x8c_init_mmx)
void x264_predict_8x8c_init_mmx ( int cpu, x264_predict_t pf[7] );
+#define x264_predict_4x4_init_mmx x264_template(predict_4x4_init_mmx)
void x264_predict_4x4_init_mmx ( int cpu, x264_predict_t pf[12] );
+#define x264_predict_8x8_init_mmx x264_template(predict_8x8_init_mmx)
void x264_predict_8x8_init_mmx ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter );
+#define x264_predict_16x16_v_mmx2 x264_template(predict_16x16_v_mmx2)
void x264_predict_16x16_v_mmx2( pixel *src );
+#define x264_predict_16x16_v_sse x264_template(predict_16x16_v_sse)
void x264_predict_16x16_v_sse ( pixel *src );
+#define x264_predict_16x16_v_avx x264_template(predict_16x16_v_avx)
void x264_predict_16x16_v_avx ( uint16_t *src );
+#define x264_predict_16x16_h_mmx2 x264_template(predict_16x16_h_mmx2)
void x264_predict_16x16_h_mmx2( pixel *src );
+#define x264_predict_16x16_h_sse2 x264_template(predict_16x16_h_sse2)
void x264_predict_16x16_h_sse2( uint16_t *src );
+#define x264_predict_16x16_h_ssse3 x264_template(predict_16x16_h_ssse3)
void x264_predict_16x16_h_ssse3( uint8_t *src );
+#define x264_predict_16x16_h_avx2 x264_template(predict_16x16_h_avx2)
void x264_predict_16x16_h_avx2( uint16_t *src );
+#define x264_predict_16x16_dc_sse2 x264_template(predict_16x16_dc_sse2)
void x264_predict_16x16_dc_sse2( pixel *src );
+#define x264_predict_16x16_dc_avx2 x264_template(predict_16x16_dc_avx2)
void x264_predict_16x16_dc_avx2( pixel *src );
+#define x264_predict_16x16_dc_left_sse2 x264_template(predict_16x16_dc_left_sse2)
void x264_predict_16x16_dc_left_sse2( pixel *src );
+#define x264_predict_16x16_dc_left_avx2 x264_template(predict_16x16_dc_left_avx2)
void x264_predict_16x16_dc_left_avx2( pixel *src );
+#define x264_predict_16x16_dc_top_sse2 x264_template(predict_16x16_dc_top_sse2)
void x264_predict_16x16_dc_top_sse2( pixel *src );
+#define x264_predict_16x16_dc_top_avx2 x264_template(predict_16x16_dc_top_avx2)
void x264_predict_16x16_dc_top_avx2( pixel *src );
+#define x264_predict_16x16_p_core_mmx2 x264_template(predict_16x16_p_core_mmx2)
void x264_predict_16x16_p_core_mmx2( uint8_t *src, int i00, int b, int c );
+#define x264_predict_16x16_p_core_sse2 x264_template(predict_16x16_p_core_sse2)
void x264_predict_16x16_p_core_sse2( pixel *src, int i00, int b, int c );
+#define x264_predict_16x16_p_core_avx x264_template(predict_16x16_p_core_avx)
void x264_predict_16x16_p_core_avx( pixel *src, int i00, int b, int c );
+#define x264_predict_16x16_p_core_avx2 x264_template(predict_16x16_p_core_avx2)
void x264_predict_16x16_p_core_avx2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x16c_dc_mmx2 x264_template(predict_8x16c_dc_mmx2)
void x264_predict_8x16c_dc_mmx2( pixel *src );
+#define x264_predict_8x16c_dc_sse2 x264_template(predict_8x16c_dc_sse2)
void x264_predict_8x16c_dc_sse2( uint16_t *src );
+#define x264_predict_8x16c_dc_top_mmx2 x264_template(predict_8x16c_dc_top_mmx2)
void x264_predict_8x16c_dc_top_mmx2( uint8_t *src );
+#define x264_predict_8x16c_dc_top_sse2 x264_template(predict_8x16c_dc_top_sse2)
void x264_predict_8x16c_dc_top_sse2( uint16_t *src );
+#define x264_predict_8x16c_v_mmx x264_template(predict_8x16c_v_mmx)
void x264_predict_8x16c_v_mmx( uint8_t *src );
+#define x264_predict_8x16c_v_sse x264_template(predict_8x16c_v_sse)
void x264_predict_8x16c_v_sse( uint16_t *src );
+#define x264_predict_8x16c_h_mmx2 x264_template(predict_8x16c_h_mmx2)
void x264_predict_8x16c_h_mmx2( pixel *src );
+#define x264_predict_8x16c_h_sse2 x264_template(predict_8x16c_h_sse2)
void x264_predict_8x16c_h_sse2( uint16_t *src );
+#define x264_predict_8x16c_h_ssse3 x264_template(predict_8x16c_h_ssse3)
void x264_predict_8x16c_h_ssse3( uint8_t *src );
+#define x264_predict_8x16c_h_avx2 x264_template(predict_8x16c_h_avx2)
void x264_predict_8x16c_h_avx2( uint16_t *src );
+#define x264_predict_8x16c_p_core_mmx2 x264_template(predict_8x16c_p_core_mmx2)
void x264_predict_8x16c_p_core_mmx2( uint8_t *src, int i00, int b, int c );
+#define x264_predict_8x16c_p_core_sse2 x264_template(predict_8x16c_p_core_sse2)
void x264_predict_8x16c_p_core_sse2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x16c_p_core_avx x264_template(predict_8x16c_p_core_avx)
void x264_predict_8x16c_p_core_avx ( pixel *src, int i00, int b, int c );
+#define x264_predict_8x16c_p_core_avx2 x264_template(predict_8x16c_p_core_avx2)
void x264_predict_8x16c_p_core_avx2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_mmx2 x264_template(predict_8x8c_p_core_mmx2)
void x264_predict_8x8c_p_core_mmx2( uint8_t *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_sse2 x264_template(predict_8x8c_p_core_sse2)
void x264_predict_8x8c_p_core_sse2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_avx x264_template(predict_8x8c_p_core_avx)
void x264_predict_8x8c_p_core_avx ( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_p_core_avx2 x264_template(predict_8x8c_p_core_avx2)
void x264_predict_8x8c_p_core_avx2( pixel *src, int i00, int b, int c );
+#define x264_predict_8x8c_dc_mmx2 x264_template(predict_8x8c_dc_mmx2)
void x264_predict_8x8c_dc_mmx2( pixel *src );
+#define x264_predict_8x8c_dc_sse2 x264_template(predict_8x8c_dc_sse2)
void x264_predict_8x8c_dc_sse2( uint16_t *src );
+#define x264_predict_8x8c_dc_top_mmx2 x264_template(predict_8x8c_dc_top_mmx2)
void x264_predict_8x8c_dc_top_mmx2( uint8_t *src );
+#define x264_predict_8x8c_dc_top_sse2 x264_template(predict_8x8c_dc_top_sse2)
void x264_predict_8x8c_dc_top_sse2( uint16_t *src );
+#define x264_predict_8x8c_v_mmx x264_template(predict_8x8c_v_mmx)
void x264_predict_8x8c_v_mmx( pixel *src );
+#define x264_predict_8x8c_v_sse x264_template(predict_8x8c_v_sse)
void x264_predict_8x8c_v_sse( uint16_t *src );
+#define x264_predict_8x8c_h_mmx2 x264_template(predict_8x8c_h_mmx2)
void x264_predict_8x8c_h_mmx2( pixel *src );
+#define x264_predict_8x8c_h_sse2 x264_template(predict_8x8c_h_sse2)
void x264_predict_8x8c_h_sse2( uint16_t *src );
+#define x264_predict_8x8c_h_ssse3 x264_template(predict_8x8c_h_ssse3)
void x264_predict_8x8c_h_ssse3( uint8_t *src );
+#define x264_predict_8x8c_h_avx2 x264_template(predict_8x8c_h_avx2)
void x264_predict_8x8c_h_avx2( uint16_t *src );
+#define x264_predict_8x8_v_mmx2 x264_template(predict_8x8_v_mmx2)
void x264_predict_8x8_v_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_v_sse x264_template(predict_8x8_v_sse)
void x264_predict_8x8_v_sse ( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_h_mmx2 x264_template(predict_8x8_h_mmx2)
void x264_predict_8x8_h_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_h_sse2 x264_template(predict_8x8_h_sse2)
void x264_predict_8x8_h_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_hd_mmx2 x264_template(predict_8x8_hd_mmx2)
void x264_predict_8x8_hd_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_hu_mmx2 x264_template(predict_8x8_hu_mmx2)
void x264_predict_8x8_hu_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_mmx2 x264_template(predict_8x8_dc_mmx2)
void x264_predict_8x8_dc_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_sse2 x264_template(predict_8x8_dc_sse2)
void x264_predict_8x8_dc_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_dc_top_mmx2 x264_template(predict_8x8_dc_top_mmx2)
void x264_predict_8x8_dc_top_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_top_sse2 x264_template(predict_8x8_dc_top_sse2)
void x264_predict_8x8_dc_top_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_dc_left_mmx2 x264_template(predict_8x8_dc_left_mmx2)
void x264_predict_8x8_dc_left_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_dc_left_sse2 x264_template(predict_8x8_dc_left_sse2)
void x264_predict_8x8_dc_left_sse2( uint16_t *src, uint16_t edge[36] );
+#define x264_predict_8x8_ddl_mmx2 x264_template(predict_8x8_ddl_mmx2)
void x264_predict_8x8_ddl_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddl_sse2 x264_template(predict_8x8_ddl_sse2)
void x264_predict_8x8_ddl_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddl_ssse3 x264_template(predict_8x8_ddl_ssse3)
void x264_predict_8x8_ddl_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddl_cache64_ssse3 x264_template(predict_8x8_ddl_cache64_ssse3)
void x264_predict_8x8_ddl_cache64_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddl_avx x264_template(predict_8x8_ddl_avx)
void x264_predict_8x8_ddl_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_mmx2 x264_template(predict_8x8_ddr_mmx2)
void x264_predict_8x8_ddr_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_ddr_sse2 x264_template(predict_8x8_ddr_sse2)
void x264_predict_8x8_ddr_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_ssse3 x264_template(predict_8x8_ddr_ssse3)
void x264_predict_8x8_ddr_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_cache64_ssse3 x264_template(predict_8x8_ddr_cache64_ssse3)
void x264_predict_8x8_ddr_cache64_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_ddr_avx x264_template(predict_8x8_ddr_avx)
void x264_predict_8x8_ddr_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_sse2 x264_template(predict_8x8_vl_sse2)
void x264_predict_8x8_vl_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_ssse3 x264_template(predict_8x8_vl_ssse3)
void x264_predict_8x8_vl_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_avx x264_template(predict_8x8_vl_avx)
void x264_predict_8x8_vl_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vl_mmx2 x264_template(predict_8x8_vl_mmx2)
void x264_predict_8x8_vl_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_mmx2 x264_template(predict_8x8_vr_mmx2)
void x264_predict_8x8_vr_mmx2( uint8_t *src, uint8_t edge[36] );
+#define x264_predict_8x8_vr_sse2 x264_template(predict_8x8_vr_sse2)
void x264_predict_8x8_vr_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vr_ssse3 x264_template(predict_8x8_vr_ssse3)
void x264_predict_8x8_vr_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_vr_avx x264_template(predict_8x8_vr_avx)
void x264_predict_8x8_vr_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hu_sse2 x264_template(predict_8x8_hu_sse2)
void x264_predict_8x8_hu_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hu_ssse3 x264_template(predict_8x8_hu_ssse3)
void x264_predict_8x8_hu_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hu_avx x264_template(predict_8x8_hu_avx)
void x264_predict_8x8_hu_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hd_sse2 x264_template(predict_8x8_hd_sse2)
void x264_predict_8x8_hd_sse2( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hd_ssse3 x264_template(predict_8x8_hd_ssse3)
void x264_predict_8x8_hd_ssse3( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_hd_avx x264_template(predict_8x8_hd_avx)
void x264_predict_8x8_hd_avx( pixel *src, pixel edge[36] );
+#define x264_predict_8x8_filter_mmx2 x264_template(predict_8x8_filter_mmx2)
void x264_predict_8x8_filter_mmx2( uint8_t *src, uint8_t edge[36], int i_neighbor, int i_filters );
+#define x264_predict_8x8_filter_sse2 x264_template(predict_8x8_filter_sse2)
void x264_predict_8x8_filter_sse2( uint16_t *src, uint16_t edge[36], int i_neighbor, int i_filters );
+#define x264_predict_8x8_filter_ssse3 x264_template(predict_8x8_filter_ssse3)
void x264_predict_8x8_filter_ssse3( pixel *src, pixel edge[36], int i_neighbor, int i_filters );
+#define x264_predict_8x8_filter_avx x264_template(predict_8x8_filter_avx)
void x264_predict_8x8_filter_avx( uint16_t *src, uint16_t edge[36], int i_neighbor, int i_filters );
+#define x264_predict_4x4_h_avx2 x264_template(predict_4x4_h_avx2)
void x264_predict_4x4_h_avx2( uint16_t *src );
+#define x264_predict_4x4_ddl_mmx2 x264_template(predict_4x4_ddl_mmx2)
void x264_predict_4x4_ddl_mmx2( pixel *src );
+#define x264_predict_4x4_ddl_sse2 x264_template(predict_4x4_ddl_sse2)
void x264_predict_4x4_ddl_sse2( uint16_t *src );
+#define x264_predict_4x4_ddl_avx x264_template(predict_4x4_ddl_avx)
void x264_predict_4x4_ddl_avx( uint16_t *src );
+#define x264_predict_4x4_ddr_mmx2 x264_template(predict_4x4_ddr_mmx2)
void x264_predict_4x4_ddr_mmx2( pixel *src );
+#define x264_predict_4x4_vl_mmx2 x264_template(predict_4x4_vl_mmx2)
void x264_predict_4x4_vl_mmx2( pixel *src );
+#define x264_predict_4x4_vl_sse2 x264_template(predict_4x4_vl_sse2)
void x264_predict_4x4_vl_sse2( uint16_t *src );
+#define x264_predict_4x4_vl_avx x264_template(predict_4x4_vl_avx)
void x264_predict_4x4_vl_avx( uint16_t *src );
+#define x264_predict_4x4_vr_mmx2 x264_template(predict_4x4_vr_mmx2)
void x264_predict_4x4_vr_mmx2( uint8_t *src );
+#define x264_predict_4x4_vr_sse2 x264_template(predict_4x4_vr_sse2)
void x264_predict_4x4_vr_sse2( uint16_t *src );
+#define x264_predict_4x4_vr_ssse3 x264_template(predict_4x4_vr_ssse3)
void x264_predict_4x4_vr_ssse3( pixel *src );
+#define x264_predict_4x4_vr_cache64_ssse3 x264_template(predict_4x4_vr_cache64_ssse3)
void x264_predict_4x4_vr_cache64_ssse3( uint8_t *src );
+#define x264_predict_4x4_vr_avx x264_template(predict_4x4_vr_avx)
void x264_predict_4x4_vr_avx( uint16_t *src );
+#define x264_predict_4x4_hd_mmx2 x264_template(predict_4x4_hd_mmx2)
void x264_predict_4x4_hd_mmx2( pixel *src );
+#define x264_predict_4x4_hd_sse2 x264_template(predict_4x4_hd_sse2)
void x264_predict_4x4_hd_sse2( uint16_t *src );
+#define x264_predict_4x4_hd_ssse3 x264_template(predict_4x4_hd_ssse3)
void x264_predict_4x4_hd_ssse3( pixel *src );
+#define x264_predict_4x4_hd_avx x264_template(predict_4x4_hd_avx)
void x264_predict_4x4_hd_avx( uint16_t *src );
+#define x264_predict_4x4_dc_mmx2 x264_template(predict_4x4_dc_mmx2)
void x264_predict_4x4_dc_mmx2( pixel *src );
+#define x264_predict_4x4_ddr_sse2 x264_template(predict_4x4_ddr_sse2)
void x264_predict_4x4_ddr_sse2( uint16_t *src );
+#define x264_predict_4x4_ddr_ssse3 x264_template(predict_4x4_ddr_ssse3)
void x264_predict_4x4_ddr_ssse3( pixel *src );
+#define x264_predict_4x4_ddr_avx x264_template(predict_4x4_ddr_avx)
void x264_predict_4x4_ddr_avx( uint16_t *src );
+#define x264_predict_4x4_hu_mmx2 x264_template(predict_4x4_hu_mmx2)
void x264_predict_4x4_hu_mmx2( pixel *src );
#endif
%endif
%endmacro
-cextern decimate_table4
-cextern decimate_table8
+cextern_common decimate_table4
+cextern_common decimate_table8
%macro DECIMATE4x4 1
#ifndef X264_I386_QUANT_H
#define X264_I386_QUANT_H
+#define x264_quant_2x2_dc_mmx2 x264_template(quant_2x2_dc_mmx2)
int x264_quant_2x2_dc_mmx2( dctcoef dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_mmx2 x264_template(quant_4x4_dc_mmx2)
int x264_quant_4x4_dc_mmx2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_mmx2 x264_template(quant_4x4_mmx2)
int x264_quant_4x4_mmx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_mmx2 x264_template(quant_8x8_mmx2)
int x264_quant_8x8_mmx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_2x2_dc_sse2 x264_template(quant_2x2_dc_sse2)
int x264_quant_2x2_dc_sse2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_dc_sse2 x264_template(quant_4x4_dc_sse2)
int x264_quant_4x4_dc_sse2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_sse2 x264_template(quant_4x4_sse2)
int x264_quant_4x4_sse2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4x4_sse2 x264_template(quant_4x4x4_sse2)
int x264_quant_4x4x4_sse2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_sse2 x264_template(quant_8x8_sse2)
int x264_quant_8x8_sse2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_2x2_dc_ssse3 x264_template(quant_2x2_dc_ssse3)
int x264_quant_2x2_dc_ssse3( dctcoef dct[4], int mf, int bias );
+#define x264_quant_4x4_dc_ssse3 x264_template(quant_4x4_dc_ssse3)
int x264_quant_4x4_dc_ssse3( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_ssse3 x264_template(quant_4x4_ssse3)
int x264_quant_4x4_ssse3( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4x4_ssse3 x264_template(quant_4x4x4_ssse3)
int x264_quant_4x4x4_ssse3( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_ssse3 x264_template(quant_8x8_ssse3)
int x264_quant_8x8_ssse3( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_2x2_dc_sse4 x264_template(quant_2x2_dc_sse4)
int x264_quant_2x2_dc_sse4( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_dc_sse4 x264_template(quant_4x4_dc_sse4)
int x264_quant_4x4_dc_sse4( dctcoef dct[16], int mf, int bias );
+#define x264_quant_4x4_sse4 x264_template(quant_4x4_sse4)
int x264_quant_4x4_sse4( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4x4_sse4 x264_template(quant_4x4x4_sse4)
int x264_quant_4x4x4_sse4( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_8x8_sse4 x264_template(quant_8x8_sse4)
int x264_quant_8x8_sse4( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_4x4_avx2 x264_template(quant_4x4_avx2)
int x264_quant_4x4_avx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_quant_4x4_dc_avx2 x264_template(quant_4x4_dc_avx2)
int x264_quant_4x4_dc_avx2( dctcoef dct[16], int mf, int bias );
+#define x264_quant_8x8_avx2 x264_template(quant_8x8_avx2)
int x264_quant_8x8_avx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
+#define x264_quant_4x4x4_avx2 x264_template(quant_4x4x4_avx2)
int x264_quant_4x4x4_avx2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
+#define x264_dequant_4x4_mmx x264_template(dequant_4x4_mmx)
void x264_dequant_4x4_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_mmx2 x264_template(dequant_4x4dc_mmx2)
void x264_dequant_4x4dc_mmx2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_mmx x264_template(dequant_8x8_mmx)
void x264_dequant_8x8_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_sse2 x264_template(dequant_4x4_sse2)
void x264_dequant_4x4_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_sse2 x264_template(dequant_4x4dc_sse2)
void x264_dequant_4x4dc_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_sse2 x264_template(dequant_8x8_sse2)
void x264_dequant_8x8_sse2( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_avx x264_template(dequant_4x4_avx)
void x264_dequant_4x4_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_avx x264_template(dequant_4x4dc_avx)
void x264_dequant_4x4dc_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_avx x264_template(dequant_8x8_avx)
void x264_dequant_8x8_avx( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_xop x264_template(dequant_4x4_xop)
void x264_dequant_4x4_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_xop x264_template(dequant_4x4dc_xop)
void x264_dequant_4x4dc_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_xop x264_template(dequant_8x8_xop)
void x264_dequant_8x8_xop( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_avx2 x264_template(dequant_4x4_avx2)
void x264_dequant_4x4_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_4x4dc_avx2 x264_template(dequant_4x4dc_avx2)
void x264_dequant_4x4dc_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_avx2 x264_template(dequant_8x8_avx2)
void x264_dequant_8x8_avx2( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_avx512 x264_template(dequant_4x4_avx512)
void x264_dequant_4x4_avx512( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_avx512 x264_template(dequant_8x8_avx512)
void x264_dequant_8x8_avx512( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_flat16_mmx x264_template(dequant_4x4_flat16_mmx)
void x264_dequant_4x4_flat16_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_flat16_mmx x264_template(dequant_8x8_flat16_mmx)
void x264_dequant_8x8_flat16_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_flat16_sse2 x264_template(dequant_4x4_flat16_sse2)
void x264_dequant_4x4_flat16_sse2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_flat16_sse2 x264_template(dequant_8x8_flat16_sse2)
void x264_dequant_8x8_flat16_sse2( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_4x4_flat16_avx2 x264_template(dequant_4x4_flat16_avx2)
void x264_dequant_4x4_flat16_avx2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
+#define x264_dequant_8x8_flat16_avx2 x264_template(dequant_8x8_flat16_avx2)
void x264_dequant_8x8_flat16_avx2( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_dequant_8x8_flat16_avx512 x264_template(dequant_8x8_flat16_avx512)
void x264_dequant_8x8_flat16_avx512( int16_t dct[64], int dequant_mf[6][64], int i_qp );
+#define x264_idct_dequant_2x4_dc_sse2 x264_template(idct_dequant_2x4_dc_sse2)
void x264_idct_dequant_2x4_dc_sse2( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp );
+#define x264_idct_dequant_2x4_dc_avx x264_template(idct_dequant_2x4_dc_avx)
void x264_idct_dequant_2x4_dc_avx ( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp );
+#define x264_idct_dequant_2x4_dconly_sse2 x264_template(idct_dequant_2x4_dconly_sse2)
void x264_idct_dequant_2x4_dconly_sse2( dctcoef dct[8], int dequant_mf[6][16], int i_qp );
+#define x264_idct_dequant_2x4_dconly_avx x264_template(idct_dequant_2x4_dconly_avx)
void x264_idct_dequant_2x4_dconly_avx ( dctcoef dct[8], int dequant_mf[6][16], int i_qp );
+#define x264_optimize_chroma_2x2_dc_sse2 x264_template(optimize_chroma_2x2_dc_sse2)
int x264_optimize_chroma_2x2_dc_sse2( dctcoef dct[4], int dequant_mf );
+#define x264_optimize_chroma_2x2_dc_ssse3 x264_template(optimize_chroma_2x2_dc_ssse3)
int x264_optimize_chroma_2x2_dc_ssse3( dctcoef dct[4], int dequant_mf );
+#define x264_optimize_chroma_2x2_dc_sse4 x264_template(optimize_chroma_2x2_dc_sse4)
int x264_optimize_chroma_2x2_dc_sse4( dctcoef dct[4], int dequant_mf );
+#define x264_optimize_chroma_2x2_dc_avx x264_template(optimize_chroma_2x2_dc_avx)
int x264_optimize_chroma_2x2_dc_avx( dctcoef dct[4], int dequant_mf );
+#define x264_denoise_dct_mmx x264_template(denoise_dct_mmx)
void x264_denoise_dct_mmx ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_sse2 x264_template(denoise_dct_sse2)
void x264_denoise_dct_sse2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_ssse3 x264_template(denoise_dct_ssse3)
void x264_denoise_dct_ssse3( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_avx x264_template(denoise_dct_avx)
void x264_denoise_dct_avx ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_denoise_dct_avx2 x264_template(denoise_dct_avx2)
void x264_denoise_dct_avx2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
+#define x264_decimate_score15_sse2 x264_template(decimate_score15_sse2)
int x264_decimate_score15_sse2( dctcoef *dct );
+#define x264_decimate_score15_ssse3 x264_template(decimate_score15_ssse3)
int x264_decimate_score15_ssse3( dctcoef *dct );
+#define x264_decimate_score15_avx512 x264_template(decimate_score15_avx512)
int x264_decimate_score15_avx512( dctcoef *dct );
+#define x264_decimate_score16_sse2 x264_template(decimate_score16_sse2)
int x264_decimate_score16_sse2( dctcoef *dct );
+#define x264_decimate_score16_ssse3 x264_template(decimate_score16_ssse3)
int x264_decimate_score16_ssse3( dctcoef *dct );
+#define x264_decimate_score16_avx512 x264_template(decimate_score16_avx512)
int x264_decimate_score16_avx512( dctcoef *dct );
+#define x264_decimate_score64_sse2 x264_template(decimate_score64_sse2)
int x264_decimate_score64_sse2( dctcoef *dct );
+#define x264_decimate_score64_ssse3 x264_template(decimate_score64_ssse3)
int x264_decimate_score64_ssse3( dctcoef *dct );
+#define x264_decimate_score64_avx2 x264_template(decimate_score64_avx2)
int x264_decimate_score64_avx2( int16_t *dct );
+#define x264_decimate_score64_avx512 x264_template(decimate_score64_avx512)
int x264_decimate_score64_avx512( dctcoef *dct );
+#define x264_coeff_last4_mmx2 x264_template(coeff_last4_mmx2)
int x264_coeff_last4_mmx2( dctcoef *dct );
+#define x264_coeff_last8_mmx2 x264_template(coeff_last8_mmx2)
int x264_coeff_last8_mmx2( dctcoef *dct );
+#define x264_coeff_last15_mmx2 x264_template(coeff_last15_mmx2)
int x264_coeff_last15_mmx2( dctcoef *dct );
+#define x264_coeff_last16_mmx2 x264_template(coeff_last16_mmx2)
int x264_coeff_last16_mmx2( dctcoef *dct );
+#define x264_coeff_last64_mmx2 x264_template(coeff_last64_mmx2)
int x264_coeff_last64_mmx2( dctcoef *dct );
+#define x264_coeff_last8_sse2 x264_template(coeff_last8_sse2)
int x264_coeff_last8_sse2( dctcoef *dct );
+#define x264_coeff_last15_sse2 x264_template(coeff_last15_sse2)
int x264_coeff_last15_sse2( dctcoef *dct );
+#define x264_coeff_last16_sse2 x264_template(coeff_last16_sse2)
int x264_coeff_last16_sse2( dctcoef *dct );
+#define x264_coeff_last64_sse2 x264_template(coeff_last64_sse2)
int x264_coeff_last64_sse2( dctcoef *dct );
+#define x264_coeff_last4_lzcnt x264_template(coeff_last4_lzcnt)
int x264_coeff_last4_lzcnt( dctcoef *dct );
+#define x264_coeff_last8_lzcnt x264_template(coeff_last8_lzcnt)
int x264_coeff_last8_lzcnt( dctcoef *dct );
+#define x264_coeff_last15_lzcnt x264_template(coeff_last15_lzcnt)
int x264_coeff_last15_lzcnt( dctcoef *dct );
+#define x264_coeff_last16_lzcnt x264_template(coeff_last16_lzcnt)
int x264_coeff_last16_lzcnt( dctcoef *dct );
+#define x264_coeff_last64_lzcnt x264_template(coeff_last64_lzcnt)
int x264_coeff_last64_lzcnt( dctcoef *dct );
+#define x264_coeff_last64_avx2 x264_template(coeff_last64_avx2)
int x264_coeff_last64_avx2 ( dctcoef *dct );
+#define x264_coeff_last4_avx512 x264_template(coeff_last4_avx512)
int x264_coeff_last4_avx512( int32_t *dct );
+#define x264_coeff_last8_avx512 x264_template(coeff_last8_avx512)
int x264_coeff_last8_avx512( dctcoef *dct );
+#define x264_coeff_last15_avx512 x264_template(coeff_last15_avx512)
int x264_coeff_last15_avx512( dctcoef *dct );
+#define x264_coeff_last16_avx512 x264_template(coeff_last16_avx512)
int x264_coeff_last16_avx512( dctcoef *dct );
+#define x264_coeff_last64_avx512 x264_template(coeff_last64_avx512)
int x264_coeff_last64_avx512( dctcoef *dct );
+#define x264_coeff_level_run16_mmx2 x264_template(coeff_level_run16_mmx2)
int x264_coeff_level_run16_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_sse2 x264_template(coeff_level_run16_sse2)
int x264_coeff_level_run16_sse2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_lzcnt x264_template(coeff_level_run16_lzcnt)
int x264_coeff_level_run16_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_ssse3 x264_template(coeff_level_run16_ssse3)
int x264_coeff_level_run16_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_ssse3_lzcnt x264_template(coeff_level_run16_ssse3_lzcnt)
int x264_coeff_level_run16_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run16_avx2 x264_template(coeff_level_run16_avx2)
int x264_coeff_level_run16_avx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_mmx2 x264_template(coeff_level_run15_mmx2)
int x264_coeff_level_run15_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_sse2 x264_template(coeff_level_run15_sse2)
int x264_coeff_level_run15_sse2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_lzcnt x264_template(coeff_level_run15_lzcnt)
int x264_coeff_level_run15_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_ssse3 x264_template(coeff_level_run15_ssse3)
int x264_coeff_level_run15_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_ssse3_lzcnt x264_template(coeff_level_run15_ssse3_lzcnt)
int x264_coeff_level_run15_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run15_avx2 x264_template(coeff_level_run15_avx2)
int x264_coeff_level_run15_avx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_mmx2 x264_template(coeff_level_run4_mmx2)
int x264_coeff_level_run4_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_lzcnt x264_template(coeff_level_run4_lzcnt)
int x264_coeff_level_run4_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_ssse3 x264_template(coeff_level_run4_ssse3)
int x264_coeff_level_run4_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run4_ssse3_lzcnt x264_template(coeff_level_run4_ssse3_lzcnt)
int x264_coeff_level_run4_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_mmx2 x264_template(coeff_level_run8_mmx2)
int x264_coeff_level_run8_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_lzcnt x264_template(coeff_level_run8_lzcnt)
int x264_coeff_level_run8_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_sse2 x264_template(coeff_level_run8_sse2)
int x264_coeff_level_run8_sse2( dctcoef *dct, x264_run_level_t *runlevel );
-int x264_coeff_level_run8_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_ssse3 x264_template(coeff_level_run8_ssse3)
int x264_coeff_level_run8_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_coeff_level_run8_ssse3_lzcnt x264_template(coeff_level_run8_ssse3_lzcnt)
int x264_coeff_level_run8_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
+#define x264_trellis_cabac_4x4_sse2 x264_template(trellis_cabac_4x4_sse2)
int x264_trellis_cabac_4x4_sse2 ( TRELLIS_PARAMS, int b_ac );
+#define x264_trellis_cabac_4x4_ssse3 x264_template(trellis_cabac_4x4_ssse3)
int x264_trellis_cabac_4x4_ssse3( TRELLIS_PARAMS, int b_ac );
+#define x264_trellis_cabac_8x8_sse2 x264_template(trellis_cabac_8x8_sse2)
int x264_trellis_cabac_8x8_sse2 ( TRELLIS_PARAMS, int b_interlaced );
+#define x264_trellis_cabac_8x8_ssse3 x264_template(trellis_cabac_8x8_ssse3)
int x264_trellis_cabac_8x8_ssse3( TRELLIS_PARAMS, int b_interlaced );
+#define x264_trellis_cabac_4x4_psy_sse2 x264_template(trellis_cabac_4x4_psy_sse2)
int x264_trellis_cabac_4x4_psy_sse2 ( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_4x4_psy_ssse3 x264_template(trellis_cabac_4x4_psy_ssse3)
int x264_trellis_cabac_4x4_psy_ssse3( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_8x8_psy_sse2 x264_template(trellis_cabac_8x8_psy_sse2)
int x264_trellis_cabac_8x8_psy_sse2 ( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_8x8_psy_ssse3 x264_template(trellis_cabac_8x8_psy_ssse3)
int x264_trellis_cabac_8x8_psy_ssse3( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis );
+#define x264_trellis_cabac_dc_sse2 x264_template(trellis_cabac_dc_sse2)
int x264_trellis_cabac_dc_sse2 ( TRELLIS_PARAMS, int i_coefs );
+#define x264_trellis_cabac_dc_ssse3 x264_template(trellis_cabac_dc_ssse3)
int x264_trellis_cabac_dc_ssse3( TRELLIS_PARAMS, int i_coefs );
+#define x264_trellis_cabac_chroma_422_dc_sse2 x264_template(trellis_cabac_chroma_422_dc_sse2)
int x264_trellis_cabac_chroma_422_dc_sse2 ( TRELLIS_PARAMS );
+#define x264_trellis_cabac_chroma_422_dc_ssse3 x264_template(trellis_cabac_chroma_422_dc_ssse3)
int x264_trellis_cabac_chroma_422_dc_ssse3( TRELLIS_PARAMS );
#endif
cextern pd_8
cextern pd_0123
cextern pd_4567
-cextern cabac_entropy
-cextern cabac_transition
+cextern_common cabac_entropy
+cextern_common cabac_transition
cextern cabac_size_unary
cextern cabac_transition_unary
-cextern dct4_weight_tab
-cextern dct8_weight_tab
-cextern dct4_weight2_tab
-cextern dct8_weight2_tab
-cextern last_coeff_flag_offset_8x8
-cextern significant_coeff_flag_offset_8x8
-cextern coeff_flag_offset_chroma_422_dc
+cextern_common dct4_weight_tab
+cextern_common dct8_weight_tab
+cextern_common dct4_weight2_tab
+cextern_common dct8_weight2_tab
+cextern_common last_coeff_flag_offset_8x8
+cextern_common significant_coeff_flag_offset_8x8
+cextern_common coeff_flag_offset_chroma_422_dc
SECTION .text
;* For more information, contact us at licensing@x264.com.
;*****************************************************************************
+; like cextern, but with a plain x264 prefix instead of a bitdepth-specific one
+%macro cextern_common 1
+ %xdefine %1 mangle(x264 %+ _ %+ %1)
+ CAT_XDEFINE cglobaled_, %1, 1
+ extern %1
+%endmacro
+
+%ifndef BIT_DEPTH
+ %assign BIT_DEPTH 0
+%endif
+
+%if BIT_DEPTH > 8
+ %assign HIGH_BIT_DEPTH 1
+%else
+ %assign HIGH_BIT_DEPTH 0
+%endif
+
%assign FENC_STRIDE 16
%assign FDEC_STRIDE 32
%endif
%endmacro
-
%macro SBUTTERFLY 4
%ifidn %1, dqqq
vperm2i128 m%4, m%2, m%3, q0301 ; punpckh
--disable-thread disable multithreaded encoding
--disable-win32thread disable win32threads (windows only)
--disable-interlaced disable interlaced encoding support
- --bit-depth=BIT_DEPTH set output bit depth (8-10) [8]
+ --bit-depth=BIT_DEPTH set output bit depth (8, 10, all) [all]
--chroma-format=FORMAT output chroma format (420, 422, 444, all) [all]
Advanced options:
fi
arg="$(grep '#define X264_BIT_DEPTH ' $x264_config_path | sed -e 's/#define X264_BIT_DEPTH *//; s/ *$//')"
if [ -n "$arg" ]; then
+ [ "$arg" = 0 ] && arg="all"
if [ "$arg" != "$bit_depth" ]; then
echo "Override output bit depth with system libx264 configuration"
bit_depth="$arg"
gprof="no"
strip="no"
pic="no"
-bit_depth="8"
+bit_depth="all"
chroma_format="all"
compiler="GNU"
compiler_style="GNU"
# list of all preprocessor HAVE values we can define
CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
- MSA MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R"
+ MSA MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R BITDEPTH8 BITDEPTH10"
# parse options
;;
--bit-depth=*)
bit_depth="$optarg"
- if [ "$bit_depth" -lt "8" -o "$bit_depth" -gt "10" ]; then
- echo "Supplied bit depth must be in range [8,10]."
+ if [ "$bit_depth" != "8" -a "$bit_depth" != "10" -a "$bit_depth" != "all" ]; then
+ echo "Supplied bit depth must be 8, 10 or all."
exit 1
fi
- bit_depth=`expr $bit_depth + 0`
;;
--chroma-format=*)
chroma_format="$optarg"
fi
fi
-if [ "$bit_depth" -gt "8" ]; then
- define HIGH_BIT_DEPTH
- ASFLAGS="$ASFLAGS -DHIGH_BIT_DEPTH=1"
+if [ "$bit_depth" = "all" ]; then
+ define HAVE_BITDEPTH8
+ define HAVE_BITDEPTH10
+elif [ "$bit_depth" -eq "8" ]; then
+ define HAVE_BITDEPTH8
+elif [ "$bit_depth" -eq "10" ]; then
+ define HAVE_BITDEPTH10
opencl="no"
-else
- ASFLAGS="$ASFLAGS -DHIGH_BIT_DEPTH=0"
fi
if [ "$chroma_format" != "all" ]; then
define CHROMA_FORMAT CHROMA_$chroma_format
fi
-ASFLAGS="$ASFLAGS -DBIT_DEPTH=$bit_depth"
-
[ $gpl = yes ] && define HAVE_GPL && x264_gpl=1 || x264_gpl=0
[ $interlaced = yes ] && define HAVE_INTERLACED && x264_interlaced=1 || x264_interlaced=0
# cygwin can use opencl if it can use LoadLibrary
if [ $SYS = WINDOWS ] || ([ $SYS = CYGWIN ] && cc_check windows.h "" "LoadLibraryW(0);") ; then
opencl="yes"
- define HAVE_OPENCL
+ define HAVE_OPENCL "(BIT_DEPTH==8)"
elif [ "$SYS" = "LINUX" -o "$SYS" = "MACOSX" ] ; then
opencl="yes"
- define HAVE_OPENCL
+ define HAVE_OPENCL "(BIT_DEPTH==8)"
libdl="-ldl"
fi
LDFLAGS="$LDFLAGS $libdl"
#define undefined vars as 0
for var in $CONFIG_HAVE; do
- grep -q "HAVE_$var 1" config.h || define HAVE_$var 0
+ grep -q "HAVE_$var " config.h || define HAVE_$var 0
done
# generate exported config file
-config_chroma_format="X264_CSP_I$chroma_format"
-[ "$config_chroma_format" == "X264_CSP_Iall" ] && config_chroma_format="0"
+[ "$bit_depth" = "all" ] && config_bit_depth="0" || config_bit_depth="$bit_depth"
+[ "$chroma_format" = "all" ] && config_chroma_format="0" || config_chroma_format="X264_CSP_I$chroma_format"
cat > x264_config.h << EOF
-#define X264_BIT_DEPTH $bit_depth
#define X264_GPL $x264_gpl
#define X264_INTERLACED $x264_interlaced
+#define X264_BIT_DEPTH $config_bit_depth
#define X264_CHROMA_FORMAT $config_chroma_format
EOF
EOF
if [ $compiler_style = MS ]; then
- echo '%.o: %.c' >> config.mak
- echo ' $(CC) $(CFLAGS) -c -Fo$@ $<' >> config.mak
+ echo 'CC_O=-Fo$@' >> config.mak
+else
+ echo 'CC_O=-o $@' >> config.mak
fi
if [ "$cli" = "yes" ]; then
} x264_mb_analysis_t;
-/* lambda = pow(2,qp/6-2) */
-const uint16_t x264_lambda_tab[QP_MAX_MAX+1] =
-{
- 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 7 */
- 1, 1, 1, 1, 1, 1, 1, 1, /* 8-15 */
- 2, 2, 2, 2, 3, 3, 3, 4, /* 16-23 */
- 4, 4, 5, 6, 6, 7, 8, 9, /* 24-31 */
- 10, 11, 13, 14, 16, 18, 20, 23, /* 32-39 */
- 25, 29, 32, 36, 40, 45, 51, 57, /* 40-47 */
- 64, 72, 81, 91, 102, 114, 128, 144, /* 48-55 */
- 161, 181, 203, 228, 256, 287, 323, 362, /* 56-63 */
- 406, 456, 512, 575, 645, 724, 813, 912, /* 64-71 */
-1024,1149,1290,1448,1625,1825,2048,2299, /* 72-79 */
-2580,2896, /* 80-81 */
-};
-
-/* lambda2 = pow(lambda,2) * .9 * 256 */
-/* Capped to avoid overflow */
-const int x264_lambda2_tab[QP_MAX_MAX+1] =
-{
- 14, 18, 22, 28, 36, 45, 57, 72, /* 0- 7 */
- 91, 115, 145, 182, 230, 290, 365, 460, /* 8-15 */
- 580, 731, 921, 1161, 1462, 1843, 2322, 2925, /* 16-23 */
- 3686, 4644, 5851, 7372, 9289, 11703, 14745, 18578, /* 24-31 */
- 23407, 29491, 37156, 46814, 58982, 74313, 93628, 117964, /* 32-39 */
- 148626, 187257, 235929, 297252, 374514, 471859, 594505, 749029, /* 40-47 */
- 943718, 1189010, 1498059, 1887436, 2378021, 2996119, 3774873, 4756042, /* 48-55 */
- 5992238, 7549747, 9512085, 11984476, 15099494, 19024170,23968953,30198988, /* 56-63 */
- 38048341, 47937906, 60397977, 76096683, 95875813,120795955, /* 64-69 */
-134217727,134217727,134217727,134217727,134217727,134217727, /* 70-75 */
-134217727,134217727,134217727,134217727,134217727,134217727, /* 76-81 */
-};
-
-const uint8_t x264_exp2_lut[64] =
-{
- 0, 3, 6, 8, 11, 14, 17, 20, 23, 26, 29, 32, 36, 39, 42, 45,
- 48, 52, 55, 58, 62, 65, 69, 72, 76, 80, 83, 87, 91, 94, 98, 102,
- 106, 110, 114, 118, 122, 126, 130, 135, 139, 143, 147, 152, 156, 161, 165, 170,
- 175, 179, 184, 189, 194, 198, 203, 208, 214, 219, 224, 229, 234, 240, 245, 250
-};
-
-const float x264_log2_lut[128] =
-{
- 0.00000, 0.01123, 0.02237, 0.03342, 0.04439, 0.05528, 0.06609, 0.07682,
- 0.08746, 0.09803, 0.10852, 0.11894, 0.12928, 0.13955, 0.14975, 0.15987,
- 0.16993, 0.17991, 0.18982, 0.19967, 0.20945, 0.21917, 0.22882, 0.23840,
- 0.24793, 0.25739, 0.26679, 0.27612, 0.28540, 0.29462, 0.30378, 0.31288,
- 0.32193, 0.33092, 0.33985, 0.34873, 0.35755, 0.36632, 0.37504, 0.38370,
- 0.39232, 0.40088, 0.40939, 0.41785, 0.42626, 0.43463, 0.44294, 0.45121,
- 0.45943, 0.46761, 0.47573, 0.48382, 0.49185, 0.49985, 0.50779, 0.51570,
- 0.52356, 0.53138, 0.53916, 0.54689, 0.55459, 0.56224, 0.56986, 0.57743,
- 0.58496, 0.59246, 0.59991, 0.60733, 0.61471, 0.62205, 0.62936, 0.63662,
- 0.64386, 0.65105, 0.65821, 0.66534, 0.67243, 0.67948, 0.68650, 0.69349,
- 0.70044, 0.70736, 0.71425, 0.72110, 0.72792, 0.73471, 0.74147, 0.74819,
- 0.75489, 0.76155, 0.76818, 0.77479, 0.78136, 0.78790, 0.79442, 0.80090,
- 0.80735, 0.81378, 0.82018, 0.82655, 0.83289, 0.83920, 0.84549, 0.85175,
- 0.85798, 0.86419, 0.87036, 0.87652, 0.88264, 0.88874, 0.89482, 0.90087,
- 0.90689, 0.91289, 0.91886, 0.92481, 0.93074, 0.93664, 0.94251, 0.94837,
- 0.95420, 0.96000, 0.96578, 0.97154, 0.97728, 0.98299, 0.98868, 0.99435,
-};
-
-/* Avoid an int/float conversion. */
-const float x264_log2_lz_lut[32] =
-{
- 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
-};
-
-// should the intra and inter lambdas be different?
-// I'm just matching the behaviour of deadzone quant.
-static const int x264_trellis_lambda2_tab[2][QP_MAX_MAX+1] =
-{
- // inter lambda = .85 * .85 * 2**(qp/3. + 10 - LAMBDA_BITS)
- {
- 46, 58, 73, 92, 117, 147,
- 185, 233, 294, 370, 466, 587,
- 740, 932, 1174, 1480, 1864, 2349,
- 2959, 3728, 4697, 5918, 7457, 9395,
- 11837, 14914, 18790, 23674, 29828, 37581,
- 47349, 59656, 75163, 94699, 119313, 150326,
- 189399, 238627, 300652, 378798, 477255, 601304,
- 757596, 954511, 1202608, 1515192, 1909022, 2405217,
- 3030384, 3818045, 4810435, 6060769, 7636091, 9620872,
- 12121539, 15272182, 19241743, 24243077, 30544363, 38483486,
- 48486154, 61088726, 76966972, 96972308,
- 122177453,134217727,134217727,134217727,134217727,134217727,
- 134217727,134217727,134217727,134217727,134217727,134217727,
- },
- // intra lambda = .65 * .65 * 2**(qp/3. + 10 - LAMBDA_BITS)
- {
- 27, 34, 43, 54, 68, 86,
- 108, 136, 172, 216, 273, 343,
- 433, 545, 687, 865, 1090, 1374,
- 1731, 2180, 2747, 3461, 4361, 5494,
- 6922, 8721, 10988, 13844, 17442, 21976,
- 27688, 34885, 43953, 55377, 69771, 87906,
- 110755, 139543, 175813, 221511, 279087, 351627,
- 443023, 558174, 703255, 886046, 1116348, 1406511,
- 1772093, 2232697, 2813022, 3544186, 4465396, 5626046,
- 7088374, 8930791, 11252092, 14176748, 17861583, 22504184,
- 28353495, 35723165, 45008368, 56706990,
- 71446330, 90016736,113413980,134217727,134217727,134217727,
- 134217727,134217727,134217727,134217727,134217727,134217727,
- 134217727,134217727,134217727,134217727,134217727,134217727,
- }
-};
-
-#define MAX_CHROMA_LAMBDA_OFFSET 36
-static const uint16_t x264_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1] =
-{
- 16, 20, 25, 32, 40, 50,
- 64, 80, 101, 128, 161, 203,
- 256, 322, 406, 512, 645, 812,
- 1024, 1290, 1625, 2048, 2580, 3250,
- 4096, 5160, 6501, 8192, 10321, 13003,
- 16384, 20642, 26007, 32768, 41285, 52015,
- 65535
-};
-
/* TODO: calculate CABAC costs */
static const uint8_t i_mb_b_cost_table[X264_MBTYPE_MAX] =
{
#ifndef X264_ANALYSE_H
#define X264_ANALYSE_H
+#define x264_analyse_init_costs x264_template(analyse_init_costs)
int x264_analyse_init_costs( x264_t *h );
+#define x264_analyse_free_costs x264_template(analyse_free_costs)
void x264_analyse_free_costs( x264_t *h );
+#define x264_analyse_weight_frame x264_template(analyse_weight_frame)
void x264_analyse_weight_frame( x264_t *h, int end );
+#define x264_macroblock_analyse x264_template(macroblock_analyse)
void x264_macroblock_analyse( x264_t *h );
+#define x264_slicetype_decide x264_template(slicetype_decide)
void x264_slicetype_decide( x264_t *h );
+#define x264_slicetype_analyse x264_template(slicetype_analyse)
void x264_slicetype_analyse( x264_t *h, int intra_minigop );
+#define x264_lookahead_init x264_template(lookahead_init)
int x264_lookahead_init( x264_t *h, int i_slicetype_length );
+#define x264_lookahead_is_empty x264_template(lookahead_is_empty)
int x264_lookahead_is_empty( x264_t *h );
+#define x264_lookahead_put_frame x264_template(lookahead_put_frame)
void x264_lookahead_put_frame( x264_t *h, x264_frame_t *frame );
+#define x264_lookahead_get_frames x264_template(lookahead_get_frames)
void x264_lookahead_get_frames( x264_t *h );
+#define x264_lookahead_delete x264_template(lookahead_delete)
void x264_lookahead_delete( x264_t *h );
#endif
--- /dev/null
+/*****************************************************************************
+ * api.c: bit depth independent interface
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Vittorio Giovara <vittorio.giovara@gmail.com>
+ * Luca Barbato <lu_zero@gentoo.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#include "common/base.h"
+
+/****************************************************************************
+ * global symbols
+ ****************************************************************************/
+const int x264_chroma_format = X264_CHROMA_FORMAT;
+
+x264_t *x264_8_encoder_open( x264_param_t * );
+void x264_8_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
+int x264_8_encoder_reconfig( x264_t *, x264_param_t * );
+void x264_8_encoder_parameters( x264_t *, x264_param_t * );
+int x264_8_encoder_headers( x264_t *, x264_nal_t **pp_nal, int *pi_nal );
+int x264_8_encoder_encode( x264_t *, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_in, x264_picture_t *pic_out );
+void x264_8_encoder_close( x264_t * );
+int x264_8_encoder_delayed_frames( x264_t * );
+int x264_8_encoder_maximum_delayed_frames( x264_t * );
+void x264_8_encoder_intra_refresh( x264_t * );
+int x264_8_encoder_invalidate_reference( x264_t *, int64_t pts );
+
+x264_t *x264_10_encoder_open( x264_param_t * );
+void x264_10_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
+int x264_10_encoder_reconfig( x264_t *, x264_param_t * );
+void x264_10_encoder_parameters( x264_t *, x264_param_t * );
+int x264_10_encoder_headers( x264_t *, x264_nal_t **pp_nal, int *pi_nal );
+int x264_10_encoder_encode( x264_t *, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_in, x264_picture_t *pic_out );
+void x264_10_encoder_close( x264_t * );
+int x264_10_encoder_delayed_frames( x264_t * );
+int x264_10_encoder_maximum_delayed_frames( x264_t * );
+void x264_10_encoder_intra_refresh( x264_t * );
+int x264_10_encoder_invalidate_reference( x264_t *, int64_t pts );
+
+typedef struct x264_api_t
+{
+ /* Internal reference to x264_t data */
+ x264_t *x264;
+
+ /* API entry points */
+ void (*nal_encode)( x264_t *h, uint8_t *dst, x264_nal_t *nal );
+ int (*encoder_reconfig)( x264_t *, x264_param_t * );
+ void (*encoder_parameters)( x264_t *, x264_param_t * );
+ int (*encoder_headers)( x264_t *, x264_nal_t **pp_nal, int *pi_nal );
+ int (*encoder_encode)( x264_t *, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_in, x264_picture_t *pic_out );
+ void (*encoder_close)( x264_t * );
+ int (*encoder_delayed_frames)( x264_t * );
+ int (*encoder_maximum_delayed_frames)( x264_t * );
+ void (*encoder_intra_refresh)( x264_t * );
+ int (*encoder_invalidate_reference)( x264_t *, int64_t pts );
+} x264_api_t;
+
+x264_t *x264_encoder_open( x264_param_t *param )
+{
+ x264_api_t *api = calloc( 1, sizeof( x264_api_t ) );
+ if( !api )
+ return NULL;
+
+ if( HAVE_BITDEPTH8 && param->i_bitdepth == 8 )
+ {
+ api->nal_encode = x264_8_nal_encode;
+ api->encoder_reconfig = x264_8_encoder_reconfig;
+ api->encoder_parameters = x264_8_encoder_parameters;
+ api->encoder_headers = x264_8_encoder_headers;
+ api->encoder_encode = x264_8_encoder_encode;
+ api->encoder_close = x264_8_encoder_close;
+ api->encoder_delayed_frames = x264_8_encoder_delayed_frames;
+ api->encoder_maximum_delayed_frames = x264_8_encoder_maximum_delayed_frames;
+ api->encoder_intra_refresh = x264_8_encoder_intra_refresh;
+ api->encoder_invalidate_reference = x264_8_encoder_invalidate_reference;
+
+ api->x264 = x264_8_encoder_open( param );
+ }
+ else if( HAVE_BITDEPTH10 && param->i_bitdepth == 10 )
+ {
+ api->nal_encode = x264_10_nal_encode;
+ api->encoder_reconfig = x264_10_encoder_reconfig;
+ api->encoder_parameters = x264_10_encoder_parameters;
+ api->encoder_headers = x264_10_encoder_headers;
+ api->encoder_encode = x264_10_encoder_encode;
+ api->encoder_close = x264_10_encoder_close;
+ api->encoder_delayed_frames = x264_10_encoder_delayed_frames;
+ api->encoder_maximum_delayed_frames = x264_10_encoder_maximum_delayed_frames;
+ api->encoder_intra_refresh = x264_10_encoder_intra_refresh;
+ api->encoder_invalidate_reference = x264_10_encoder_invalidate_reference;
+
+ api->x264 = x264_10_encoder_open( param );
+ }
+ else
+ x264_log_internal( X264_LOG_ERROR, "not compiled with %d bit depth support\n", param->i_bitdepth );
+
+ if( !api->x264 )
+ {
+ free( api );
+ return NULL;
+ }
+
+ /* x264_t is opaque */
+ return (x264_t *)api;
+}
+
+void x264_encoder_close( x264_t *h )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ api->encoder_close( api->x264 );
+ free( api );
+}
+
+void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ api->nal_encode( api->x264, dst, nal );
+}
+
+int x264_encoder_reconfig( x264_t *h, x264_param_t *param)
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ return api->encoder_reconfig( api->x264, param );
+}
+
+void x264_encoder_parameters( x264_t *h, x264_param_t *param )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ api->encoder_parameters( api->x264, param );
+}
+
+int x264_encoder_headers( x264_t *h, x264_nal_t **pp_nal, int *pi_nal )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ return api->encoder_headers( api->x264, pp_nal, pi_nal );
+}
+
+int x264_encoder_encode( x264_t *h, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_in, x264_picture_t *pic_out )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ return api->encoder_encode( api->x264, pp_nal, pi_nal, pic_in, pic_out );
+}
+
+int x264_encoder_delayed_frames( x264_t *h )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ return api->encoder_delayed_frames( api->x264 );
+}
+
+int x264_encoder_maximum_delayed_frames( x264_t *h )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ return api->encoder_maximum_delayed_frames( api->x264 );
+}
+
+void x264_encoder_intra_refresh( x264_t *h )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ api->encoder_intra_refresh( api->x264 );
+}
+
+int x264_encoder_invalidate_reference( x264_t *h, int64_t pts )
+{
+ x264_api_t *api = (x264_api_t *)h;
+
+ return api->encoder_invalidate_reference( api->x264, pts );
+}
}
}
-#if !RDO_SKIP_BS
-extern const uint8_t x264_significant_coeff_flag_offset_8x8[2][64];
-extern const uint8_t x264_last_coeff_flag_offset_8x8[63];
-extern const uint8_t x264_coeff_flag_offset_chroma_422_dc[7];
-extern const uint16_t x264_significant_coeff_flag_offset[2][16];
-extern const uint16_t x264_last_coeff_flag_offset[2][16];
-extern const uint16_t x264_coeff_abs_level_m1_offset[16];
-extern const uint8_t x264_count_cat_m1[14];
-#else
-/* Padded to [64] for easier addressing */
-const uint8_t x264_significant_coeff_flag_offset_8x8[2][64] =
-{{
- 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
- 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
- 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
- 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12
-},{
- 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
- 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
- 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
- 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14
-}};
-const uint8_t x264_last_coeff_flag_offset_8x8[63] =
-{
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
-};
-const uint8_t x264_coeff_flag_offset_chroma_422_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; /* MIN( i/2, 2 ) */
-const uint16_t x264_significant_coeff_flag_offset[2][16] =
-{
- { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718, 0, 0 },
- { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733, 0, 0 }
-};
-const uint16_t x264_last_coeff_flag_offset[2][16] =
-{
- { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748, 0, 0 },
- { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757, 0, 0 }
-};
-const uint16_t x264_coeff_abs_level_m1_offset[16] =
-{
- 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766
-};
-const uint8_t x264_count_cat_m1[14] = {15, 14, 15, 3, 14, 63, 15, 14, 15, 63, 15, 14, 15, 63};
-#endif
-
// node ctx: 0..3: abslevel1 (with abslevelgt1 == 0).
// 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter).
/* map node ctx => cabac ctx for level=1 */
#define bs_write_ue bs_write_ue_big
+// forward declaration needed for template usage
+void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
+void x264_macroblock_cache_load_progressive( x264_t *h, int i_mb_x, int i_mb_y );
+
static int encoder_frame_end( x264_t *h, x264_t *thread_current,
x264_nal_t **pp_nal, int *pi_nal,
x264_picture_t *pic_out );
{
if( !h->param.pf_log )
{
- x264_log( NULL, X264_LOG_ERROR, "pf_log not set! did you forget to call x264_param_default?\n" );
+ x264_log_internal( X264_LOG_ERROR, "pf_log not set! did you forget to call x264_param_default?\n" );
return -1;
}
#include "common/macroblock.h"
-extern const int x264_lambda2_tab[QP_MAX_MAX+1];
-extern const uint16_t x264_lambda_tab[QP_MAX_MAX+1];
-
+#define x264_rdo_init x264_template(rdo_init)
void x264_rdo_init( void );
+#define x264_macroblock_probe_skip x264_template(macroblock_probe_skip)
int x264_macroblock_probe_skip( x264_t *h, int b_bidir );
#define x264_macroblock_probe_pskip( h )\
#define x264_macroblock_probe_bskip( h )\
x264_macroblock_probe_skip( h, 1 )
+#define x264_predict_lossless_4x4 x264_template(predict_lossless_4x4)
void x264_predict_lossless_4x4( x264_t *h, pixel *p_dst, int p, int idx, int i_mode );
+#define x264_predict_lossless_8x8 x264_template(predict_lossless_8x8)
void x264_predict_lossless_8x8( x264_t *h, pixel *p_dst, int p, int idx, int i_mode, pixel edge[36] );
+#define x264_predict_lossless_16x16 x264_template(predict_lossless_16x16)
void x264_predict_lossless_16x16( x264_t *h, int p, int i_mode );
+#define x264_predict_lossless_chroma x264_template(predict_lossless_chroma)
void x264_predict_lossless_chroma( x264_t *h, int i_mode );
+#define x264_macroblock_encode x264_template(macroblock_encode)
void x264_macroblock_encode ( x264_t *h );
+#define x264_macroblock_write_cabac x264_template(macroblock_write_cabac)
void x264_macroblock_write_cabac ( x264_t *h, x264_cabac_t *cb );
+#define x264_macroblock_write_cavlc x264_template(macroblock_write_cavlc)
void x264_macroblock_write_cavlc ( x264_t *h );
+#define x264_macroblock_encode_p8x8 x264_template(macroblock_encode_p8x8)
void x264_macroblock_encode_p8x8( x264_t *h, int i8 );
+#define x264_macroblock_encode_p4x4 x264_template(macroblock_encode_p4x4)
void x264_macroblock_encode_p4x4( x264_t *h, int i4 );
+#define x264_mb_encode_chroma x264_template(mb_encode_chroma)
void x264_mb_encode_chroma( x264_t *h, int b_inter, int i_qp );
+#define x264_cabac_mb_skip x264_template(cabac_mb_skip)
void x264_cabac_mb_skip( x264_t *h, int b_skip );
+#define x264_cabac_block_residual_c x264_template(cabac_block_residual_c)
void x264_cabac_block_residual_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l );
+#define x264_cabac_block_residual_8x8_rd_c x264_template(cabac_block_residual_8x8_rd_c)
void x264_cabac_block_residual_8x8_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l );
+#define x264_cabac_block_residual_rd_c x264_template(cabac_block_residual_rd_c)
void x264_cabac_block_residual_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l );
+#define x264_quant_luma_dc_trellis x264_template(quant_luma_dc_trellis)
int x264_quant_luma_dc_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, int i_qp,
int ctx_block_cat, int b_intra, int idx );
+#define x264_quant_chroma_dc_trellis x264_template(quant_chroma_dc_trellis)
int x264_quant_chroma_dc_trellis( x264_t *h, dctcoef *dct, int i_qp, int b_intra, int idx );
+#define x264_quant_4x4_trellis x264_template(quant_4x4_trellis)
int x264_quant_4x4_trellis( x264_t *h, dctcoef *dct, int i_quant_cat,
int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx );
+#define x264_quant_8x8_trellis x264_template(quant_8x8_trellis)
int x264_quant_8x8_trellis( x264_t *h, dctcoef *dct, int i_quant_cat,
int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx );
+#define x264_noise_reduction_update x264_template(noise_reduction_update)
void x264_noise_reduction_update( x264_t *h );
static ALWAYS_INLINE int x264_quant_4x4( x264_t *h, dctcoef dct[16], int i_qp, int ctx_block_cat, int b_intra, int p, int idx )
/* Don't unroll the BIME_CACHE loop. I couldn't find any way to force this
* other than making its iteration count not a compile-time constant. */
+#define x264_iter_kludge x264_template(iter_kludge)
int x264_iter_kludge = 0;
static void ALWAYS_INLINE me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2, int rd )
ALIGNED_4( int16_t mv[2] );
} ALIGNED_64( x264_me_t );
+#define x264_me_search_ref x264_template(me_search_ref)
void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh );
#define x264_me_search( h, m, mvc, i_mvc )\
x264_me_search_ref( h, m, mvc, i_mvc, NULL )
+#define x264_me_refine_qpel x264_template(me_refine_qpel)
void x264_me_refine_qpel( x264_t *h, x264_me_t *m );
+#define x264_me_refine_qpel_refdupe x264_template(me_refine_qpel_refdupe)
void x264_me_refine_qpel_refdupe( x264_t *h, x264_me_t *m, int *p_halfpel_thresh );
+#define x264_me_refine_qpel_rd x264_template(me_refine_qpel_rd)
void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int i_list );
+#define x264_me_refine_bidir_rd x264_template(me_refine_bidir_rd)
void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 );
+#define x264_me_refine_bidir_satd x264_template(me_refine_bidir_satd)
void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight );
+#define x264_rd_cost_part x264_template(rd_cost_part)
uint64_t x264_rd_cost_part( x264_t *h, int i_lambda2, int i8, int i_pixel );
#define COPY1_IF_LT(x,y)\
#define CLIP_DURATION(f) x264_clip3f(f,MIN_FRAME_DURATION,MAX_FRAME_DURATION)
+#define x264_ratecontrol_new x264_template(ratecontrol_new)
int x264_ratecontrol_new ( x264_t * );
+#define x264_ratecontrol_delete x264_template(ratecontrol_delete)
void x264_ratecontrol_delete( x264_t * );
+#define x264_ratecontrol_init_reconfigurable x264_template(ratecontrol_init_reconfigurable)
void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init );
+#define x264_encoder_reconfig_apply x264_template(encoder_reconfig_apply)
int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param );
+#define x264_adaptive_quant_frame x264_template(adaptive_quant_frame)
void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets );
+#define x264_macroblock_tree_read x264_template(macroblock_tree_read)
int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets );
+#define x264_reference_build_list_optimal x264_template(reference_build_list_optimal)
int x264_reference_build_list_optimal( x264_t *h );
+#define x264_thread_sync_ratecontrol x264_template(thread_sync_ratecontrol)
void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next );
+#define x264_ratecontrol_zone_init x264_template(ratecontrol_zone_init)
void x264_ratecontrol_zone_init( x264_t * );
+#define x264_ratecontrol_start x264_template(ratecontrol_start)
void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead );
+#define x264_ratecontrol_slice_type x264_template(ratecontrol_slice_type)
int x264_ratecontrol_slice_type( x264_t *, int i_frame );
+#define x264_ratecontrol_set_weights x264_template(ratecontrol_set_weights)
void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm );
+#define x264_ratecontrol_mb x264_template(ratecontrol_mb)
int x264_ratecontrol_mb( x264_t *, int bits );
+#define x264_ratecontrol_qp x264_template(ratecontrol_qp)
int x264_ratecontrol_qp( x264_t * );
+#define x264_ratecontrol_mb_qp x264_template(ratecontrol_mb_qp)
int x264_ratecontrol_mb_qp( x264_t *h );
+#define x264_ratecontrol_end x264_template(ratecontrol_end)
int x264_ratecontrol_end( x264_t *, int bits, int *filler );
+#define x264_ratecontrol_summary x264_template(ratecontrol_summary)
void x264_ratecontrol_summary( x264_t * );
+#define x264_rc_analyse_slice x264_template(rc_analyse_slice)
int x264_rc_analyse_slice( x264_t *h );
+#define x264_threads_distribute_ratecontrol x264_template(threads_distribute_ratecontrol)
void x264_threads_distribute_ratecontrol( x264_t *h );
+#define x264_threads_merge_ratecontrol x264_template(threads_merge_ratecontrol)
void x264_threads_merge_ratecontrol( x264_t *h );
+#define x264_hrd_fullness x264_template(hrd_fullness)
void x264_hrd_fullness( x264_t *h );
+
#endif
/* Transition and size tables for abs<9 MVD and residual coding */
/* Consist of i_prefix-2 1s, one zero, and a bypass sign bit */
+#define x264_cabac_transition_unary x264_template(cabac_transition_unary)
uint8_t x264_cabac_transition_unary[15][128];
+#define x264_cabac_size_unary x264_template(cabac_size_unary)
uint16_t x264_cabac_size_unary[15][128];
/* Transition and size tables for abs>9 MVD */
/* Consist of 5 1s and a bypass sign bit */
#define bs_write_ue(s,v) ((s)->i_bits_encoded += bs_size_ue(v))
#define bs_write_se(s,v) ((s)->i_bits_encoded += bs_size_se(v))
#define bs_write_te(s,v,l) ((s)->i_bits_encoded += bs_size_te(v,l))
+#undef x264_macroblock_write_cavlc
#define x264_macroblock_write_cavlc static macroblock_size_cavlc
#include "cavlc.c"
#undef x264_cabac_encode_decision_noup
#undef x264_cabac_encode_bypass
#undef x264_cabac_encode_terminal
+#undef x264_cabac_encode_ue_bypass
#define x264_cabac_encode_decision(c,x,v) x264_cabac_size_decision(c,x,v)
#define x264_cabac_encode_decision_noup(c,x,v) x264_cabac_size_decision_noup(c,x,v)
#define x264_cabac_encode_terminal(c) ((c)->f8_bits_encoded += 7)
#define x264_cabac_encode_bypass(c,v) ((c)->f8_bits_encoded += 256)
#define x264_cabac_encode_ue_bypass(c,e,v) ((c)->f8_bits_encoded += (bs_size_ue_big(v+(1<<e)-1)-e)<<8)
+#undef x264_macroblock_write_cabac
#define x264_macroblock_write_cabac static macroblock_size_cabac
#include "cabac.c"
return 0;
}
-const x264_level_t x264_levels[] =
-{
- { 10, 1485, 99, 396, 64, 175, 64, 64, 0, 2, 0, 0, 1 },
- { 9, 1485, 99, 396, 128, 350, 64, 64, 0, 2, 0, 0, 1 }, /* "1b" */
- { 11, 3000, 396, 900, 192, 500, 128, 64, 0, 2, 0, 0, 1 },
- { 12, 6000, 396, 2376, 384, 1000, 128, 64, 0, 2, 0, 0, 1 },
- { 13, 11880, 396, 2376, 768, 2000, 128, 64, 0, 2, 0, 0, 1 },
- { 20, 11880, 396, 2376, 2000, 2000, 128, 64, 0, 2, 0, 0, 1 },
- { 21, 19800, 792, 4752, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 },
- { 22, 20250, 1620, 8100, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 },
- { 30, 40500, 1620, 8100, 10000, 10000, 256, 32, 22, 2, 0, 1, 0 },
- { 31, 108000, 3600, 18000, 14000, 14000, 512, 16, 60, 4, 1, 1, 0 },
- { 32, 216000, 5120, 20480, 20000, 20000, 512, 16, 60, 4, 1, 1, 0 },
- { 40, 245760, 8192, 32768, 20000, 25000, 512, 16, 60, 4, 1, 1, 0 },
- { 41, 245760, 8192, 32768, 50000, 62500, 512, 16, 24, 2, 1, 1, 0 },
- { 42, 522240, 8704, 34816, 50000, 62500, 512, 16, 24, 2, 1, 1, 1 },
- { 50, 589824, 22080, 110400, 135000, 135000, 512, 16, 24, 2, 1, 1, 1 },
- { 51, 983040, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
- { 52, 2073600, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
- { 60, 4177920, 139264, 696320, 240000, 240000, 8192, 16, 24, 2, 1, 1, 1 },
- { 61, 8355840, 139264, 696320, 480000, 480000, 8192, 16, 24, 2, 1, 1, 1 },
- { 62, 16711680, 139264, 696320, 800000, 800000, 8192, 16, 24, 2, 1, 1, 1 },
- { 0 }
-};
-
#define ERROR(...)\
{\
if( verbose )\
#ifndef X264_ENCODER_SET_H
#define X264_ENCODER_SET_H
+#define x264_sps_init x264_template(sps_init)
void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param );
+#define x264_sps_init_reconfigurable x264_template(sps_init_reconfigurable)
void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param );
+#define x264_sps_write x264_template(sps_write)
void x264_sps_write( bs_t *s, x264_sps_t *sps );
+#define x264_pps_init x264_template(pps_init)
void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *sps );
+#define x264_pps_write x264_template(pps_write)
void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps );
+#define x264_sei_recovery_point_write x264_template(sei_recovery_point_write)
void x264_sei_recovery_point_write( x264_t *h, bs_t *s, int recovery_frame_cnt );
+#define x264_sei_version_write x264_template(sei_version_write)
int x264_sei_version_write( x264_t *h, bs_t *s );
+#define x264_validate_levels x264_template(validate_levels)
int x264_validate_levels( x264_t *h, int verbose );
+#define x264_sei_buffering_period_write x264_template(sei_buffering_period_write)
void x264_sei_buffering_period_write( x264_t *h, bs_t *s );
+#define x264_sei_pic_timing_write x264_template(sei_pic_timing_write)
void x264_sei_pic_timing_write( x264_t *h, bs_t *s );
+#define x264_sei_dec_ref_pic_marking_write x264_template(sei_dec_ref_pic_marking_write)
void x264_sei_dec_ref_pic_marking_write( x264_t *h, bs_t *s );
+#define x264_sei_frame_packing_write x264_template(sei_frame_packing_write)
void x264_sei_frame_packing_write( x264_t *h, bs_t *s );
+#define x264_sei_avcintra_umid_write x264_template(sei_avcintra_umid_write)
int x264_sei_avcintra_umid_write( x264_t *h, bs_t *s );
+#define x264_sei_avcintra_vanc_write x264_template(sei_avcintra_vanc_write)
int x264_sei_avcintra_vanc_write( x264_t *h, bs_t *s, int len );
+#define x264_sei_write x264_template(sei_write)
void x264_sei_write( bs_t *s, uint8_t *payload, int payload_size, int payload_type );
+#define x264_filler_write x264_template(filler_write)
void x264_filler_write( x264_t *h, bs_t *s, int filler );
#endif
#include "common/common.h"
#include "macroblock.h"
#include "me.h"
+#include "slicetype-cl.h"
#if HAVE_OPENCL
#ifdef _WIN32
#include <windows.h>
#endif
+#define x264_weights_analyse x264_template(weights_analyse)
void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead );
/* We define CL_QUEUE_THREAD_HANDLE_AMD here because it is not defined
--- /dev/null
+/*****************************************************************************
+ * slicetype-cl.h: OpenCL slicetype decision code (lowres lookahead)
+ *****************************************************************************
+ * Copyright (C) 2017 x264 project
+ *
+ * Authors: Anton Mitrofanov <BugMaster@narod.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
+ *****************************************************************************/
+
+#ifndef X264_ENCODER_SLICETYPE_CL_H
+#define X264_ENCODER_SLICETYPE_CL_H
+
+#define x264_opencl_lowres_init x264_template(opencl_lowres_init)
+int x264_opencl_lowres_init( x264_t *h, x264_frame_t *fenc, int lambda );
+#define x264_opencl_motionsearch x264_template(opencl_motionsearch)
+int x264_opencl_motionsearch( x264_t *h, x264_frame_t **frames, int b, int ref, int b_islist1, int lambda, const x264_weight_t *w );
+#define x264_opencl_finalize_cost x264_template(opencl_finalize_cost)
+int x264_opencl_finalize_cost( x264_t *h, int lambda, x264_frame_t **frames, int p0, int p1, int b, int dist_scale_factor );
+#define x264_opencl_precalculate_frame_cost x264_template(opencl_precalculate_frame_cost)
+int x264_opencl_precalculate_frame_cost( x264_t *h, x264_frame_t **frames, int lambda, int p0, int p1, int b );
+#define x264_opencl_flush x264_template(opencl_flush)
+void x264_opencl_flush( x264_t *h );
+#define x264_opencl_slicetype_prep x264_template(opencl_slicetype_prep)
+void x264_opencl_slicetype_prep( x264_t *h, x264_frame_t **frames, int num_frames, int lambda );
+#define x264_opencl_slicetype_end x264_template(opencl_slicetype_end)
+void x264_opencl_slicetype_end( x264_t *h );
+
+#endif
static int slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a,
x264_frame_t **frames, int p0, int p1, int b );
+#define x264_weights_analyse x264_template(weights_analyse)
void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead );
#if HAVE_OPENCL
-int x264_opencl_lowres_init( x264_t *h, x264_frame_t *fenc, int lambda );
-int x264_opencl_motionsearch( x264_t *h, x264_frame_t **frames, int b, int ref, int b_islist1, int lambda, const x264_weight_t *w );
-int x264_opencl_finalize_cost( x264_t *h, int lambda, x264_frame_t **frames, int p0, int p1, int b, int dist_scale_factor );
-int x264_opencl_precalculate_frame_cost( x264_t *h, x264_frame_t **frames, int lambda, int p0, int p1, int b );
-void x264_opencl_flush( x264_t *h );
-void x264_opencl_slicetype_prep( x264_t *h, x264_frame_t **frames, int num_frames, int lambda );
-void x264_opencl_slicetype_end( x264_t *h );
+#include "slicetype-cl.h"
#endif
static void lowres_context_init( x264_t *h, x264_mb_analysis_t *a )
goto fail;
/* Configure non-default params */
+ param.i_bitdepth = 8;
param.i_csp = X264_CSP_I420;
param.i_width = width;
param.i_height = height;
*****************************************************************************/
#include "filters.h"
+
#define RETURN_IF_ERROR( cond, ... ) RETURN_IF_ERR( cond, "options", NULL, __VA_ARGS__ )
char **x264_split_options( const char *opt_str, const char * const *options )
#include "video.h"
#include "internal.h"
-#define NAME "cache"
+#include "common/common.h"
+
+#define cache_filter x264_glue3(cache, BIT_DEPTH, filter)
+#if BIT_DEPTH == 8
+#define NAME "cache_8"
+#else
+#define NAME "cache_10"
+#endif
+
#define LAST_FRAME (h->first_frame + h->cur_size - 1)
typedef struct
*****************************************************************************/
#include "video.h"
+
#define NAME "crop"
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, NAME, __VA_ARGS__ )
*****************************************************************************/
#include "video.h"
-#define NAME "depth"
+#include "common/common.h"
+
+#define depth_filter x264_glue3(depth, BIT_DEPTH, filter)
+#if BIT_DEPTH == 8
+#define NAME "depth_8"
+#else
+#define NAME "depth_10"
+#endif
+
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, NAME, __VA_ARGS__ )
cli_vid_filter_t depth_filter;
static void dither_plane_##pitch( pixel *dst, int dst_stride, uint16_t *src, int src_stride, \
int width, int height, int16_t *errors ) \
{ \
- const int lshift = 16-X264_BIT_DEPTH; \
- const int rshift = 16-X264_BIT_DEPTH+2; \
- const int half = 1 << (16-X264_BIT_DEPTH+1); \
- const int pixel_max = (1 << X264_BIT_DEPTH)-1; \
+ const int lshift = 16-BIT_DEPTH; \
+ const int rshift = 16-BIT_DEPTH+2; \
+ const int half = 1 << (16-BIT_DEPTH+1); \
+ const int pixel_max = (1 << BIT_DEPTH)-1; \
memset( errors, 0, (width+1) * sizeof(int16_t) ); \
for( int y = 0; y < height; y++, src += src_stride, dst += dst_stride ) \
{ \
static void scale_image( cli_image_t *output, cli_image_t *img )
{
int csp_mask = img->csp & X264_CSP_MASK;
- const int shift = X264_BIT_DEPTH - 8;
+ const int shift = BIT_DEPTH - 8;
for( int i = 0; i < img->planes; i++ )
{
uint8_t *src = img->plane[i];
ret = 1;
}
- FAIL_IF_ERROR( bit_depth != X264_BIT_DEPTH, "this build supports only bit depth %d\n", X264_BIT_DEPTH );
+ FAIL_IF_ERROR( bit_depth != BIT_DEPTH, "this filter supports only bit depth %d\n", BIT_DEPTH );
FAIL_IF_ERROR( ret, "unsupported bit depth conversion.\n" );
/* only add the filter to the chain if it's needed */
*****************************************************************************/
#include "internal.h"
+
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "x264", __VA_ARGS__ )
void x264_cli_plane_copy( uint8_t *dst, int i_dst, uint8_t *src, int i_src, int w, int h )
#ifndef X264_FILTER_VIDEO_INTERNAL_H
#define X264_FILTER_VIDEO_INTERNAL_H
+
#include "video.h"
void x264_cli_plane_copy( uint8_t *dst, int i_dst, uint8_t *src, int i_src, int w, int h );
*****************************************************************************/
#include "video.h"
+
#define NAME "resize"
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, NAME, __VA_ARGS__ )
*****************************************************************************/
#include "video.h"
+
#define NAME "select_every"
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, NAME, __VA_ARGS__ )
if( max_rewind == h->step_size )
break;
}
- if( x264_init_vid_filter( "cache", handle, filter, info, param, (void*)max_rewind ) )
+ char name[20];
+ sprintf( name, "cache_%d", param->i_bitdepth );
+ if( x264_init_vid_filter( name, handle, filter, info, param, (void*)max_rewind ) )
return -1;
/* done initing, overwrite properties */
{
extern cli_vid_filter_t source_filter;
first_filter = &source_filter;
- REGISTER_VFILTER( cache );
+#if HAVE_BITDEPTH8
+ REGISTER_VFILTER( cache_8 );
+ REGISTER_VFILTER( depth_8 );
+#endif
+#if HAVE_BITDEPTH10
+ REGISTER_VFILTER( cache_10 );
+ REGISTER_VFILTER( depth_10 );
+#endif
REGISTER_VFILTER( crop );
REGISTER_VFILTER( fix_vfr_pts );
REGISTER_VFILTER( resize );
REGISTER_VFILTER( select_every );
- REGISTER_VFILTER( depth );
#if HAVE_GPL
#endif
}
*****************************************************************************/
#include "input.h"
+
#if USE_AVXSYNTH
#include <dlfcn.h>
#if SYS_MACOSX
#define avs_close FreeLibrary
#define avs_address GetProcAddress
#endif
-#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "avs", __VA_ARGS__ )
#define AVSC_NO_DECLSPEC
#undef EXTERN_C
#endif
#define AVSC_DECLARE_FUNC(name) name##_func name
+#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "avs", __VA_ARGS__ )
+
/* AVS uses a versioned interface to control backwards compatibility */
/* YV12 support is required, which was added in 2.5 */
#define AVS_INTERFACE_25 2
#include "input.h"
#include <ffms.h>
-#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "ffms", __VA_ARGS__ )
#undef DECLARE_ALIGNED
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
+#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "ffms", __VA_ARGS__ )
+
#define PROGRESS_LENGTH 36
typedef struct
extern const cli_input_t raw_input;
extern const cli_input_t y4m_input;
extern const cli_input_t avs_input;
-extern const cli_input_t thread_input;
+extern const cli_input_t thread_8_input;
+extern const cli_input_t thread_10_input;
extern const cli_input_t lavf_input;
extern const cli_input_t ffms_input;
extern const cli_input_t timecode_input;
*****************************************************************************/
#include "input.h"
-#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "lavf", __VA_ARGS__ )
+
#undef DECLARE_ALIGNED
#include <libavformat/avformat.h>
#include <libavutil/mem.h>
#include <libavutil/pixdesc.h>
#include <libavutil/dict.h>
+#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "lavf", __VA_ARGS__ )
+
typedef struct
{
AVFormatContext *lavf;
*****************************************************************************/
#include "input.h"
+
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "raw", __VA_ARGS__ )
typedef struct
*****************************************************************************/
#include "input.h"
+#include "common/common.h"
+
+#define thread_input x264_glue3(thread, BIT_DEPTH, input)
typedef struct
{
*****************************************************************************/
#include "input.h"
+
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "timecode", __VA_ARGS__ )
typedef struct
*****************************************************************************/
#include "input.h"
+
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "y4m", __VA_ARGS__ )
typedef struct
mov w9, #0
str w9, [x2]
movrel x0, error_message
- bl X(puts)
+ bl EXT(puts)
0:
ldp x0, x1, [sp], #16
ldp d14, d15, [sp], #16
mov r12, #0
str r12, [r2]
movrel r0, error_message
-#ifdef PREFIX
- blx _puts
-#else
- blx puts
-#endif
+ blx EXT(puts)
0:
pop {r0, r1}
.ifc \variant, neon
#include <ctype.h>
#include "common/common.h"
-#include "common/cpu.h"
#include "encoder/macroblock.h"
#ifdef _WIN32
#include <signal.h>
#include <getopt.h>
-#include "common/common.h"
#include "x264cli.h"
#include "input/input.h"
#include "output/output.h"
#include "filters/filters.h"
+#define QP_MAX_SPEC (51+6*2)
+#define QP_MAX (QP_MAX_SPEC+18)
+
#define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "x264", __VA_ARGS__ )
#if HAVE_LAVF
#else
printf( "using an unknown compiler\n" );
#endif
- printf( "x264 configuration: --bit-depth=%d --chroma-format=%s\n", X264_BIT_DEPTH, chroma_format_names[X264_CHROMA_FORMAT] );
- printf( "libx264 configuration: --bit-depth=%d --chroma-format=%s\n", x264_bit_depth, chroma_format_names[x264_chroma_format] );
+ printf( "x264 configuration: --chroma-format=%s\n", chroma_format_names[X264_CHROMA_FORMAT] );
+ printf( "libx264 configuration: --chroma-format=%s\n", chroma_format_names[x264_chroma_format] );
printf( "x264 license: " );
#if HAVE_GPL
printf( "GPL version 2 or later\n" );
" .mkv -> Matroska\n"
" .flv -> Flash Video\n"
" .mp4 -> MP4 if compiled with GPAC or L-SMASH support (%s)\n"
- "Output bit depth: %d (configured at compile time)\n"
+ "Output bit depth: %s\n."
"\n"
"Options:\n"
"\n"
#else
"no",
#endif
- x264_bit_depth
+#if HAVE_BITDEPTH8 && HAVE_BITDEPTH10
+ "8/10"
+#elif HAVE_BITDEPTH8
+ "8"
+#elif HAVE_BITDEPTH10
+ "10"
+#else
+ "none"
+#endif
);
H0( "Example usage:\n" );
H0( "\n" );
" Overrides all settings.\n" );
H2(
#if X264_CHROMA_FORMAT <= X264_CSP_I420
-#if X264_BIT_DEPTH==8
" - baseline:\n"
" --no-8x8dct --bframes 0 --no-cabac\n"
" --cqm flat --weightp 0\n"
" No lossless.\n"
" - high:\n"
" No lossless.\n"
-#endif
" - high10:\n"
" No lossless.\n"
" Support for bit depth 8-10.\n"
else H0(
" - "
#if X264_CHROMA_FORMAT <= X264_CSP_I420
-#if X264_BIT_DEPTH==8
- "baseline,main,high,"
-#endif
- "high10,"
+ "baseline,main,high,high10,"
#endif
#if X264_CHROMA_FORMAT <= X264_CSP_I422
"high422,"
H1( " --output-csp <string> Specify output colorspace [\"%s\"]\n"
" - %s\n", output_csp_names[0], stringify_names( buf, output_csp_names ) );
H1( " --input-depth <integer> Specify input bit depth for raw input\n" );
+ H1( " --output-depth <integer> Specify output bit depth\n" );
H1( " --input-range <string> Specify input color range [\"%s\"]\n"
" - %s\n", range_names[0], stringify_names( buf, range_names ) );
H1( " --input-res <intxint> Specify input resolution (width x height)\n" );
OPT_INPUT_RES,
OPT_INPUT_CSP,
OPT_INPUT_DEPTH,
+ OPT_OUTPUT_DEPTH,
OPT_DTS_COMPRESSION,
OPT_OUTPUT_CSP,
OPT_INPUT_RANGE,
{ "input-res", required_argument, NULL, OPT_INPUT_RES },
{ "input-csp", required_argument, NULL, OPT_INPUT_CSP },
{ "input-depth", required_argument, NULL, OPT_INPUT_DEPTH },
+ { "output-depth", required_argument, NULL, OPT_OUTPUT_DEPTH },
{ "dts-compress", no_argument, NULL, OPT_DTS_COMPRESSION },
{ "output-csp", required_argument, NULL, OPT_OUTPUT_CSP },
{ "input-range", required_argument, NULL, OPT_INPUT_RANGE },
if( x264_init_vid_filter( "resize", handle, &filter, info, param, NULL ) )
return -1;
- char args[20];
- sprintf( args, "bit_depth=%d", x264_bit_depth );
+ char args[20], name[20];
+ sprintf( args, "bit_depth=%d", param->i_bitdepth );
+ sprintf( name, "depth_%d", param->i_bitdepth );
- if( x264_init_vid_filter( "depth", handle, &filter, info, param, args ) )
+ if( x264_init_vid_filter( name, handle, &filter, info, param, args ) )
return -1;
return 0;
case OPT_INPUT_DEPTH:
input_opt.bit_depth = atoi( optarg );
break;
+ case OPT_OUTPUT_DEPTH:
+ param->i_bitdepth = atoi( optarg );
+ break;
case OPT_DTS_COMPRESSION:
output_opt.use_dts_compress = 1;
break;
/* init threaded input while the information about the input video is unaltered by filtering */
#if HAVE_THREAD
- if( info.thread_safe && (b_thread_input || param->i_threads > 1
+ const cli_input_t *thread_input;
+ if( HAVE_BITDEPTH8 && param->i_bitdepth == 8 )
+ thread_input = &thread_8_input;
+ else if( HAVE_BITDEPTH10 && param->i_bitdepth == 10 )
+ thread_input = &thread_10_input;
+ else
+ thread_input = NULL;
+
+ if( thread_input && info.thread_safe && (b_thread_input || param->i_threads > 1
|| (param->i_threads == X264_THREADS_AUTO && x264_cpu_num_processors() > 1)) )
{
- if( thread_input.open_file( NULL, &opt->hin, &info, NULL ) )
+ if( thread_input->open_file( NULL, &opt->hin, &info, NULL ) )
{
fprintf( stderr, "x264 [error]: threaded input failed\n" );
return -1;
}
- cli_input = thread_input;
+ cli_input = *thread_input;
}
#endif
#include "x264_config.h"
-#define X264_BUILD 152
+#define X264_BUILD 153
/* Application developers planning to link against a shared library version of
* libx264 from a Microsoft Visual Studio or similar development environment
int i_width;
int i_height;
int i_csp; /* CSP of encoded bitstream */
+ int i_bitdepth;
int i_level_idc;
int i_frame_total; /* number of frames to encode if known, else 0 */
* Picture structures and functions
****************************************************************************/
-/* x264_bit_depth:
- * Specifies the number of bits per pixel that x264 uses. This is also the
- * bit depth that x264 encodes in. If this value is > 8, x264 will read
- * two bytes of input data for each pixel sample, and expect the upper
- * (16-x264_bit_depth) bits to be zero.
- * Note: The flag X264_CSP_HIGH_DEPTH must be used to specify the
- * colorspace depth as well. */
-X264_API extern const int x264_bit_depth;
-
/* x264_chroma_format:
* Specifies the chroma formats that x264 supports encoding. When this
* value is non-zero, then it represents a X264_CSP_* that is the only
* return the number of currently delayed (buffered) frames
* this should be used at the end of the stream, to know when you have all the encoded frames. */
int x264_encoder_delayed_frames( x264_t * );
-/* x264_encoder_maximum_delayed_frames( x264_t *h ):
+/* x264_encoder_maximum_delayed_frames( x264_t * ):
* return the maximum number of delayed (buffered) frames that can occur with the current
* parameters. */
-int x264_encoder_maximum_delayed_frames( x264_t *h );
+int x264_encoder_maximum_delayed_frames( x264_t * );
/* x264_encoder_intra_refresh:
* If an intra refresh is not in progress, begin one with the next P-frame.
* If an intra refresh is in progress, begin one as soon as the current one finishes.
#ifndef X264_CLI_H
#define X264_CLI_H
-#include "common/common.h"
+#include "common/base.h"
/* In microseconds */
#define UPDATE_INTERVAL 250000
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
-#include "common/common.h"
+#include "common/base.h"
#include <windows.h>
/* Callback for our DLL so we can initialize pthread */