Skip to content

Commit

Permalink
Initial commit of 0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
thenickdude committed Jan 7, 2015
0 parents commit 6345d8e
Show file tree
Hide file tree
Showing 5,078 changed files with 1,064,584 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/logs/
/obj/
/.settings/
/.cproject
/.project
/dist/
136 changes: 136 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
###############################################################################
# "THE BEER-WARE LICENSE" (Revision 42):
# <[email protected]> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return
###############################################################################
#
# Makefile for building the blackbox data decoder.
#
# Invoke this with 'make help' to see the list of supported targets.
#

###############################################################################
# Things that the user might override on the commandline
#

# Compile-time options
OPTIONS ?=
BLACKBOX_VERSION ?=

# Debugger optons, must be empty or GDB
DEBUG = GDB

###############################################################################
# Things that need to be maintained as the source changes
#

# Working directories
ROOT = $(dir $(lastword $(MAKEFILE_LIST)))
SRC_DIR = $(ROOT)/src
OBJECT_DIR = $(ROOT)/obj
BIN_DIR = $(ROOT)/obj

# Source files common to all targets
COMMON_SRC = parser.c tools.c platform.c
DECODER_SRC = $(COMMON_SRC) blackbox_decode.c
RENDERER_SRC = $(COMMON_SRC) blackbox_render.c datapoints.c embeddedfont.c expo.c imu.c
ENCODER_TESTBED_SRC = $(COMMON_SRC) encoder_testbed.c

# In some cases, %.s regarded as intermediate file, which is actually not.
# This will prevent accidental deletion of startup code.
.PRECIOUS: %.s

# Search path for baseflight sources
VPATH := $(SRC_DIR)

###############################################################################
# Things that might need changing to use different tools
#

#
# Tool options.
#
INCLUDE_DIRS = $(SRC_DIR)

ifeq ($(DEBUG),GDB)
OPTIMIZE = -O0
LTO_FLAGS = $(OPTIMIZE)
else
OPTIMIZE = -O3
LTO_FLAGS = -flto $(OPTIMIZE)
endif

DEBUG_FLAGS = -g3 -ggdb

CFLAGS = $(ARCH_FLAGS) \
$(LTO_FLAGS) \
$(addprefix -D,$(OPTIONS)) \
$(addprefix -I,$(INCLUDE_DIRS)) \
$(if $(strip $(BLACKBOX_VERSION)), -DBLACKBOX_VERSION=$(BLACKBOX_VERSION)) \
$(DEBUG_FLAGS) \
-std=gnu99 \
-pthread \
-Wall -pedantic -Wextra -Wshadow

CFLAGS += `pkg-config --cflags cairo` `pkg-config --cflags freetype2`

ifeq ($(BUILD_STATIC), MACOSX)
# For cairo built with ./configure --enable-quartz=no --without-x --enable-pdf=no --enable-ps=no --enable-script=no --enable-xcb=no --enable-ft=yes --enable-fc=no --enable-xlib=no
LDFLAGS += -Llib/macosx -lcairo -lpixman-1 -lpng16 -lz -lfreetype -lbz2
else
# Dynamic linking
LDFLAGS += `pkg-config --libs cairo` `pkg-config --libs freetype2`
endif

LDFLAGS += -lm

# Required with GCC. Clang warns when using flag while linking, so you can comment this line out if you're using clang:
LDFLAGS += -pthread


###############################################################################
# No user-serviceable parts below
###############################################################################

#
# Things we will build
#

DECODER_ELF = $(BIN_DIR)/blackbox_decode
RENDERER_ELF = $(BIN_DIR)/blackbox_render
ENCODER_TESTBED_ELF = $(BIN_DIR)/encoder_testbed

DECODER_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/,$(basename $(DECODER_SRC))))
RENDERER_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/,$(basename $(RENDERER_SRC))))
ENCODER_TESTBED_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/,$(basename $(ENCODER_TESTBED_SRC))))

TARGET_MAP = $(OBJECT_DIR)/blackbox_decode.map

all : $(DECODER_ELF) $(RENDERER_ELF) $(ENCODER_TESTBED_ELF)

$(DECODER_ELF): $(DECODER_OBJS)
@$(CC) -o $@ $^ $(LDFLAGS)

$(RENDERER_ELF): $(RENDERER_OBJS)
@$(CC) -o $@ $^ $(LDFLAGS)

$(ENCODER_TESTBED_ELF): $(ENCODER_TESTBED_OBJS)
@$(CC) -o $@ $^ $(LDFLAGS)

# Compile
$(OBJECT_DIR)/%.o: %.c
@mkdir -p $(dir $@)
@echo %% $(notdir $<)
@$(CC) -c -o $@ $(CFLAGS) $<

clean:
rm -f $(RENDERER_ELF) $(DECODER_ELF) $(ENCODER_TESTBED_ELF) $(ENCODER_TESTBED_OBJS) $(RENDERER_OBJS) $(DECODER_OBJS) $(TARGET_MAP)

help:
@echo ""
@echo "Makefile for the baseflight blackbox data decoder"
@echo ""
@echo "Usage:"
@echo " make [OPTIONS=\"<options>\"]"
@echo ""
115 changes: 115 additions & 0 deletions lib/cairo-1.14.0/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Josh Aas <[email protected]> Memory leak fix for quartz backend
Daniel Amelang <[email protected]> Many (magic) floating-point optimizations
Shawn T. Amundson <[email protected]> Build fix
Olivier Andrieu <[email protected]> PNG backend
Peter Dennis Bartok <[email protected]> Bug fix for clipping
Dave Beckett <[email protected]> Build fixes, Debian packaging
Kai-Uwe Behrmann <[email protected]> SVG bug fixes
Christian Biesinger <[email protected]> BeOS backend
Billy Biggs <[email protected]> Pixman code merge. Optimization. Fixes for subtle rendering bugs.
Hans Breuer <[email protected]> win32 bug fixes, build fixes, and improvements
Brian Cameron <[email protected]> Flag bug in Sun's X server
Carlos Garcia Campos <[email protected]> libspectre integration into the test-suite
Andrea Canciani <[email protected]> Bugs, quartz backend improvements and type 6/7 patterns.
Damien Carbery <[email protected]> Build fixes
Andrew Chant <[email protected]> Adding const where needed
Steve Chaplin <[email protected]> Bug fixes for PNG reading
Tomasz Cholewo <[email protected]> Bug fixes
Manu Cornet <[email protected]> SVG build fix
Frederic Crozat <[email protected]> Fix test suite for OPD platforms (IA64 or PPC64)
Julien Danjou <[email protected]> XCB fixes
Radek Doulík <[email protected]> Bug report and test case
John Ehresman <[email protected]> Build fixes for win32
John Ellson <[email protected]> First font/glyph extents functions
Michael Emmel <[email protected]> DirectFB backend
Miklós Erdélyi <[email protected]> Fix typo leading to a crash
Behdad Esfahbod <[email protected]> Huge piles of bug fixes, improvements, and general maintenance
Gilles Espinasse <[email protected]> Font related fixes
Larry Ewing <[email protected]> Test case for group-clip
Brian Ewins <[email protected]> ATSUI maintenance (first success at making it really work)
Bertram Felgenhauer <[email protected]> Fixes for subtle arithmetic errors
Damian Frank <[email protected]> Build system improvements for win32
Bdale Garbee <[email protected]> Provided essential support for cairo achitecture sessions
Jens Granseuer <[email protected]> Fixes to generate proper compiler flags
Laxmi Harikumar <[email protected]> Build fix
J. Ali Harlow <[email protected]> win32 backend updates
Bryce Harrington <[email protected]> Test cases, bug/typo fixes
Mathias Hasselmann <[email protected]> Significant reduction of calls to malloc
Richard Henderson <[email protected]> "slim" macros for better shared libraries
James Henstridge <[email protected]> Build fixes related to freetype
Graydon Hoare <[email protected]> Support for non-render X server, first real text support
Thomas Hunger <[email protected]> Initial version of cairo_in_stroke/fill
Thomas Jaeger <[email protected]> Extended repeat modes for X
Björn Lindqvist <[email protected]> Performance test cases
Kristian Høgsberg <[email protected]> PDF backend, PS backend with meta-surfaces
Amaury Jacquot <[email protected]> Documentation review, appplication testing
Adrian Johnson <[email protected]> PDF backend improvement
Michael Johnson <[email protected]> Bug fix for pre-C99 compilers
Jonathon Jongsma <[email protected]> Fix documentation typos
Øyvind Kolås <[email protected]> OpenVG backend, Bug fixes. Better default values.
Martin Kretzschmar <[email protected]> Arithmetic fix for 64-bit architectures
Mathieu Lacage <[email protected]> several bug/typo fixes
Dominic Lachowicz <[email protected]> PDF conformance fix, fix image surface to zero out contents
Alexander Larsson <[email protected]> Profiling and performance fixes.
Sylvestre Ledru <[email protected]> Static analysis fixes.
Tor Lillqvist <[email protected]> win32 build fixes, build scripts
Jinghua Luo <[email protected]> Add bitmap glyph transformation, many freetype and glitz fixes
Luke-Jr <[email protected]> Build fix for cross-compiling
Kjartan Maraas <[email protected]> Several fixes for sparse, lots of debug help for multi-thread bugs
Nis Martensen <[email protected]> Bug fix for sub paths
Jordi Mas <[email protected]> Bug fix for cairo_show_text
Nicholas Miell <[email protected]> Fixes for linking bugs on AMD64
Eugeniy Meshcheryakov <[email protected]> PS/PDF font subsetting improvements
Zakharov Mikhail <[email protected]> Build fix for HP-UX
Christopher (Monty) Montgomery <[email protected]> Performnace fix (subimage_copy), multi-thread testing
Tim Mooney <[email protected]> Fix test suite to compile with Solaris compiler
Jeff Muizelaar <[email protected]> Patient, painful, pixman code merge. Many fixes for intricacies of dashing.
Yevgen Muntyan <[email protected]> win32 build fix
Ravi Nanjundappa <[email protected]> Static analysis fixes, test cases, skia backend update/fixes
Declan Naughton <[email protected]> Fix documentation typos
Peter Nilsson <[email protected]> Glitz backend
Henning Noren <[email protected]> Fix memory leak
Geoff Norton <[email protected]> Build fixes
Robert O'Callahan <[email protected]> Const-correctness fixes, several new API functions for completeness (and to help mozilla)
Ian Osgood <[email protected]> XCB backend maintenance
Benjamin Otte <[email protected]> Refinements to cairo/perf timing, OpenGL backend fixups, random fixes
Mike Owens <[email protected]> Bug fixes
Emmanuel Pacaud <[email protected]> SVG backend
Keith Packard <[email protected]> Original concept, polygon tessellation, dashing, font metrics rewrite
Stuart Parmenter <[email protected]> Original GDI+ backend, win32 fixes
Alfred Peng <[email protected]> Fixes for Sun compilers and for a memory leak
Christof Petig <[email protected]> Build fixes related to freetype
Joonas Pihlaja <[email protected]> Huge improvements to the tessellator performance
Mart Raudsepp <[email protected]> Build fixes
David Reveman <[email protected]> New pattern API, glitz backend
Calum Robinson <[email protected]> Quartz backend
Pavel Roskin <[email protected]> Several cleanups to eliminate warnings
Tim Rowley <[email protected]> Quartz/ATSUI fixes, X server workarounds, win32 glyph path support, test case to expose gradient regression
Soeren Sandmann <[email protected]> Lots of MMX love for pixman compositing
Uli Schlachter <[email protected]> Some more XCB fixes
Torsten Schönfeld <[email protected]> Build fixes
Jamey Sharp <[email protected]> Surface/font backend virtualization, XCB backend
Jason Dorje Short <[email protected]> Build fixes and bug fixes
Jeff Smith <[email protected]> Fixes for intricacies of stroking code
Travis Spencer <[email protected]> XCB backend fix
Bill Spitzak <[email protected]> Build fix to find Xrender.h without xrender.pc, downscaling support
Zhe Su <[email protected]> Add support for fontconfig's embeddedbitmap option
Owen Taylor <[email protected]> Font rewrite, documentation, win32 backend
Pierre Tardy <[email protected]> EGL support and testing, OpenVG backend
Karl Tomlinson <[email protected]> Optimisation and obscure bug fixes (mozilla)
Alp Toker <[email protected]> Fix several code/comment typos
Malcolm Tredinnick <[email protected]> Documentation fixes
David Turner <[email protected]> Optimize gradient calculations
Kalle Vahlman <[email protected]> Allow perf reports to be compared across different platforms
Sasha Vasko <[email protected]> Build fix to compile without xlib backend
Vladimir Vukicevic <[email protected]> Quartz backend rewrite, win32/quartz maintenance
Jonathan Watt <[email protected]> win32 fixes
Peter Weilbacher <[email protected]> OS/2 backend
Dan Williams <[email protected]> Implemnt MMX function to help OLPC
Chris Wilson <[email protected]> Large-scale robustness improvements, (warn_unsed_result and malloc failure injection)
Carl Worth <[email protected]> Original library, support for paths, images
Richard D. Worth <[email protected]> Build fixes for cygwin
Kent Worsnop <[email protected]> Fix PDF dashing bug
Dave Yeo <[email protected]> Build fix for win32

(please let us know if we have missed anyone)
109 changes: 109 additions & 0 deletions lib/cairo-1.14.0/BIBLIOGRAPHY
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Here's an effort to document some of the academic work that was
referenced during the implementation of cairo. It is presented in the
context of operations as they would be performed by either
cairo_stroke() or cairo_fill():

Given a Bézier path, approximate it with line segments:

The deCasteljau algorithm
"Outillages methodes calcul", P de Casteljau, technical
report, - Andre Citroen Automobiles SA, Paris, 1959

That technical report might be "hard" to find, but fortunately
this algorithm will be described in any reasonable textbook on
computational geometry. Two that have been recommended by
cairo contributors are:

"Computational Geometry, Algorithms and Applications", M. de
Berg, M. van Kreveld, M. Overmars, M. Schwarzkopf;
Springer-Verlag, ISBN: 3-540-65620-0.

"Computational Geometry in C (Second Edition)", Joseph
O'Rourke, Cambridge University Press, ISBN 0521640105.

Then, if stroking, construct a polygonal representation of the pen
approximating a circle (if filling skip three steps):

"Good approximation of circles by curvature-continuous Bezier
curves", Tor Dokken and Morten Daehlen, Computer Aided
Geometric Design 8 (1990) 22-41.

Add points to that pen based on the initial/final path faces and take
the convex hull:

Convex hull algorithm

[Again, see your favorite computational geometry
textbook. Should cite the name of the algorithm cairo uses
here, if it has a name.]

Now, "convolve" the "tracing" of the pen with the tracing of the path:

"A Kinetic Framework for Computational Geometry", Leonidas
J. Guibas, Lyle Ramshaw, and Jorge Stolfi, Proceedings of the
24th IEEE Annual Symposium on Foundations of Computer Science
(FOCS), November 1983, 100-111.

The result of the convolution is a polygon that must be filled. A fill
operations begins here. We use a very conventional Bentley-Ottmann
pass for computing the intersections, informed by some hints on robust
implementation courtesy of John Hobby:

John D. Hobby, Practical Segment Intersection with Finite
Precision Output, Computation Geometry Theory and
Applications, 13(4), 1999.

http://cm.bell-labs.com/who/hobby/93_2-27.pdf

Hobby's primary contribution in that paper is his "tolerance square"
algorithm for robustness against edges being "bent" due to restricting
intersection coordinates to the grid available by finite-precision
arithmetic. This is one algorithm we have not implemented yet.

We use a data-structure called Skiplists in the our implementation
of Bentley-Ottmann:

W. Pugh, Skip Lists: a Probabilistic Alternative to Balanced Trees,
Communications of the ACM, vol. 33, no. 6, pp.668-676, 1990.

http://citeseer.ist.psu.edu/pugh90skip.html

The random number generator used in our skip list implementation is a
very small generator by Hars and Petruska. The generator is based on
an invertable function on Z_{2^32} with full period and is described
in

Hars L. and Petruska G.,
``Pseudorandom Recursions: Small and Fast Pseurodandom
Number Generators for Embedded Applications'',
Hindawi Publishing Corporation
EURASIP Journal on Embedded Systems
Volume 2007, Article ID 98417, 13 pages
doi:10.1155/2007/98417

http://www.hindawi.com/getarticle.aspx?doi=10.1155/2007/98417&e=cta

From the result of the intersection-finding pass, we are currently
computing a tessellation of trapezoids, (the exact manner is
undergoing some work right now with some important speedup), but we
may want to rasterize directly from those edges at some point.

Given the set of tessellated trapezoids, we currently execute a
straightforward, (and slow), point-sampled rasterization, (and
currently with a near-pessimal regular 15x17 grid).

We've now computed a mask which gets fed along with the source and
destination into cairo's fundamental rendering equation. The most
basic form of this equation is:

destination = (source IN mask) OP destination

with the restriction that no part of the destination outside the
current clip region is affected. In this equation, IN refers to the
Porter-Duff "in" operation, while OP refers to a any user-selected
Porter-Duff operator:

T. Porter & T. Duff, Compositing Digital Images Computer
Graphics Volume 18, Number 3 July 1984 pp 253-259

http://keithp.com/~keithp/porterduff/p253-porter.pdf
Loading

0 comments on commit 6345d8e

Please sign in to comment.