Re-org files, refine styles, add README, et al.

Draco bitstream spec source should be ready for author contributions.
This commit is contained in:
Lou Quillio 2017-07-12 15:18:53 -07:00
parent c2fb47ac5d
commit 8d8c88e08f
39 changed files with 1055 additions and 536 deletions

View File

@ -1 +1 @@
@import url("https://fonts.googleapis.com/css?family=Inconsolata");body{font-family:Arial,sans-serif;margin:10% 25% 10% 10%;line-height:1.3}a{color:navy;text-decoration:none}a:visited{color:navy;text-decoration:none}a:hover{text-decoration:underline}pre{font-family:"Inconsolata",monospace;border:2px solid #ddd;padding:1em;margin-left:1em;overflow-x:auto}code{font-family:"Inconsolata",monospace}table{border-collapse:collapse;min-width:50%;margin-left:1em}th,td{border:2px solid #ccc;padding:.5em}th{background-color:#333;color:#fff}table.terms th{display:none}table.terms td{vertical-align:top}table.conventions th{display:none}table.conventions td{vertical-align:top}table.conventions td:first-child{white-space:nowrap}table.nohead th{display:none}table.xyhead th,table.xyhead td:first-child{background-color:#9bbb59}table.xyhead th{color:#000;font-weight:normal}figure.highlight{background-color:#f2f2f2;padding-left:1em;padding-right:1em;border:2px solid #ccc}div.syntax{background-color:#fff;background-image:linear-gradient(90deg, transparent 540px, #abced4 540px, #abced4 542px, transparent 542px),linear-gradient(#ddd .1em, transparent .1em);background-size:100% 1.3em;border-left:2px solid #ddd;border-right:2px solid #ddd;border-bottom:2px solid #ddd;white-space:pre;font-family:"Inconsolata",monospace;font-size:1em;padding-left:1em;margin-left:1em;width:720px}
@import url("https://fonts.googleapis.com/css?family=Inconsolata");body{font-family:Arial,sans-serif;margin:10% 25% 10% 10%;line-height:1.3}a{color:navy;text-decoration:none}a:visited{color:navy;text-decoration:none}a:hover{text-decoration:underline}code{font-family:"Inconsolata",monospace}table{border-collapse:collapse;min-width:50%;margin-left:1em}th,td{border:2px solid #ccc;padding:.5em}th{background-color:#333;color:#fff}table.terms th{display:none}table.terms td{vertical-align:top}table.conventions th{display:none}table.conventions td{vertical-align:top}table.conventions td:first-child{white-space:nowrap}table.nohead th{display:none}table.xyhead th,table.xyhead td:first-child{background-color:#9bbb59}table.xyhead th{color:#000;font-weight:normal}figure.highlight{background-color:#f2f2f2;padding-left:1em;padding-right:1em;border:2px solid #ccc}div.draco-syntax pre{background-color:#fff;background-image:linear-gradient(90deg, transparent 580px, #abced4 580px, #abced4 582px, transparent 582px),linear-gradient(#ddd .1em, transparent .1em);background-size:100% 1.3em;border-left:2px solid #ddd;border-right:2px solid #ddd;border-bottom:2px solid #ddd;white-space:pre;font-family:"Inconsolata",monospace;font-size:1em;padding-left:1em;margin-left:1em;width:720px}

View File

@ -1,2 +1,2 @@
<p><em>Last modified: 2017-07-10 14:30:06 -0700</em></p>
<p><em>Last modified: 2017-07-12 15:15:50 -0700</em></p>

View File

@ -1,5 +1,7 @@
<h2 id="conventions">Conventions</h2>
<h3 id="general-conventions">General Conventions</h3>
<ul>
<li>
<p>When bit reading is finished it will always pad the read to the current
@ -40,3 +42,51 @@ first, then the connectivity section, and then the attribute section.</p>
decoded.</p>
</li>
</ul>
<h3 id="method-of-describing-bitstream-syntax">Method of describing bitstream syntax</h3>
<p><strong>FIXME: This section is borrowed from AV1, and should be modified for the Draco
spec.</strong></p>
<p>The description style of the syntax is similar to the C++ programming language.
Syntax elements in the bitstream are represented in bold type. Each syntax
element is described by its name (using only lower case letters with
underscore characters) and a descriptor for its method of coded
representation. The decoding process behaves according to the value of the
syntax element and to the values of previously decoded syntax elements. When a
value of a syntax element is used in the syntax tables or the text, it appears
in regular (i.e. not bold) type. If the value of a syntax element is being
computed (e.g. being written with a default value instead of being coded in
the bitstream), it also appears in regular type.</p>
<p>In some cases the syntax tables may use the values of other variables derived
from syntax elements values. Such variables appear in the syntax tables, or
text, named by a mixture of lower case and upper case letter and without any
underscore characters. Variables starting with an upper case letter are
derived for the decoding of the current syntax structure and all depending
syntax structures. These variables may be used in the decoding process for
later syntax structures. Variables starting with a lower case letter are only
used within the process from which they are derived.</p>
<p>Constant values appear in all upper case letters with underscore characters.</p>
<p>Constant lookup tables appear in all lower case letters with underscore
characters.</p>
<p>Hexadecimal notation, indicated by prefixing the hexadecimal number by <code class="highlighter-rouge">0x</code>,
may be used when the number of bits is an integer multiple of 4. For example,
<code class="highlighter-rouge">0x1a</code> represents a bit string <code class="highlighter-rouge">0001 1010</code>.</p>
<p>Binary notation is indicated by prefixing the binary number by <code class="highlighter-rouge">0b</code>. For
example, <code class="highlighter-rouge">0b00011010</code> represents a bit string <code class="highlighter-rouge">0001 1010</code>. Binary numbers may
include underscore characters to enhance readability. If present, the
underscore characters appear every 4 binary digits starting from the LSB. For
example, <code class="highlighter-rouge">0b11010</code> may also be written as <code class="highlighter-rouge">0b1_1010</code>.</p>
<p>A value equal to 0 represents a FALSE condition in a test statement. The
value TRUE is represented by any value not equal to 0.</p>
<p>The following table lists examples of the syntax specification format. When
<code class="highlighter-rouge">syntax_element</code> appears (with bold face font), it specifies that this syntax
element is parsed from the bitstream.</p>

View File

@ -1,5 +1,7 @@
## Conventions
### General Conventions
* When bit reading is finished it will always pad the read to the current
byte.
@ -24,3 +26,52 @@
* The hole and split data must be decoded before the EdgeBreaker symbols are
decoded.
### Method of describing bitstream syntax
**FIXME: This section is borrowed from AV1, and should be modified for the Draco
spec.**
The description style of the syntax is similar to the C++ programming language.
Syntax elements in the bitstream are represented in bold type. Each syntax
element is described by its name (using only lower case letters with
underscore characters) and a descriptor for its method of coded
representation. The decoding process behaves according to the value of the
syntax element and to the values of previously decoded syntax elements. When a
value of a syntax element is used in the syntax tables or the text, it appears
in regular (i.e. not bold) type. If the value of a syntax element is being
computed (e.g. being written with a default value instead of being coded in
the bitstream), it also appears in regular type.
In some cases the syntax tables may use the values of other variables derived
from syntax elements values. Such variables appear in the syntax tables, or
text, named by a mixture of lower case and upper case letter and without any
underscore characters. Variables starting with an upper case letter are
derived for the decoding of the current syntax structure and all depending
syntax structures. These variables may be used in the decoding process for
later syntax structures. Variables starting with a lower case letter are only
used within the process from which they are derived.
Constant values appear in all upper case letters with underscore characters.
Constant lookup tables appear in all lower case letters with underscore
characters.
Hexadecimal notation, indicated by prefixing the hexadecimal number by `0x`,
may be used when the number of bits is an integer multiple of 4. For example,
`0x1a` represents a bit string `0001 1010`.
Binary notation is indicated by prefixing the binary number by `0b`. For
example, `0b00011010` represents a bit string `0001 1010`. Binary numbers may
include underscore characters to enhance readability. If present, the
underscore characters appear every 4 binary digits starting from the LSB. For
example, `0b11010` may also be written as `0b1_1010`.
A value equal to 0 represents a FALSE condition in a test statement. The
value TRUE is represented by any value not equal to 0.
The following table lists examples of the syntax specification format. When
`syntax_element` appears (with bold face font), it specifies that this syntax
element is parsed from the bitstream.

View File

@ -2,33 +2,30 @@
<h3 id="decode">Decode()</h3>
<div class="syntax">
Decode() { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>Decode() {
DecodeHeader()
DecodeConnectivityData()
DecodeAttributeData()}
</code></pre>
</div>
<h3 id="decodeheader">DecodeHeader()</h3>
<div class="syntax">
DecodeHeader() { <b>Type</b>
<b>draco_string</b> UI8[5]
<b>major_version</b> UI8
<b>minor_version</b> UI8
<b>encoder_type</b> UI8
<b>encoder_method</b> UI8
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>DecodeHeader() {
draco_string UI8[5]
major_version UI8
minor_version UI8
encoder_type UI8
encoder_method UI8
flags
}
</code></pre>
</div>
<h3 id="decodeattributedata">DecodeAttributeData()</h3>
<div class="syntax">
DecodeAttributeData() { <b>Type</b>
<b>num_attributes_decoders</b> UI8
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>DecodeAttributeData() {
num_attributes_decoders UI8
for (i = 0; i &lt; num_attributes_decoders; ++i) {
CreateAttributesDecoder(i);
}
@ -40,4 +37,5 @@ DecodeAttributeData() { <b>Type</b
}
DecodeAllAttributes()
OnAttributesDecoded()
</code></pre>
</div>

View File

@ -2,35 +2,35 @@
### Decode()
<div class="syntax">
Decode() { <b>Type</b>
~~~~~
Decode() {
DecodeHeader()
DecodeConnectivityData()
DecodeAttributeData()}
</div>
~~~~~
{:.draco-syntax}
### DecodeHeader()
<div class="syntax">
DecodeHeader() { <b>Type</b>
<b>draco_string</b> UI8[5]
<b>major_version</b> UI8
<b>minor_version</b> UI8
<b>encoder_type</b> UI8
<b>encoder_method</b> UI8
~~~~~
DecodeHeader() {
draco_string UI8[5]
major_version UI8
minor_version UI8
encoder_type UI8
encoder_method UI8
flags
}
</div>
~~~~~
{:.draco-syntax}
### DecodeAttributeData()
<div class="syntax">
DecodeAttributeData() { <b>Type</b>
<b>num_attributes_decoders</b> UI8
~~~~~
DecodeAttributeData() {
num_attributes_decoders UI8
for (i = 0; i < num_attributes_decoders; ++i) {
CreateAttributesDecoder(i);
}
@ -42,4 +42,5 @@ DecodeAttributeData() { <b>Type</b
}
DecodeAllAttributes()
OnAttributesDecoded()
</div>
~~~~~
{:.draco-syntax}

View File

@ -2,25 +2,24 @@
<h3 id="initializedecoder">InitializeDecoder()</h3>
<div class="syntax">
InitializeDecoder() { <b>Type</b>
<b>edgebreaker_decoder_type</b> UI8
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>InitializeDecoder() {
edgebreaker_decoder_type UI8
}
</code></pre>
</div>
<h3 id="decodeconnectivity">DecodeConnectivity()</h3>
<div class="syntax">
DecodeConnectivity() { <b>Type</b>
<b>num_new_verts</b> UI32
<b>num_encoded_vertices</b> UI32
<b>num_faces</b> UI32
<b>num_attribute_data</b> I8
<b>num_encoded_symbols</b> UI32
<b>num_encoded_split_symbols</b> UI32
<b>encoded_connectivity_size</b> UI32
// file pointer must be set to current position + encoded_connectivity_size
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>DecodeConnectivity() {
num_new_verts UI32
num_encoded_vertices UI32
num_faces UI32
num_attribute_data I8
num_encoded_symbols UI32
num_encoded_split_symbols UI32
encoded_connectivity_size UI32
// file pointer must be set to current position
// + encoded_connectivity_size
hole_and_split_bytes = DecodeHoleAndTopologySplitEvents()
// file pointer must be set to old current position
EdgeBreakerTraversalValence_Start()
@ -46,13 +45,12 @@ DecodeConnectivity() { <b>Type</b
// Preallocate vertex to value mapping
AssignPointsToCorners()
}
</code></pre>
</div>
<h3 id="assignpointstocorners">AssignPointsToCorners()</h3>
<div class="syntax">
AssignPointsToCorners() { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>AssignPointsToCorners() {
decoder_-&gt;mesh()-&gt;SetNumFaces(corner_table_-&gt;num_faces());
if (attribute_data_.size() == 0) {
for (f = 0; f &lt; decoder_-&gt;mesh()-&gt;num_faces(); ++f) {
@ -123,13 +121,12 @@ AssignPointsToCorners() { <b>Type</b
}
decoder_-&gt;point_cloud()-&gt;set_num_points(point_to_corner_map.size());
}
</code></pre>
</div>
<h3 id="decodeconnectivity-1">DecodeConnectivity()</h3>
<div class="syntax">
DecodeConnectivity(num_symbols) { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>DecodeConnectivity(num_symbols) {
for (i = 0; i &lt; num_symbols; ++i) {
symbol = TraversalValence_DecodeSymbol()
corner = 3 * num_faces++
@ -184,13 +181,12 @@ DecodeConnectivity(num_symbols) { <b>Type</b
}
Return num_vertices;
}
</code></pre>
</div>
<h3 id="updatecornertableforsymbolc">UpdateCornerTableForSymbolC()</h3>
<div class="syntax">
UpdateCornerTableForSymbolC(corner) { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>UpdateCornerTableForSymbolC(corner) {
corner_a = active_corner_stack.back();
corner_b = corner_table_-&gt;Previous(corner_a);
while (corner_table_-&gt;Opposite(corner_b) &gt;= 0) {
@ -206,13 +202,12 @@ UpdateCornerTableForSymbolC(corner) { <b>Type</b
corner + 2, corner_table_-&gt;Vertex(corner_table_-&gt;Previous(corner_a)));
return vertex_x;
}
</code></pre>
</div>
<h3 id="updatecornertableforsymbollr">UpdateCornerTableForSymbolLR()</h3>
<div class="syntax">
UpdateCornerTableForSymbolLR(corner, symbol) { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>UpdateCornerTableForSymbolLR(corner, symbol) {
if (symbol == TOPOLOGY_R) {
opp_corner = corner + 2;
} else {
@ -227,13 +222,12 @@ UpdateCornerTableForSymbolLR(corner, symbol) { <b>Type</b
corner_table_-&gt;Previous(opp_corner),
corner_table_-&gt;Vertex(corner_table_-&gt;Next(corner_a)));
}
</code></pre>
</div>
<h3 id="handlesymbols">HandleSymbolS()</h3>
<div class="syntax">
HandleSymbolS(corner) { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>HandleSymbolS(corner) {
corner_b = active_corner_stack.pop_back();
it = topology_split_active_corners.find(symbol_id);
if (it != topology_split_active_corners.end()) {
@ -258,24 +252,22 @@ HandleSymbolS(corner) { <b>Type</b
}
corner_table_-&gt;MakeVertexIsolated(vertex_n);
}
</code></pre>
</div>
<h3 id="updatecornertableforsymbole">UpdateCornerTableForSymbolE()</h3>
<div class="syntax">
UpdateCornerTableForSymbolE() { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>UpdateCornerTableForSymbolE() {
corner_table_-&gt;MapCornerToVertex(corner, num_vertices++);
corner_table_-&gt;MapCornerToVertex(corner + 1, num_vertices++);
corner_table_-&gt;MapCornerToVertex(corner + 2, num_vertices++);
}
</code></pre>
</div>
<h3 id="updatecornertableforinteriorface">UpdateCornerTableForInteriorFace()</h3>
<div class="syntax">
UpdateCornerTableForInteriorFace() { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>UpdateCornerTableForInteriorFace() {
corner_b = corner_table_-&gt;Previous(corner);
while (corner_table_-&gt;Opposite(corner_b) &gt;= 0) {
corner_b = corner_table_-&gt;Previous(corner_table_-&gt;Opposite(corner_b));
@ -292,14 +284,12 @@ UpdateCornerTableForInteriorFace() { <b>Type</b
corner_table_-&gt;MapCornerToVertex(
new_corner + 2, corner_table_-&gt;Vertex(corner_table_-&gt;Next(corner)));
}
</code></pre>
</div>
<h3 id="istopologysplit">IsTopologySplit()</h3>
<div class="syntax">
IsTopologySplit(encoder_symbol_id, *out_face_edge, <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>IsTopologySplit(encoder_symbol_id, *out_face_edge,
*out_encoder_split_symbol_id) {
if (topology_split_data_.size() == 0)
return false;
@ -311,13 +301,12 @@ IsTopologySplit(encoder_symbol_id, *out_face_edge, <b>Type</b
topology_split_data_.pop_back();
return true;
}
</code></pre>
</div>
<h3 id="decodeattributeconnectivitiesonface">DecodeAttributeConnectivitiesOnFace()</h3>
<div class="syntax">
DecodeAttributeConnectivitiesOnFace(corner) { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>DecodeAttributeConnectivitiesOnFace(corner) {
corners[3] = {corner, corner_table_-&gt;Next(corner),
corner_table_-&gt;Previous(corner)}
for (c = 0; c &lt; 3; ++c) {
@ -336,15 +325,14 @@ DecodeAttributeConnectivitiesOnFace(corner) { <b>Type</b
}
}
}
</code></pre>
</div>
<h3 id="setoppositecorners">SetOppositeCorners()</h3>
<div class="syntax">
SetOppositeCorners(corner_0, corner_1) { <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>SetOppositeCorners(corner_0, corner_1) {
corner_table_-&gt;SetOppositeCorner(corner_0, corner_1);
corner_table_-&gt;SetOppositeCorner(corner_1, corner_0);
}
</code></pre>
</div>

View File

@ -2,26 +2,27 @@
### InitializeDecoder()
<div class="syntax">
InitializeDecoder() { <b>Type</b>
<b>edgebreaker_decoder_type</b> UI8
~~~~~
InitializeDecoder() {
edgebreaker_decoder_type UI8
}
</div>
~~~~~
{:.draco-syntax }
### DecodeConnectivity()
<div class="syntax">
DecodeConnectivity() { <b>Type</b>
<b>num_new_verts</b> UI32
<b>num_encoded_vertices</b> UI32
<b>num_faces</b> UI32
<b>num_attribute_data</b> I8
<b>num_encoded_symbols</b> UI32
<b>num_encoded_split_symbols</b> UI32
<b>encoded_connectivity_size</b> UI32
// file pointer must be set to current position + encoded_connectivity_size
~~~~~
DecodeConnectivity() {
num_new_verts UI32
num_encoded_vertices UI32
num_faces UI32
num_attribute_data I8
num_encoded_symbols UI32
num_encoded_split_symbols UI32
encoded_connectivity_size UI32
// file pointer must be set to current position
// + encoded_connectivity_size
hole_and_split_bytes = DecodeHoleAndTopologySplitEvents()
// file pointer must be set to old current position
EdgeBreakerTraversalValence_Start()
@ -47,14 +48,14 @@ DecodeConnectivity() { <b>Type</b
// Preallocate vertex to value mapping
AssignPointsToCorners()
}
</div>
~~~~~
{:.draco-syntax }
### AssignPointsToCorners()
<div class="syntax">
AssignPointsToCorners() { <b>Type</b>
~~~~~
AssignPointsToCorners() {
decoder_->mesh()->SetNumFaces(corner_table_->num_faces());
if (attribute_data_.size() == 0) {
for (f = 0; f < decoder_->mesh()->num_faces(); ++f) {
@ -125,14 +126,14 @@ AssignPointsToCorners() { <b>Type</b
}
decoder_->point_cloud()->set_num_points(point_to_corner_map.size());
}
</div>
~~~~~
{:.draco-syntax }
### DecodeConnectivity()
<div class="syntax">
DecodeConnectivity(num_symbols) { <b>Type</b>
~~~~~
DecodeConnectivity(num_symbols) {
for (i = 0; i < num_symbols; ++i) {
symbol = TraversalValence_DecodeSymbol()
corner = 3 * num_faces++
@ -187,14 +188,14 @@ DecodeConnectivity(num_symbols) { <b>Type</b
}
Return num_vertices;
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForSymbolC()
<div class="syntax">
UpdateCornerTableForSymbolC(corner) { <b>Type</b>
~~~~~
UpdateCornerTableForSymbolC(corner) {
corner_a = active_corner_stack.back();
corner_b = corner_table_->Previous(corner_a);
while (corner_table_->Opposite(corner_b) >= 0) {
@ -210,15 +211,15 @@ UpdateCornerTableForSymbolC(corner) { <b>Type</b
corner + 2, corner_table_->Vertex(corner_table_->Previous(corner_a)));
return vertex_x;
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForSymbolLR()
<div class="syntax">
UpdateCornerTableForSymbolLR(corner, symbol) { <b>Type</b>
~~~~~
UpdateCornerTableForSymbolLR(corner, symbol) {
if (symbol == TOPOLOGY_R) {
opp_corner = corner + 2;
} else {
@ -233,14 +234,14 @@ UpdateCornerTableForSymbolLR(corner, symbol) { <b>Type</b
corner_table_->Previous(opp_corner),
corner_table_->Vertex(corner_table_->Next(corner_a)));
}
</div>
~~~~~
{:.draco-syntax }
### HandleSymbolS()
<div class="syntax">
HandleSymbolS(corner) { <b>Type</b>
~~~~~
HandleSymbolS(corner) {
corner_b = active_corner_stack.pop_back();
it = topology_split_active_corners.find(symbol_id);
if (it != topology_split_active_corners.end()) {
@ -265,26 +266,26 @@ HandleSymbolS(corner) { <b>Type</b
}
corner_table_->MakeVertexIsolated(vertex_n);
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForSymbolE()
<div class="syntax">
UpdateCornerTableForSymbolE() { <b>Type</b>
~~~~~
UpdateCornerTableForSymbolE() {
corner_table_->MapCornerToVertex(corner, num_vertices++);
corner_table_->MapCornerToVertex(corner + 1, num_vertices++);
corner_table_->MapCornerToVertex(corner + 2, num_vertices++);
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForInteriorFace()
<div class="syntax">
UpdateCornerTableForInteriorFace() { <b>Type</b>
~~~~~
UpdateCornerTableForInteriorFace() {
corner_b = corner_table_->Previous(corner);
while (corner_table_->Opposite(corner_b) >= 0) {
corner_b = corner_table_->Previous(corner_table_->Opposite(corner_b));
@ -301,15 +302,14 @@ UpdateCornerTableForInteriorFace() { <b>Type</b
corner_table_->MapCornerToVertex(
new_corner + 2, corner_table_->Vertex(corner_table_->Next(corner)));
}
</div>
~~~~~
{:.draco-syntax }
### IsTopologySplit()
<div class="syntax">
IsTopologySplit(encoder_symbol_id, *out_face_edge, <b>Type</b>
~~~~~
IsTopologySplit(encoder_symbol_id, *out_face_edge,
*out_encoder_split_symbol_id) {
if (topology_split_data_.size() == 0)
return false;
@ -321,14 +321,14 @@ IsTopologySplit(encoder_symbol_id, *out_face_edge, <b>Type</b
topology_split_data_.pop_back();
return true;
}
</div>
~~~~~
{:.draco-syntax }
### DecodeAttributeConnectivitiesOnFace()
<div class="syntax">
DecodeAttributeConnectivitiesOnFace(corner) { <b>Type</b>
~~~~~
DecodeAttributeConnectivitiesOnFace(corner) {
corners[3] = {corner, corner_table_->Next(corner),
corner_table_->Previous(corner)}
for (c = 0; c < 3; ++c) {
@ -347,16 +347,16 @@ DecodeAttributeConnectivitiesOnFace(corner) { <b>Type</b
}
}
}
</div>
~~~~~
{:.draco-syntax }
### SetOppositeCorners()
<div class="syntax">
SetOppositeCorners(corner_0, corner_1) { <b>Type</b>
~~~~~
SetOppositeCorners(corner_0, corner_1) {
corner_table_->SetOppositeCorner(corner_0, corner_1);
corner_table_->SetOppositeCorner(corner_1, corner_0);
}
</div>
~~~~~
{:.draco-syntax }

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,9 @@
<h3 id="decodeconnectivitydata">DecodeConnectivityData()</h3>
<div class="syntax">
DecodeConnectivityData() <b>Type</b>
<div class="draco-syntax highlighter-rouge"><pre class="highlight"><code>DecodeConnectivityData()
InitializeDecoder()
DecodeConnectivity()
}
</code></pre>
</div>

View File

@ -2,10 +2,10 @@
### DecodeConnectivityData()
<div class="syntax">
DecodeConnectivityData() <b>Type</b>
~~~~~
DecodeConnectivityData()
InitializeDecoder()
DecodeConnectivity()
}
</div>
~~~~~
{:.draco-syntax }

View File

@ -24,12 +24,12 @@ a
text-decoration: underline
pre
font-family: $monofont
border: $gridweight solid $gridcolor
//font-family: $monofont
//border: $gridweight solid $gridcolor
//background-color: #f7f7f7
padding: 1em
margin-left: 1em
overflow-x: auto
//padding: 1em
//margin-left: 1em
//overflow-x: auto
code
//color: #060
@ -80,12 +80,9 @@ figure.highlight
padding-right: 1em
border: $gridweight solid #ccc
div.syntax
//background-color: $gridcolor
//background-image: linear-gradient(transparent 50%, rgba(255,255,255,.5) 50%)
//background-size: 40px 40px
div.draco-syntax pre
background-color: #fff
background-image: linear-gradient(90deg, transparent 540px, #abced4 540px, #abced4 542px, transparent 542px), linear-gradient($gridcolor .1em, transparent .1em)
background-image: linear-gradient(90deg, transparent 580px, #abced4 580px, #abced4 582px, transparent 582px), linear-gradient($gridcolor .1em, transparent .1em)
background-size: 100% 1.3em
border-left: $gridweight solid $gridcolor
border-right: $gridweight solid $gridcolor

10
docs/index.md Normal file
View File

@ -0,0 +1,10 @@
---
layout: spec
title: Draco 3D Graphics Compression
---
* [Draft Draco Bitstream Specification][spec]
* [README file for specification authors][readme]
[spec]: /docs/spec/
[readme]: /docs/spec/README

View File

@ -1,5 +1,7 @@
## Conventions
### General Conventions
* When bit reading is finished it will always pad the read to the current
byte.
@ -24,3 +26,52 @@
* The hole and split data must be decoded before the EdgeBreaker symbols are
decoded.
### Method of describing bitstream syntax
**FIXME: This section is borrowed from AV1, and should be modified for the Draco
spec.**
The description style of the syntax is similar to the C++ programming language.
Syntax elements in the bitstream are represented in bold type. Each syntax
element is described by its name (using only lower case letters with
underscore characters) and a descriptor for its method of coded
representation. The decoding process behaves according to the value of the
syntax element and to the values of previously decoded syntax elements. When a
value of a syntax element is used in the syntax tables or the text, it appears
in regular (i.e. not bold) type. If the value of a syntax element is being
computed (e.g. being written with a default value instead of being coded in
the bitstream), it also appears in regular type.
In some cases the syntax tables may use the values of other variables derived
from syntax elements values. Such variables appear in the syntax tables, or
text, named by a mixture of lower case and upper case letter and without any
underscore characters. Variables starting with an upper case letter are
derived for the decoding of the current syntax structure and all depending
syntax structures. These variables may be used in the decoding process for
later syntax structures. Variables starting with a lower case letter are only
used within the process from which they are derived.
Constant values appear in all upper case letters with underscore characters.
Constant lookup tables appear in all lower case letters with underscore
characters.
Hexadecimal notation, indicated by prefixing the hexadecimal number by `0x`,
may be used when the number of bits is an integer multiple of 4. For example,
`0x1a` represents a bit string `0001 1010`.
Binary notation is indicated by prefixing the binary number by `0b`. For
example, `0b00011010` represents a bit string `0001 1010`. Binary numbers may
include underscore characters to enhance readability. If present, the
underscore characters appear every 4 binary digits starting from the LSB. For
example, `0b11010` may also be written as `0b1_1010`.
A value equal to 0 represents a FALSE condition in a test statement. The
value TRUE is represented by any value not equal to 0.
The following table lists examples of the syntax specification format. When
`syntax_element` appears (with bold face font), it specifies that this syntax
element is parsed from the bitstream.

266
docs/spec/README.md Normal file
View File

@ -0,0 +1,266 @@
---
layout: spec
title: "README: Draco Spec Authoring Information"
---
![Draco logo graphic](../artwork/draco3d-horiz-320x79.png)
# Authoring Info, Draco 3D Bitstream Specification
{:.no_toc}
This document, once published, will define the Draco 3D Geometry Compression
bitstream format and decoding process.
**Contents**
* TOC
{:toc}
The document is built from plaintext section and subsection [Markdown] files
(more specifically, [kramdown] files) using the [Jekyll] static site building
tool. GitHub supports Jekyll natively.
The `docs/` directory of this project is meant to contain only documentation
and web content. The commands below should be issued from `docs/`. We do not
want to pollute the code tree with Ruby and Jekyll config information and
content.
The `docs/spec/` directory contains the files needed to work on this
specification document.
## Building Locally
Contributors will want to preview their edits locally before submitting pull
requests. Doing so requires a sane Ruby and rubygems environment. We use [rbenv]
and [bundler] to "groom" the project environment and avoid conflicts.
_**Important:** All commands are to be run as an ordinary, unprivileged user._
### Ruby and rbenv
This project currently depends on Ruby v2.3.0. Because your distro may lack this
version -- or installing it may conflict with your system's installed version --
first [install rbenv], then install Ruby v2.3.0 within it (again, in userland).
~~~~~
# list all available versions:
$ rbenv install -l
2.2.6
2.3.0-dev
2.3.0-preview1
2.3.0-preview2
2.3.0
# install a Ruby version:
$ rbenv install 2.3.0
~~~~~
### Bundler
Gem dependencies are managed by [bundler].
~~~~~
$ gem install bundler
# Filesystem location where gems are installed
$ gem env home
# => ~/.rbenv/versions/<ruby-version>/lib/ruby/gems/...
~~~~~
## Fork and Clone the Repo
First, use the **Fork** button on the repo's [homepage] to fork a copy to your
GitHub account.
Second, clone your fork locally:
~~~~~
git clone git@github.com:<username>/draco.git
cd draco
~~~~~
_**Note** that we **strongly** recommend [using SSH] with GitHub, not HTTPS._
Third, add a Git remote `upstream` that points to google/draco:
~~~~~
git remote add upstream git@github.com:google/draco.git
~~~~~
Your local repo with then have two remotes, `upstream` pointing at the
authoritative GitHub repo and `origin` pointing at your GitHub fork.
~~~~~
$ git remote
origin
upstream
$ git remote show origin
* remote origin
Fetch URL: git@github.com:<username>/draco.git
Push URL: git@github.com:<username>/draco.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
$ git remote show upstream
* remote upstream
Fetch URL: git@github.com:google/draco.git
Push URL: git@github.com:google/draco.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
~~~~~
[**See this page**][1] for a longer discussion of managing remotes and general
GitHub workflow.
**Important: The following commands should be issued from the `docs/`
directory.**
### Set Local Ruby Version (rbenv)
In the `docs/` directory of your local clone, do:
~~~~~
rbenv local 2.3.0
~~~~~
Regardless of any other Rubies installed on your system, the project environment
will now use v2.3.0 and gems appropriate for it.
### Install Gem Dependencies with Bundler
In the `docs/` directory of your local clone, run
~~~~~
bundle install
~~~~~
Bundler will set dependencies and install needed gems as listed in
`Gemfile.lock`.
_**Note** that you may need Ruby development headers installed on your system
for some gems to compile successfully._
### Build and Preview Locally with Jekyll
~~~~~
bundle exec jekyll serve
~~~~~
This will build the documentation tree and launch a local webserver at
`http://127.0.0.1:4000/docs/` (by default). Jekyll will also watch the
the filesystem for changes and rebuild the document as needed.
## **Markdown & Formatting Conventions**
The spec document is composed mostly of syntax tables, styled with CSS. Mark
them up as follows:
* Use the [fenced code block][fenced] kramdown syntax: A line beginning with
three or more tildes (`~`) starts the code block, another such line ends it.
* Use kramdown's [inline attribute syntax][inline] to apply the CSS class
`draco-syntax` to your code block by placing `{:.draco-syntax }` on the line
immediately after the code-block closing delimiter.
* Some syntax elements as annotated with their type and size in a right-hand
column. In your text editor, position these annotations at column 73.
**Example:**
<pre><code>~~~~~
DecodeHeader() {
draco_string UI8[5]
major_version UI8
minor_version UI8
encoder_type UI8
encoder_method UI8
flags
}
~~~~~
{:.draco-syntax}</code></pre>
... **will render as:**
~~~~~
DecodeHeader() {
draco_string UI8[5]
major_version UI8
minor_version UI8
encoder_type UI8
encoder_method UI8
flags
}
~~~~~
{:.draco-syntax}
## General GitHub Workflow
Always do your work in a local branch.
~~~~~
git co -b my-branch-name
## work ##
git add <filenames or -A for all>
git ci -m "Reasonably clear commit message"
~~~~~
Push your branch to `origin` (your GitHub fork):
~~~~~
git push origin my-branch-name
~~~~~
Next, visit the `upstream` [homepage]. If you are logged-in, GitHub will be
aware of your recently pushed branch, and offer an in-page widget for submitting
a pull request for the project maintainers to consider.
Once your pull request is merged into upstream's master branch, you may
synchronize your clone (and remote `origin`) as follows:
~~~~~
git co master
git fetch upstream
git merge upstream/master
git push origin
~~~~~
Your old working branch is no longer needed, so do some housekeeping:
~~~~~
git br -d my-branch-name
~~~~~
[Markdown]: https://daringfireball.net/projects/markdown/
[kramdown]: https://kramdown.gettalong.org/
[Jekyll]: https://jekyllrb.com/
[rbenv]: https://github.com/rbenv/rbenv
[bundler]: http://bundler.io/
[install rbenv]: https://github.com/rbenv/rbenv#installation
[homepage]: https://github.com/google/draco
[using SSH]: https://help.github.com/articles/connecting-to-github-with-ssh/
[1]: https://2buntu.com/articles/1459/keeping-your-forked-repo-synced-with-the-upstream-source/
[fenced]: https://kramdown.gettalong.org/syntax.html#fenced-code-blocks
[inline]: https://kramdown.gettalong.org/syntax.html#block-ials

View File

@ -5,16 +5,17 @@
~~~~~
DecodeAttributesDecoderData(buffer) {
num_attributes I32
num_attributes I32
point_attribute_ids_.resize(num_attributes);
for (i = 0; i < num_attributes; ++i) {
att_type UI8
data_type UI8
components_count UI8
normalized UI8
custom_id UI16
att_type UI8
data_type UI8
components_count UI8
normalized UI8
custom_id UI16
Initialize GeometryAttribute ga
att_id = pc->AddAttribute(new PointAttribute(ga));
point_attribute_ids_[i] = att_id;
}
~~~~~
{:.draco-syntax }

View File

@ -6,7 +6,7 @@
~~~~~
DecodeVarint<IT>() {
If (std::is_unsigned<IT>::value) {
in UI8
in UI8
If (in & (1 << 7)) {
out = DecodeVarint<IT>()
out = (out << 7) | (in & ((1 << 7) - 1))
@ -18,6 +18,7 @@ DecodeVarint<IT>() {
return out;
}
~~~~~
{:.draco-syntax }
### ConvertSymbolToSignedInt()
@ -33,29 +34,33 @@ ConvertSymbolToSignedInt() {
return signed_val
}
~~~~~
{:.draco-syntax }
Sequential Decoder
FIXME: ^^^ Heading level?
### decode_connectivity()
~~~~~
decode_connectivity() {
num_faces I32
num_points I32
connectivity _method UI8
num_faces I32
num_points I32
connectivity _method UI8
If (connectivity _method == 0) {
// TODO
} else {
loop num_faces {
If (num_points < 256) {
face[] UI8
face[] UI8
} else if (num_points < (1 << 16)) {
face[] UI16
face[] UI16
} else {
face[] UI32
face[] UI32
}
}
}
}
~~~~~
{:.draco-syntax }

View File

@ -8,6 +8,7 @@ Opposite(corner) {
return opposite_corners_[corner];
}
~~~~~
{:.draco-syntax }
### Next()
@ -17,6 +18,7 @@ Next(corner) {
return LocalIndex(++corner) ? corner : corner - 3;
}
~~~~~
{:.draco-syntax }
### Previous()
@ -26,6 +28,7 @@ Previous(corner) {
return LocalIndex(corner) ? corner - 1 : corner + 2;
}
~~~~~
{:.draco-syntax }
### Vertex()
@ -35,6 +38,7 @@ Vertex(corner) {
faces_[Face(corner)][LocalIndex(corner)];
}
~~~~~
{:.draco-syntax }
### Face()
@ -44,6 +48,7 @@ Face(corner) {
return corner / 3;
}
~~~~~
{:.draco-syntax }
### LocalIndex()
@ -53,6 +58,7 @@ LocalIndex(corner) {
return corner % 3;
}
~~~~~
{:.draco-syntax }
### num_vertices()
@ -62,6 +68,7 @@ num_vertices() {
return vertex_corners_.size();
}
~~~~~
{:.draco-syntax }
### num_corners()
@ -71,6 +78,7 @@ num_corners() {
return faces_.size() * 3;
}
~~~~~
{:.draco-syntax }
### num_faces()
@ -80,6 +88,7 @@ num_faces() {
return faces_.size();
}
~~~~~
{:.draco-syntax }
### bool IsOnBoundary()
@ -92,7 +101,7 @@ bool IsOnBoundary(vert) {
return false;
}
~~~~~
{:.draco-syntax }
### SwingRight()
@ -102,6 +111,7 @@ SwingRight(corner) {
return Previous(Opposite(Previous(corner)));
}
~~~~~
{:.draco-syntax }
### SwingLeft()
@ -111,6 +121,7 @@ SwingLeft(corner) {
return Next(Opposite(Next(corner)));
}
~~~~~
{:.draco-syntax }
### GetLeftCorner()
@ -122,6 +133,7 @@ GetLeftCorner(corner_id) {
return Opposite(Previous(corner_id));
}
~~~~~
{:.draco-syntax }
### GetRightCorner()
@ -133,6 +145,7 @@ GetRightCorner(corner_id) {
return Opposite(Next(corner_id));
}
~~~~~
{:.draco-syntax }
### SetOppositeCorner()
@ -142,7 +155,7 @@ SetOppositeCorner(corner_id, pp_corner_id) {
opposite_corners_[corner_id] = opp_corner_id;
}
~~~~~
{:.draco-syntax }
### MapCornerToVertex()
@ -156,6 +169,7 @@ MapCornerToVertex(corner_id, vert_id) {
}
}
~~~~~
{:.draco-syntax }
### UpdateVertexToCornerMap()
@ -176,7 +190,7 @@ UpdateVertexToCornerMap(vert) {
}
}
~~~~~
{:.draco-syntax }
### LeftMostCorner()
@ -186,6 +200,7 @@ LeftMostCorner(v) {
return vertex_corners_[v];
}
~~~~~
{:.draco-syntax }
### MakeVertexIsolated()
@ -195,3 +210,4 @@ MakeVertexIsolated(vert) {
vertex_corners_[vert] = kInvalidCornerIndex;
}
~~~~~
{:.draco-syntax }

View File

@ -11,6 +11,7 @@ IsFaceVisited(corner_id) {
return is_face_visited_[corner_id / 3];
}
~~~~~
{:.draco-syntax }
### MarkFaceVisited()
@ -20,6 +21,7 @@ MarkFaceVisited(face_id) {
is_face_visited_[face_id] = true;
}
~~~~~
{:.draco-syntax }
### IsVertexVisited()
@ -29,6 +31,7 @@ IsVertexVisited(vert_id) {
return is_vertex_visited_[vert_id];
}
~~~~~
{:.draco-syntax }
### MarkVertexVisited()
@ -38,3 +41,4 @@ MarkVertexVisited(vert_id) {
is_vertex_visited_[vert_id] = true;
}
~~~~~
{:.draco-syntax }

View File

@ -2,35 +2,35 @@
### Decode()
<div class="syntax">
Decode() { <b>Type</b>
~~~~~
Decode() {
DecodeHeader()
DecodeConnectivityData()
DecodeAttributeData()}
</div>
~~~~~
{:.draco-syntax}
### DecodeHeader()
<div class="syntax">
DecodeHeader() { <b>Type</b>
<b>draco_string</b> UI8[5]
<b>major_version</b> UI8
<b>minor_version</b> UI8
<b>encoder_type</b> UI8
<b>encoder_method</b> UI8
~~~~~
DecodeHeader() {
draco_string UI8[5]
major_version UI8
minor_version UI8
encoder_type UI8
encoder_method UI8
flags
}
</div>
~~~~~
{:.draco-syntax}
### DecodeAttributeData()
<div class="syntax">
DecodeAttributeData() { <b>Type</b>
<b>num_attributes_decoders</b> UI8
~~~~~
DecodeAttributeData() {
num_attributes_decoders UI8
for (i = 0; i < num_attributes_decoders; ++i) {
CreateAttributesDecoder(i);
}
@ -42,4 +42,5 @@ DecodeAttributeData() { <b>Type</b
}
DecodeAllAttributes()
OnAttributesDecoded()
</div>
~~~~~
{:.draco-syntax}

View File

@ -2,26 +2,27 @@
### InitializeDecoder()
<div class="syntax">
InitializeDecoder() { <b>Type</b>
<b>edgebreaker_decoder_type</b> UI8
~~~~~
InitializeDecoder() {
edgebreaker_decoder_type UI8
}
</div>
~~~~~
{:.draco-syntax }
### DecodeConnectivity()
<div class="syntax">
DecodeConnectivity() { <b>Type</b>
<b>num_new_verts</b> UI32
<b>num_encoded_vertices</b> UI32
<b>num_faces</b> UI32
<b>num_attribute_data</b> I8
<b>num_encoded_symbols</b> UI32
<b>num_encoded_split_symbols</b> UI32
<b>encoded_connectivity_size</b> UI32
// file pointer must be set to current position + encoded_connectivity_size
~~~~~
DecodeConnectivity() {
num_new_verts UI32
num_encoded_vertices UI32
num_faces UI32
num_attribute_data I8
num_encoded_symbols UI32
num_encoded_split_symbols UI32
encoded_connectivity_size UI32
// file pointer must be set to current position
// + encoded_connectivity_size
hole_and_split_bytes = DecodeHoleAndTopologySplitEvents()
// file pointer must be set to old current position
EdgeBreakerTraversalValence_Start()
@ -47,14 +48,14 @@ DecodeConnectivity() { <b>Type</b
// Preallocate vertex to value mapping
AssignPointsToCorners()
}
</div>
~~~~~
{:.draco-syntax }
### AssignPointsToCorners()
<div class="syntax">
AssignPointsToCorners() { <b>Type</b>
~~~~~
AssignPointsToCorners() {
decoder_->mesh()->SetNumFaces(corner_table_->num_faces());
if (attribute_data_.size() == 0) {
for (f = 0; f < decoder_->mesh()->num_faces(); ++f) {
@ -125,14 +126,14 @@ AssignPointsToCorners() { <b>Type</b
}
decoder_->point_cloud()->set_num_points(point_to_corner_map.size());
}
</div>
~~~~~
{:.draco-syntax }
### DecodeConnectivity()
<div class="syntax">
DecodeConnectivity(num_symbols) { <b>Type</b>
~~~~~
DecodeConnectivity(num_symbols) {
for (i = 0; i < num_symbols; ++i) {
symbol = TraversalValence_DecodeSymbol()
corner = 3 * num_faces++
@ -187,14 +188,14 @@ DecodeConnectivity(num_symbols) { <b>Type</b
}
Return num_vertices;
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForSymbolC()
<div class="syntax">
UpdateCornerTableForSymbolC(corner) { <b>Type</b>
~~~~~
UpdateCornerTableForSymbolC(corner) {
corner_a = active_corner_stack.back();
corner_b = corner_table_->Previous(corner_a);
while (corner_table_->Opposite(corner_b) >= 0) {
@ -210,15 +211,15 @@ UpdateCornerTableForSymbolC(corner) { <b>Type</b
corner + 2, corner_table_->Vertex(corner_table_->Previous(corner_a)));
return vertex_x;
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForSymbolLR()
<div class="syntax">
UpdateCornerTableForSymbolLR(corner, symbol) { <b>Type</b>
~~~~~
UpdateCornerTableForSymbolLR(corner, symbol) {
if (symbol == TOPOLOGY_R) {
opp_corner = corner + 2;
} else {
@ -233,14 +234,14 @@ UpdateCornerTableForSymbolLR(corner, symbol) { <b>Type</b
corner_table_->Previous(opp_corner),
corner_table_->Vertex(corner_table_->Next(corner_a)));
}
</div>
~~~~~
{:.draco-syntax }
### HandleSymbolS()
<div class="syntax">
HandleSymbolS(corner) { <b>Type</b>
~~~~~
HandleSymbolS(corner) {
corner_b = active_corner_stack.pop_back();
it = topology_split_active_corners.find(symbol_id);
if (it != topology_split_active_corners.end()) {
@ -265,26 +266,26 @@ HandleSymbolS(corner) { <b>Type</b
}
corner_table_->MakeVertexIsolated(vertex_n);
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForSymbolE()
<div class="syntax">
UpdateCornerTableForSymbolE() { <b>Type</b>
~~~~~
UpdateCornerTableForSymbolE() {
corner_table_->MapCornerToVertex(corner, num_vertices++);
corner_table_->MapCornerToVertex(corner + 1, num_vertices++);
corner_table_->MapCornerToVertex(corner + 2, num_vertices++);
}
</div>
~~~~~
{:.draco-syntax }
### UpdateCornerTableForInteriorFace()
<div class="syntax">
UpdateCornerTableForInteriorFace() { <b>Type</b>
~~~~~
UpdateCornerTableForInteriorFace() {
corner_b = corner_table_->Previous(corner);
while (corner_table_->Opposite(corner_b) >= 0) {
corner_b = corner_table_->Previous(corner_table_->Opposite(corner_b));
@ -301,15 +302,14 @@ UpdateCornerTableForInteriorFace() { <b>Type</b
corner_table_->MapCornerToVertex(
new_corner + 2, corner_table_->Vertex(corner_table_->Next(corner)));
}
</div>
~~~~~
{:.draco-syntax }
### IsTopologySplit()
<div class="syntax">
IsTopologySplit(encoder_symbol_id, *out_face_edge, <b>Type</b>
~~~~~
IsTopologySplit(encoder_symbol_id, *out_face_edge,
*out_encoder_split_symbol_id) {
if (topology_split_data_.size() == 0)
return false;
@ -321,14 +321,14 @@ IsTopologySplit(encoder_symbol_id, *out_face_edge, <b>Type</b
topology_split_data_.pop_back();
return true;
}
</div>
~~~~~
{:.draco-syntax }
### DecodeAttributeConnectivitiesOnFace()
<div class="syntax">
DecodeAttributeConnectivitiesOnFace(corner) { <b>Type</b>
~~~~~
DecodeAttributeConnectivitiesOnFace(corner) {
corners[3] = {corner, corner_table_->Next(corner),
corner_table_->Previous(corner)}
for (c = 0; c < 3; ++c) {
@ -347,16 +347,16 @@ DecodeAttributeConnectivitiesOnFace(corner) { <b>Type</b
}
}
}
</div>
~~~~~
{:.draco-syntax }
### SetOppositeCorners()
<div class="syntax">
SetOppositeCorners(corner_0, corner_1) { <b>Type</b>
~~~~~
SetOppositeCorners(corner_0, corner_1) {
corner_table_->SetOppositeCorner(corner_0, corner_1);
corner_table_->SetOppositeCorner(corner_1, corner_0);
}
</div>
~~~~~
{:.draco-syntax }

View File

@ -1,47 +1,45 @@
## EdgeBreaker Hole and Topology Split Events
### DecodeHoleAndTopologySplitEvents()
FIXME: Escaping angle brackets
<div class="syntax">
DecodeHoleAndTopologySplitEvents() { <b>Type</b>
<b>num_topologoy_splits</b> UI32
~~~~~
DecodeHoleAndTopologySplitEvents() {
num_topologoy_splits UI32
source_symbol_id = 0
for (i = 0; i < num_topologoy_splits; ++i) {
DecodeVarint\<UI32\>(&delta)
DecodeVarint<UI32>(&delta)
split_data[i].source_symbol_id = delta + source_symbol_id
DecodeVarint\<UI32\>(&delta)
DecodeVarint<UI32>(&delta)
split_data[i].split_symbol_id = source_symbol_id - delta
}
for (i = 0; i < num_topologoy_splits; ++i) {
<b>split_data[i].split_edge</b> bits1
<b>split_data[i].source_edge</b> bits1
split_data[i].split_edge bits1
split_data[i].source_edge bits1
}
<b>num_hole_events</b> UI32
num_hole_events UI32
symbol_id = 0
for (i = 0; i < num_hole_events; ++i) {
DecodeVarint\<UI32\>(&delta)
DecodeVarint<UI32>(&delta)
hole_data[i].symbol_id = delta + symbol_id
}
return bytes_decoded;
}
~~~~~
{:.draco-syntax }
</div>
### CreateAttributesDecoder
FIXME: Escaping angle brackets
<div class="syntax">
CreateAttributesDecoder() { <b>Type</b>
<b>att_data_id</b> I8
<b>decoder_type</b> UI8
~~~~~
CreateAttributesDecoder() {
att_data_id I8
decoder_type UI8
if (att_data_id >= 0) {
attribute_data_[att_data_id].decoder_id = att_decoder_id;
}
<b>traversal_method_encoded</b> UI8
traversal_method_encoded UI8
if (decoder_type == MESH_VERTEX_ATTRIBUTE) {
if (att_data_id < 0) {
encoding_data = &pos_encoding_data_;
@ -50,11 +48,11 @@ CreateAttributesDecoder() { <b>Type</b
attribute_data_[att_data_id].is_connectivity_used = false;
}
if (traversal_method == MESH_TRAVERSAL_DEPTH_FIRST) {
typedef EdgeBreakerTraverser\<AttProcessor, AttObserver\> AttTraverser;
sequencer = CreateVertexTraversalSequencer\<AttTraverser\>(encoding_data);
typedef EdgeBreakerTraverser<AttProcessor, AttObserver> AttTraverser;
sequencer = CreateVertexTraversalSequencer<AttTraverser>(encoding_data);
} else if (traversal_method == MESH_TRAVERSAL_PREDICTION_DEGREE) {
typedef PredictionDegreeTraverser\<AttProcessor, AttObserver\> AttTraverser;
sequencer = CreateVertexTraversalSequencer\<AttTraverser\>(encoding_data);
typedef PredictionDegreeTraverser<AttProcessor, AttObserver> AttTraverser;
sequencer = CreateVertexTraversalSequencer<AttTraverser>(encoding_data);
}
} else {
// TODO
@ -62,6 +60,6 @@ CreateAttributesDecoder() { <b>Type</b
att_controller(new SequentialAttributeDecodersController(std::move(sequencer)))
decoder_->SetAttributesDecoder(att_decoder_id, std::move(att_controller));
}
</div>
~~~~~
{:.draco-syntax }

View File

@ -3,12 +3,12 @@
### EdgebreakerTraversal_Start()
<div class="syntax">
EdgebreakerTraversal_Start() { <b>Type</b>
<b>size</b> UI64
<b>symbol_buffer_</b> size * UI8
<b>size</b> UI64
<b>start_face_buffer_</b> size * UI8
~~~~~
EdgebreakerTraversal_Start() {
size UI64
symbol_buffer_ size * UI8
size UI64
start_face_buffer_ size * UI8
if (num_attribute_data_ > 0) {
attribute_connectivity_decoders_ = std::unique_ptr<BinaryDecoder[]>(
new BinaryDecoder[num_attribute_data_]);
@ -17,22 +17,23 @@ EdgebreakerTraversal_Start() { <b>Type</b
// RansBitDecoder_StartDecoding
}
}
</div>
~~~~~
{:.draco-syntax }
### Traversal_DecodeSymbol()
~~~~~
Traversal_DecodeSymbol() {
symbol_buffer_.DecodeLeastSignificantBits32(1, &symbol); bits1
symbol_buffer_.DecodeLeastSignificantBits32(1, &symbol); bits1
if (symbol != TOPOLOGY_C) {
symbol_buffer_.DecodeLeastSignificantBits32(2, &symbol_suffix); bits2
symbol_buffer_.DecodeLeastSignificantBits32(2, &symbol_suffix); bits2
symbol |= (symbol_suffix << 1);
}
return symbol
}
~~~~~
{:.draco-syntax }
### DecodeAttributeSeam()
@ -42,3 +43,4 @@ DecodeAttributeSeam(int attribute) {
return attribute_connectivity_decoders_[attribute].DecodeNextBit();
}
~~~~~
{:.draco-syntax }

View File

@ -6,8 +6,8 @@
~~~~~
EdgeBreakerTraversalValence_Start(num_vertices, num_attribute_data) {
out_buffer = EdgebreakerTraversal_Start()
num_split_symbols I32
mode == 0 I8
num_split_symbols I32
mode == 0 I8
num_vertices_ += num_split_symbols
vertex_valences_ init to 0
vertex_valences_.resize(num_vertices_, 0);
@ -24,6 +24,7 @@ EdgeBreakerTraversalValence_Start(num_vertices, num_attribute_data) {
return out_buffer;
}
~~~~~
{:.draco-syntax }
@ -33,7 +34,7 @@ EdgeBreakerTraversalValence_Start(num_vertices, num_attribute_data) {
TraversalValence_DecodeSymbol() {
if (active_context_ != -1) {
symbol_id = context_symbols_[active_context_]
[--context_counters_[active_context_]]
[--context_counters_[active_context_]]
last_symbol_ = edge_breaker_symbol_to_topology_id[symbol_id]
} else {
last_symbol_ = Traversal_DecodeSymbol()
@ -41,6 +42,7 @@ TraversalValence_DecodeSymbol() {
return last_symbol_
}
~~~~~
{:.draco-syntax }
@ -76,7 +78,7 @@ TraversalValence_NewActiveCornerReached(corner) {
active_context_ = (valence - min_valence_);
}
~~~~~
{:.draco-syntax }
### TraversalValence_MergeVertices()
@ -86,3 +88,4 @@ TraversalValence_MergeVertices(dest, source) {
vertex_valences_[dest] += vertex_valences_[source];
}
~~~~~
{:.draco-syntax }

View File

@ -68,3 +68,4 @@ TraverseFromCorner(corner_id) {
}
}
~~~~~
{:.draco-syntax }

View File

@ -8,6 +8,7 @@ bool IsCornerOnSeam(corner) {
return is_vertex_on_seam_[corner_table_->Vertex(corner)];
}
~~~~~
{:.draco-syntax }
### AddSeamEdge()
@ -22,6 +23,7 @@ AddSeamEdge(c) {
}
}
~~~~~
{:.draco-syntax }
### MarkSeam()
@ -34,6 +36,7 @@ MarkSeam(c) {
] = true;
}
~~~~~
{:.draco-syntax }
### RecomputeVertices()
@ -72,3 +75,4 @@ RecomputeVertices() {
}
}
~~~~~
{:.draco-syntax }

View File

@ -15,3 +15,4 @@ OnNewVertexVisited(vertex, corner) {
encoding_data_->num_values++;
}
~~~~~
{:.draco-syntax }

View File

@ -2,10 +2,10 @@
### DecodeConnectivityData()
<div class="syntax">
DecodeConnectivityData() <b>Type</b>
~~~~~
DecodeConnectivityData()
InitializeDecoder()
DecodeConnectivity()
}
</div>
~~~~~
{:.draco-syntax }

View File

@ -8,7 +8,7 @@ Decode(...) {
this->transform().InitializeDecoding(num_components);
// restore the first value
this->transform().ComputeOriginalValue(pred_vals.get(),
in_corr, out_data, 0);
in_corr, out_data, 0);
// PredictionSchemeWrapTransform_ComputeOriginalValue()
corner_map_size = this->mesh_data().data_to_corner_map()->size();
for (p = 1; p < corner_map_size; ++p) {
@ -30,10 +30,14 @@ Decode(...) {
}
}
~~~~~
{:.draco-syntax }
MeshPredictionSchemeParallelogramShared
FIXME: ^^^ Heading level?
### ComputeParallelogramPrediction()
~~~~~
@ -56,3 +60,4 @@ ComputeParallelogramPrediction(...) {
return false;
}
~~~~~
{:.draco-syntax }

View File

@ -17,6 +17,7 @@ GenerateSequenceInternal() {
traverser_.OnTraversalEnd();
}
~~~~~
{:.draco-syntax }
### ProcessCorner()
@ -26,6 +27,7 @@ ProcessCorner(corner_id) {
traverser_.TraverseFromCorner(corner_id);
}
~~~~~
{:.draco-syntax }
### UpdatePointToAttributeIndexMapping()
@ -49,10 +51,13 @@ UpdatePointToAttributeIndexMapping(PointAttribute *attribute) {
}
}
~~~~~
{:.draco-syntax }
PointsSequencer
FIXME: ^^^ Heading level?
### AddPointId()
~~~~~
@ -60,3 +65,4 @@ AddPointId(point_id) {
out_point_ids_->push_back(point_id);
}
~~~~~
{:.draco-syntax }

View File

@ -5,10 +5,11 @@
~~~~~
ComputeOriginalValue(const DataTypeT *predicted_vals,
const CorrTypeT *corr_vals,
DataTypeT *out_original_vals, int val_id) {
const CorrTypeT *corr_vals,
DataTypeT *out_original_vals, int val_id) {
for (i = 0; i < num_components_; ++i) {
out_original_vals[i] = predicted_vals[i] + corr_vals[val_id + i];
}
}
~~~~~
{:.draco-syntax }

View File

@ -5,18 +5,19 @@
~~~~~
DecodeTransformData(buffer) {
min_value_ DT
max_value_ DT
min_value_ DT
max_value_ DT
}
~~~~~
{:.draco-syntax }
### ComputeOriginalValue()
~~~~~
ComputeOriginalValue(const DataTypeT *predicted_vals,
const CorrTypeT *corr_vals,
DataTypeT *out_original_vals, int val_id) {
const CorrTypeT *corr_vals,
DataTypeT *out_original_vals, int val_id) {
clamped_vals = ClampPredictedValue(predicted_vals);
ComputeOriginalValue(clamped_vals, corr_vals, out_original_vals, val_id)
// PredictionSchemeTransform_ComputeOriginalValue()
@ -28,6 +29,7 @@ ComputeOriginalValue(const DataTypeT *predicted_vals,
}
}
~~~~~
{:.draco-syntax }
### ClampPredictedValue()
@ -41,3 +43,4 @@ ClampPredictedValue(const DataTypeT *predicted_val) {
return &clamped_value_[0];
}
~~~~~
{:.draco-syntax }

View File

@ -5,12 +5,13 @@
~~~~~
RansBitDecoder_StartDecoding(DecoderBuffer *source_buffer) {
prob_zero_ UI8
size UI32
buffer_ size * UI8
prob_zero_ UI8
size UI32
buffer_ size * UI8
ans_read_init(&ans_decoder_, buffer_, size)
}
~~~~~
{:.draco-syntax }
### DecodeNextBit()
@ -21,3 +22,4 @@ DecodeNextBit() {
return bit > 0;
}
~~~~~
{:.draco-syntax }

View File

@ -23,6 +23,7 @@ ans_read_init(struct AnsDecoder *const ans, const uint8_t *const buf,
ans->state += l_base;
}
~~~~~
{:.draco-syntax }
### int rabs_desc_read()
@ -46,7 +47,7 @@ int rabs_desc_read(struct AnsDecoder *ans, AnsP8 p0) {
return val;
}
~~~~~
{:.draco-syntax }
### rans_read_init()
@ -71,6 +72,7 @@ rans_read_init(UI8 *buf, int offset) {
ans_.state += l_rans_base;
}
~~~~~
{:.draco-syntax }
### rans_build_look_up_table()
@ -89,7 +91,7 @@ rans_build_look_up_table() {
act_prob = cum_prob
}
~~~~~
{:.draco-syntax }
### rans_read()
@ -106,6 +108,7 @@ rans_read() {
return sym.val;
}
~~~~~
{:.draco-syntax }
### fetch_sym()
@ -118,3 +121,4 @@ fetch_sym() {
out->cum_prob = probability_table_[symbol].cum_prob;
}
~~~~~
{:.draco-syntax }

View File

@ -6,6 +6,7 @@ Initialize(...) {
// Init some members
}
~~~~~
{:.draco-syntax }
### DecodeValues()
@ -17,10 +18,11 @@ DecodeValues(const std::vector<PointIndex> &point_ids) {
std::unique_ptr<uint8_t[]> value_data_ptr(new uint8_t[entry_size]);
out_byte_pos = 0;
for (i = 0; i < num_values; ++i) {
value_data UI8 * entry_size
value_data UI8 * entry_size
attribute_->buffer()->Write(out_byte_pos, value_data, entry_size);
out_byte_pos += entry_size;
}
}
~~~~~
{:.draco-syntax }

View File

@ -8,11 +8,12 @@ DecodeAttributesDecoderData(buffer) {
AttributesDecoder_DecodeAttributesDecoderData(buffer)
sequential_decoders_.resize(num_attributes());
for (i = 0; i < num_attributes(); ++i) {
decoder_type UI8
decoder_type UI8
sequential_decoders_[i] = CreateSequentialDecoder(decoder_type);
sequential_decoders_[i]->Initialize(decoder(), GetAttributeId(i))
}
~~~~~
{:.draco-syntax }
### DecodeAttributes()
@ -30,7 +31,7 @@ DecodeAttributes(buffer) {
}
}
~~~~~
{:.draco-syntax }
### CreateSequentialDecoder()
@ -49,4 +50,5 @@ CreateSequentialDecoder(type) {
}
}
~~~~~
{:.draco-syntax }

View File

@ -6,15 +6,16 @@ Initialize(...) {
SequentialAttributeDecoder_Initialize()
}
~~~~~
{:.draco-syntax }
### DecodeValues()
~~~~~
DecodeValues(point_ids) {
prediction_scheme_method I8
prediction_scheme_method I8
if (prediction_scheme_method != PREDICTION_NONE) {
prediction_transform_type I8
prediction_transform_type I8
prediction_scheme_ = CreateIntPredictionScheme(...)
}
if (prediction_scheme_) {
@ -25,13 +26,14 @@ DecodeValues(point_ids) {
DequantizeValues(num_values)
}
~~~~~
{:.draco-syntax }
### DecodeIntegerValues()
~~~~~
DecodeIntegerValues(point_ids) {
compressed UI8
compressed UI8
if (compressed) {
DecodeSymbols(..., values_.data())
} else {
@ -45,8 +47,9 @@ DecodeIntegerValues(point_ids) {
// DecodeTransformData(buffer)
if (!values_.empty()) {
prediction_scheme_->Decode(values_.data(), &values_[0],
values_.size(), num_components, point_ids.data())
values_.size(), num_components, point_ids.data())
// MeshPredictionSchemeParallelogram_Decode()
}
~~~~~
{:.draco-syntax }

View File

@ -6,6 +6,7 @@ Initialize(...) {
SequentialIntegerAttributeDecoder_Initialize()
}
~~~~~
{:.draco-syntax }
### DecodeIntegerValues()
@ -15,13 +16,14 @@ DecodeIntegerValues(point_ids) {
// DecodeQuantizedDataInfo()
num_components = attribute()->components_count();
for (i = 0; i < num_components; ++i) {
min_value_[i] F32
min_value_[i] F32
}
max_value_dif_ F32
quantization_bits_ UI8
max_value_dif_ F32
quantization_bits_ UI8
SequentialIntegerAttributeDecoder::DecodeIntegerValues()
}
~~~~~
{:.draco-syntax }
### DequantizeValues()
@ -44,3 +46,4 @@ DequantizeValues(num_values) {
}
}
~~~~~
{:.draco-syntax }

View File

@ -5,7 +5,7 @@
~~~~~
DecodeSymbols(num_symbols, out_buffer, out_values) {
scheme UI8
scheme UI8
If (scheme == 0) {
DecodeTaggedSymbols<>(num_symbols, src_buffer, out_values)
} else if (scheme == 1) {
@ -13,6 +13,7 @@ DecodeSymbols(num_symbols, out_buffer, out_values) {
}
}
~~~~~
{:.draco-syntax }
### DecodeTaggedSymbols()
@ -22,19 +23,19 @@ DecodeTaggedSymbols() {
FIXME
}
~~~~~
{:.draco-syntax }
### DecodeRawSymbols()
~~~~~
DecodeRawSymbols() {
max_bit_length UI8
max_bit_length UI8
DecodeRawSymbolsInternal(max_bit_length, out_values)
return symbols
}
~~~~~
{:.draco-syntax }
### DecodeRawSymbolsInternal()
@ -50,6 +51,7 @@ DecodeRawSymbolsInternal(max_bit_length, out_values) {
}
}
~~~~~
{:.draco-syntax }
### CreateRansSymbolDecoder()
@ -61,9 +63,9 @@ CreateRansSymbolDecoder(max_bit_length) {
rans_precision_bits = max(rans_precision_bits, 12)
rans_precision = 1 << rans_precision_bits_;
l_rans_base = rans_precision * 4;
num_symbols_ UI32
num_symbols_ UI32
for (i = 0; i < num_symbols_; ++i) {
prob_data UI8
prob_data UI8
if ((prob_data & 3) == 3) {
offset = prob_data >> 2
for (j = 0; j < offset + 1; ++j) {
@ -73,7 +75,7 @@ CreateRansSymbolDecoder(max_bit_length) {
} else {
prob = prob_data >> 2
for (j = 0; j < token; ++j) {
eb UI8
eb UI8
prob = prob | (eb << (8 * (j + 1) - 2)
}
probability_table_[i] = prob;
@ -82,18 +84,19 @@ CreateRansSymbolDecoder(max_bit_length) {
rans_build_look_up_table()
}
~~~~~
{:.draco-syntax }
### RansSymbolDecoder_StartDecoding()
~~~~~
RansSymbolDecoder_StartDecoding() {
bytes_encoded UI64
buffer bytes_encoded * UI8
bytes_encoded UI64
buffer bytes_encoded * UI8
rans_read_init(buffer, bytes_encoded)
}
~~~~~
{:.draco-syntax }
### RansSymbolDecoder_DecodeSymbol()
@ -103,3 +106,4 @@ RansSymbolDecoder_DecodeSymbol() {
ans_.rans_read()
}
~~~~~
{:.draco-syntax }