Created
April 15, 2014 06:36
-
-
Save torque/10707556 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 514640c6cbd8 Makefile | |
--- a/Makefile Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/Makefile Mon Apr 14 23:35:03 2014 -0700 | |
@@ -2,13 +2,19 @@ | |
# Override the default compiler with `make CXX=g++` or so | |
# Build on *nix with `make EXE=` | |
WARNINGS := -pedantic -Wall | |
+CC := clang | |
CXX := clang++ | |
-CXXFLAGS := $(WARNINGS) -std=c++11 | |
+# CC := gcc-4.8 | |
+# CXX := g++-4.8 | |
+CFLAGS := | |
+#-fno-operator-names needed for jitasm.h | |
+CXXFLAGS := $(WARNINGS) -std=c++11 -fno-operator-names | |
LIBS := | |
# Defines | |
-SOURCE_DIR := src | |
-EXE := .exe | |
+SOURCE_DIRS := src src/common src/encoder src/frontend src/primitives | |
+CLI_DIRS := src/cli src/cli/extras | |
+EXE := | |
OUTPUT_FILE = cclxv$(EXE) | |
ifeq ($(strip $(EXE)),) | |
@@ -19,12 +25,13 @@ | |
# Autogenerate lists of source files and the output object files | |
-SOURCE_FILES := $(foreach dir, $(SOURCE_DIR), $(wildcard $(dir)/*.cpp)) | |
-OBJECT_FILES := $(patsubst $(SOURCE_DIR)/%.cpp, $(SOURCE_DIR)/%.o, $(SOURCE_FILES)) | |
+SOURCE_FILES := $(foreach dir, $(SOURCE_DIRS), $(wildcard $(dir)/*.cpp)) | |
+CLI_SOURCES := $(foreach dir, $(CLI_DIRS), $(wildcard $(dir)/*.c)) | |
+OBJECT_FILES := $(SOURCE_FILES:.cpp=.o) $(CLI_SOURCES:.c=.o) | |
# Autogenerate dependency files | |
-DEPFILES := $(OBJECT_FILES:.o=.d) | |
-DEPFILES := $(sort $(DEPFILES)) | |
+# DEPFILES := $(OBJECT_FILES:.o=.d) | |
+# DEPFILES := $(sort $(DEPFILES)) | |
# Here begin the rules | |
.PHONY: all clean test | |
@@ -39,10 +46,15 @@ | |
@echo LINK $@ | |
@$(CXX) $^ $(LIBS) -o $@ | |
-$(SOURCE_DIR)/%.o: $(SOURCE_DIR)/%.cpp | |
+%.o: %.cpp | |
@echo CXX $@ | |
@$(CXX) $(CXXFLAGS) -c $< -o $@ | |
- @$(CXX) $(CXXFLAGS) -MM -MT "$(@:.d=.o) $@" $< > $(@:.o=.d) | |
+# @$(CXX) $(CXXFLAGS) -MM -MT "$(@:.d=.o) $@" $< > $(@:.o=.d) | |
+ | |
+%.o: %.c | |
+ @echo CC $@ | |
+ @$(CC) $(CFLAGS) -c $< -o $@ | |
+# @$(CC) $(CFLAGS) -MM -MT "$(@:.d=.o) $@" $< > $(@:.o=.d) | |
clean: | |
rm -f $(OBJECT_FILES) $(DEPFILES) cclxv cclxv.exe | |
@@ -52,6 +64,6 @@ | |
hm11/TAppDecoder$(EXE) -b data/encoded.bin -o $(DEV_NULL) | |
hm12/TAppDecoder$(EXE) -b data/encoded.bin -o $(DEV_NULL) | |
-ifneq ($(MAKECMDGOALS),clean) | |
- -include $(DEPFILES) | |
-endif | |
+# ifneq ($(MAKECMDGOALS),clean) | |
+# -include $(DEPFILES) | |
+# endif | |
diff -r 514640c6cbd8 src/common/basics.h | |
--- a/src/common/basics.h Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/common/basics.h Mon Apr 14 23:35:03 2014 -0700 | |
@@ -10,6 +10,7 @@ | |
#pragma once | |
+#include <cmath> | |
#include <cassert> | |
#include <cstdint> | |
#include <algorithm> | |
diff -r 514640c6cbd8 src/common/headers.cpp | |
--- a/src/common/headers.cpp Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/common/headers.cpp Mon Apr 14 23:35:03 2014 -0700 | |
@@ -466,13 +466,13 @@ | |
template <typename T> | |
void ParameterSetParser<T>::unsigned_bits(int len, int* field) | |
{ | |
- fixed_length(len, field); | |
+ T::fixed_length(len, field); | |
} | |
template <typename T> | |
void ParameterSetParser<T>::unsigned_exp_golomb(int* field) | |
{ | |
- exp_golomb(field); | |
+ T::exp_golomb(field); | |
} | |
template <typename T> | |
@@ -513,7 +513,7 @@ | |
void ParameterSetParser<T>::flag(bool* field) | |
{ | |
int bit = !!*field; | |
- fixed_length(1, &bit); | |
+ T::fixed_length(1, &bit); | |
*field = bit > 0; | |
} | |
@@ -521,14 +521,14 @@ | |
void ParameterSetParser<T>::byte() | |
{ | |
int dummy; | |
- fixed_length(8, &dummy); | |
+ T::fixed_length(8, &dummy); | |
} | |
template <typename T> | |
void ParameterSetParser<T>::reserved_bits(int len, int value) | |
{ | |
int bits = value; | |
- fixed_length(len, &bits); | |
+ T::fixed_length(len, &bits); | |
assert(bits == value && "reserved bits"); | |
} | |
@@ -537,7 +537,7 @@ | |
{ | |
int alignement_one_bit = 1; | |
reserved_bits(1, alignement_one_bit); | |
- int last_bits = position() & 7; | |
+ int last_bits = T::position() & 7; | |
if (last_bits > 0) | |
{ | |
reserved_bits(8 - last_bits, 0); | |
diff -r 514640c6cbd8 src/frontend/decoder.cpp | |
--- a/src/frontend/decoder.cpp Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/frontend/decoder.cpp Mon Apr 14 23:35:03 2014 -0700 | |
@@ -39,7 +39,7 @@ | |
SyntaxReader &reader = *reader_ptr; | |
reader.init(data_ptr, sh.slice_type, ctx.luma_qp, sh.cabac_init_flag); | |
- Frame frame = Frame(ctx.dim); | |
+ Frame frame(ctx.dim); | |
frame.process(reader, ctx); | |
frame.unpack_mvs(ctx); | |
frame.unpack_pixels(pic, ref_pic, ctx); | |
diff -r 514640c6cbd8 src/frontend/encoder.cpp | |
--- a/src/frontend/encoder.cpp Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/frontend/encoder.cpp Mon Apr 14 23:35:03 2014 -0700 | |
@@ -67,7 +67,7 @@ | |
fill_context(&ctx, headers.sps, headers.pps, sh); | |
ctx.slice_type = slice_type; | |
- Frame frame = Frame(ctx.dim); | |
+ Frame frame(ctx.dim); | |
Picture src_pic = copy_Picture(pic); | |
Picture& rec = pic; | |
diff -r 514640c6cbd8 src/primitives/jitasm.h | |
--- a/src/primitives/jitasm.h Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/primitives/jitasm.h Mon Apr 14 23:35:03 2014 -0700 | |
@@ -66,12 +66,12 @@ | |
#endif | |
-//#include <string> | |
+#include <string> | |
//#include <deque> | |
#include <vector> | |
//#include <map> | |
//#include <algorithm> | |
-//#include <string.h> | |
+#include <cstring> | |
#if defined(JITASM_WIN) | |
//#include <windows.h> | |
diff -r 514640c6cbd8 src/primitives/primitives.cpp | |
--- a/src/primitives/primitives.cpp Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/primitives/primitives.cpp Mon Apr 14 23:35:03 2014 -0700 | |
@@ -19,7 +19,11 @@ | |
Primitives prims; | |
-#define PRIMITIVE_DECL __declspec(noinline) | |
+#if defined(_MSC_VER) | |
+ #define PRIMITIVE_DECL __declspec(noinline) | |
+#else | |
+ #define PRIMITIVE_DECL __attribute__((noinline)) | |
+#endif | |
PRIMITIVE_DECL void Primitives::inv_dctN(plane<int16_t> residual, int log_size) | |
{ | |
@@ -247,4 +251,4 @@ | |
CodeBuffer* cb = (CodeBuffer*)opaque_cb; | |
delete cb; | |
#endif //USE_ASSEMBLER | |
-} | |
\ No newline at end of file | |
+} | |
diff -r 514640c6cbd8 src/primitives/transform.cpp | |
--- a/src/primitives/transform.cpp Sat Apr 12 16:59:09 2014 -0700 | |
+++ b/src/primitives/transform.cpp Mon Apr 14 23:35:03 2014 -0700 | |
@@ -66,7 +66,7 @@ | |
int nT = 1 << log2_nT; | |
int u0a = inv_transform_table_shift[log2_nT]; | |
int u0b = fw_transform_table_shift[log2_nT]; | |
- plane<const int16_t> inv_dct_transform_ref(&inv_dct_transform_ref[0][0], 32 * 16 / nT); | |
+ plane<const int16_t> inv_dct_transform_ref_plane(&inv_dct_transform_ref[0][0], 32 * 16 / nT); | |
plane<int16_t> inv_dct_transform_nT(&transform_coefs[u0a][0], nT); | |
plane<int16_t> fw_dct_transform_nT(&transform_coefs[u0b][0], nT); | |
@@ -80,7 +80,7 @@ | |
uu = 31 - u; | |
sign = 1 - (v % 2) * 2; | |
} | |
- inv_dct_transform_nT(u, v) = sign * inv_dct_transform_ref(uu, v); | |
+ inv_dct_transform_nT(u, v) = sign * inv_dct_transform_ref_plane(uu, v); | |
} | |
// assume near orthogonality |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment