[x264-devel] Resend: I tried to add 12 bit depth support into x264 (probably wrongly)
Andrew Randrianasulu
randrianasulu at gmail.com
Sat Mar 21 00:37:41 CET 2020
Resend after subscription
---------- Пересланное сообщение ----------
Тема: I tried to add 12 bit depth support into x264 (probably wrongly)
Дата: Суббота 21 марта 2020
Отправитель: Andrew Randrianasulu <randrianasulu at gmail.com>
Получатель: x264-devel at videolan.org, BugMaster at narod.ru
Hi all.
I was searching for various news surrounding x264
and found this old thread:
https://mailman.videolan.org/pipermail/x264-devel/2015-September/011413.html
"Support 12bit and add ultra calss" - yes, complete with typo.
There was suggestion about splitting patch into 12-bit support and class support ...
I think 12 bit part was simple, but I have no idea how to test it!
diff --git a/Makefile b/Makefile
index efc863fb..300417e0 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,7 @@ OBJCLI =
OBJCHK =
OBJCHK_8 =
OBJCHK_10 =
+OBJCHK_12 =
OBJEXAMPLE =
CONFIG := $(shell cat config.h)
@@ -234,6 +235,13 @@ OBJCLI += $(SRCCLI_X:%.c=%-10.o)
OBJCHK_10 += $(SRCCHK_X:%.c=%-10.o)
checkasm: checkasm10$(EXE)
endif
+ifneq ($(findstring HAVE_BITDEPTH12 1, $(CONFIG)),)
+OBJS += $(SRCS_X:%.c=%-12.o)
+OBJCLI += $(SRCCLI_X:%.c=%-12.o)
+OBJCHK_12 += $(SRCCHK_X:%.c=%-12.o)
+checkasm: checkasm12$(EXE)
+endif
+
.PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* checkasm etags
@@ -256,6 +264,7 @@ ifneq ($(EXE),)
x264: x264$(EXE)
checkasm8: checkasm8$(EXE)
checkasm10: checkasm10$(EXE)
+checkasm12: checkasm12$(EXE)
example: example$(EXE)
endif
@@ -267,6 +276,9 @@ checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_8) $(LIBX264)
checkasm10$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_10) $(LIBX264)
$(LD)$@ $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LDFLAGS)
+
+checkasm12$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_12) $(LIBX264)
+ $(LD)$@ $(OBJCHK) $(OBJCHK_12) $(LIBX264) $(LDFLAGS)
example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264)
$(LD)$@ $(OBJEXAMPLE) $(LIBX264) $(LDFLAGS)
@@ -274,7 +286,7 @@ example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264)
$(OBJS) $(OBJSO): CFLAGS += $(CFLAGSSO)
$(OBJCLI): CFLAGS += $(CFLAGSCLI)
-$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXAMPLE): .depend
+$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJCHK_12) $(OBJEXAMPLE): .depend
%.o: %.c
$(CC) $(CFLAGS) -c $< $(CC_O)
@@ -284,6 +296,9 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXA
%-10.o: %.c
$(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10
+
+%-12.o: %.c
+ $(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=12
%.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
$(AS) $(ASFLAGS) -o $@ $<
@@ -296,6 +311,10 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXA
%-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 $@)
+
+%-12.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
+ $(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=12 -Dprivate_prefix=x264_12
+ -@ $(if $(STRIP), $(STRIP) -x $@)
%.o: %.S
$(AS) $(ASFLAGS) -o $@ $<
@@ -308,6 +327,10 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXA
%-10.o: %.S
$(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10
-@ $(if $(STRIP), $(STRIP) -x $@)
+
+%-12.o: %.S
+ $(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=12
+ -@ $(if $(STRIP), $(STRIP) -x $@)
%.dll.o: %.rc x264.h
$(RC) $(RCFLAGS)$@ -DDLL $<
@@ -326,6 +349,9 @@ 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
+ifneq ($(findstring HAVE_BITDEPTH12 1, $(CONFIG)),)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-12.o)" 1>> .depend;)
+endif
else
@$(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)),)
@@ -334,6 +360,9 @@ 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
+ifneq ($(findstring HAVE_BITDEPTH12 1, $(CONFIG)),)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-12.o) $(DEPMM) 1>> .depend;)
+endif
endif
config.mak:
@@ -377,7 +406,7 @@ endif
clean:
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 checkasm8$(EXE) checkasm10$(EXE) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJCHK_12)
rm -f example$(EXE) $(OBJEXAMPLE)
rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc
diff --git a/common/macroblock.h b/common/macroblock.h
index 2d566cfe..a73f0c05 100644
--- a/common/macroblock.h
+++ b/common/macroblock.h
@@ -250,6 +250,12 @@ static const uint8_t i_chroma_qp_table[QP_MAX+1+12*2] =
{
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
+#if BIT_DEPTH > 11
+ QP(-24), QP(-23), QP(-22), QP(-21), QP(-20), QP(-19),
+#endif
+#if BIT_DEPTH > 10
+ QP(-18), QP(-17), QP(-16), QP(-15), QP(-14), QP(-13),
+#endif
#if BIT_DEPTH > 9
QP(-12),QP(-11),QP(-10), QP(-9), QP(-8), QP(-7),
#endif
diff --git a/configure b/configure
index 181a67be..a807859b 100755
--- a/configure
+++ b/configure
@@ -405,7 +405,7 @@ NL="
# list of all preprocessor HAVE values we can define
CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON AARCH64 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 CLOCK_GETTIME BITDEPTH8 BITDEPTH10"
+ MSA MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R CLOCK_GETTIME BITDEPTH8 BITDEPTH10 BITDEPTH12"
# parse options
@@ -519,8 +519,8 @@ for opt do
;;
--bit-depth=*)
bit_depth="$optarg"
- if [ "$bit_depth" != "8" -a "$bit_depth" != "10" -a "$bit_depth" != "all" ]; then
- echo "Supplied bit depth must be 8, 10 or all."
+ if [ "$bit_depth" != "8" -a "$bit_depth" != "10" -a "$bit_depth" != "12" -a "$bit_depth" != "all" ]; then
+ echo "Supplied bit depth must be 8, 10, 12 or all."
exit 1
fi
;;
@@ -1344,10 +1344,13 @@ fi
if [ "$bit_depth" = "all" ]; then
define HAVE_BITDEPTH8
define HAVE_BITDEPTH10
+ define HAVE_BITDEPTH12
elif [ "$bit_depth" -eq "8" ]; then
define HAVE_BITDEPTH8
elif [ "$bit_depth" -eq "10" ]; then
define HAVE_BITDEPTH10
+elif [ "$bit_depth" -eq "12" ]; then
+ define HAVE_BITDEPTH12
opencl="no"
fi
diff --git a/input/input.h b/input/input.h
index 43b3218d..486b1135 100644
--- a/input/input.h
+++ b/input/input.h
@@ -104,6 +104,7 @@ extern const cli_input_t y4m_input;
extern const cli_input_t avs_input;
extern const cli_input_t thread_8_input;
extern const cli_input_t thread_10_input;
+extern const cli_input_t thread_12_input;
extern const cli_input_t lavf_input;
extern const cli_input_t ffms_input;
extern const cli_input_t timecode_input;
diff --git a/x264.c b/x264.c
index 624f3420..63496a68 100644
--- a/x264.c
+++ b/x264.c
@@ -541,12 +541,16 @@ static void help( x264_param_t *defaults, int longhelp )
#else
"no",
#endif
-#if HAVE_BITDEPTH8 && HAVE_BITDEPTH10
+#if HAVE_BITDEPTH8 && HAVE_BITDEPTH10 && HAVE_BITDEPTH12
+ "8/10/12"
+#elif HAVE_BITDEPTH8 && HAVE_BITDEPTH10
"8/10"
#elif HAVE_BITDEPTH8
"8"
#elif HAVE_BITDEPTH10
"10"
+#elif HAVE_BITDEPTH12
+ "12"
#else
"none"
#endif
----
relative to commit 1771b556ee45207f8711744ccbd5d42a3949b14c
hm .... I hope no one will complain if I add latest author in CC too ....
-------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 12-bits_added_q.diff
Type: text/x-diff
Size: 7665 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20200321/3f90aa16/attachment.diff>
More information about the x264-devel
mailing list