Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
aom-rav1e
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
aom-rav1e
Commits
109ef96a
Commit
109ef96a
authored
Mar 21, 2016
by
Alex Converse
Committed by
Gerrit Code Review
Mar 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Add a placeholder forward buffered ANS coder." into nextgenv2
parents
4914ae46
44ce6680
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
vp10/encoder/buf_ans.h
vp10/encoder/buf_ans.h
+87
-0
No files found.
vp10/encoder/buf_ans.h
0 → 100644
View file @
109ef96a
/*
* Copyright (c) 2016 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VP10_ENCODER_BUF_ANS_H_
#define VP10_ENCODER_BUF_ANS_H_
// Buffered forward ANS writer.
// Symbols are written to the writer in forward (decode) order and serialzed
// backwards due to ANS's stack like behavior.
#include <assert.h>
#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
#include "vpx_ports/mem_ops.h"
#include "vp10/common/ans.h"
#ifdef __cplusplus
extern
"C"
{
#endif // __cplusplus
#define ANS_METHOD_UABS 0
#define ANS_METHOD_RANS 1
struct
buffered_ans_symbol
{
uint8_t
method
;
// one of ANS_METHOD_UABS or ANS_METHOD_RANS
// TODO(aconverse): Should be possible to write this interms of start for ABS
AnsP8
val_start
;
// Boolean value for ABS, start in symbol cycle for Rans
AnsP8
prob
;
// Probability of this symbol
};
struct
BufAnsCoder
{
struct
buffered_ans_symbol
*
buf
;
int
size
;
int
offset
;
};
static
INLINE
void
buf_ans_write_init
(
struct
BufAnsCoder
*
const
c
,
struct
buffered_ans_symbol
*
sym_arr
,
int
size
)
{
c
->
buf
=
sym_arr
;
c
->
size
=
size
;
c
->
offset
=
0
;
}
static
INLINE
void
buf_uabs_write
(
struct
BufAnsCoder
*
const
c
,
uint8_t
val
,
AnsP8
prob
)
{
assert
(
c
->
offset
<
c
->
size
);
c
->
buf
[
c
->
offset
].
method
=
ANS_METHOD_UABS
;
c
->
buf
[
c
->
offset
].
val_start
=
val
;
c
->
buf
[
c
->
offset
].
prob
=
prob
;
++
c
->
offset
;
}
static
INLINE
void
buf_rans_write
(
struct
BufAnsCoder
*
const
c
,
const
struct
rans_sym
*
const
sym
)
{
assert
(
c
->
offset
<
c
->
size
);
c
->
buf
[
c
->
offset
].
method
=
ANS_METHOD_RANS
;
c
->
buf
[
c
->
offset
].
val_start
=
sym
->
cum_prob
;
c
->
buf
[
c
->
offset
].
prob
=
sym
->
prob
;
++
c
->
offset
;
}
static
INLINE
void
buf_ans_flush
(
const
struct
BufAnsCoder
*
const
c
,
struct
AnsCoder
*
ans
)
{
int
offset
;
for
(
offset
=
c
->
offset
-
1
;
offset
>=
0
;
--
offset
)
{
if
(
c
->
buf
[
offset
].
method
==
ANS_METHOD_RANS
)
{
struct
rans_sym
sym
;
sym
.
prob
=
c
->
buf
[
offset
].
prob
;
sym
.
cum_prob
=
c
->
buf
[
offset
].
val_start
;
rans_write
(
ans
,
&
sym
);
}
else
{
uabs_write
(
ans
,
c
->
buf
[
offset
].
val_start
,
c
->
buf
[
offset
].
prob
);
}
}
}
#ifdef __cplusplus
}
// extern "C"
#endif // __cplusplus
#endif // VP10_ENCODER_BUF_ANS_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment