Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
2e181c2d
Commit
2e181c2d
authored
Mar 29, 2013
by
John Koleszar
Committed by
Gerrit Code Review
Mar 29, 2013
Browse files
Merge "General code cleanup." into experimental
parents
282a89f3
180cd5fa
Changes
8
Hide whitespace changes
Inline
Side-by-side
vp9/common/vp9_entropymv.c
View file @
2e181c2d
...
...
@@ -116,11 +116,8 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
}
int
vp9_use_nmv_hp
(
const
MV
*
ref
)
{
if
((
abs
(
ref
->
row
)
>>
3
)
<
COMPANDED_MVREF_THRESH
&&
(
abs
(
ref
->
col
)
>>
3
)
<
COMPANDED_MVREF_THRESH
)
return
1
;
else
return
0
;
return
(
abs
(
ref
->
row
)
>>
3
)
<
COMPANDED_MVREF_THRESH
&&
(
abs
(
ref
->
col
)
>>
3
)
<
COMPANDED_MVREF_THRESH
;
}
int
vp9_get_mv_mag
(
MV_CLASS_TYPE
c
,
int
offset
)
{
...
...
@@ -231,13 +228,13 @@ static void adapt_prob(vp9_prob *dest, vp9_prob prep,
}
}
void
vp9_counts_process
(
nmv_context_counts
*
NMV
count
,
int
usehp
)
{
counts_to_context
(
&
NMV
count
->
comps
[
0
],
usehp
);
counts_to_context
(
&
NMV
count
->
comps
[
1
],
usehp
);
void
vp9_counts_process
(
nmv_context_counts
*
nmv_
count
,
int
usehp
)
{
counts_to_context
(
&
nmv_
count
->
comps
[
0
],
usehp
);
counts_to_context
(
&
nmv_
count
->
comps
[
1
],
usehp
);
}
void
vp9_counts_to_nmv_context
(
nmv_context_counts
*
NMV
count
,
nmv_context_counts
*
nmv_
count
,
nmv_context
*
prob
,
int
usehp
,
unsigned
int
(
*
branch_ct_joint
)[
2
],
...
...
@@ -250,29 +247,29 @@ void vp9_counts_to_nmv_context(
unsigned
int
(
*
branch_ct_class0_hp
)[
2
],
unsigned
int
(
*
branch_ct_hp
)[
2
])
{
int
i
,
j
,
k
;
vp9_counts_process
(
NMV
count
,
usehp
);
vp9_counts_process
(
nmv_
count
,
usehp
);
vp9_tree_probs_from_distribution
(
vp9_mv_joint_tree
,
prob
->
joints
,
branch_ct_joint
,
NMV
count
->
joints
,
0
);
nmv_
count
->
joints
,
0
);
for
(
i
=
0
;
i
<
2
;
++
i
)
{
prob
->
comps
[
i
].
sign
=
get_binary_prob
(
NMV
count
->
comps
[
i
].
sign
[
0
],
NMV
count
->
comps
[
i
].
sign
[
1
]);
branch_ct_sign
[
i
][
0
]
=
NMV
count
->
comps
[
i
].
sign
[
0
];
branch_ct_sign
[
i
][
1
]
=
NMV
count
->
comps
[
i
].
sign
[
1
];
prob
->
comps
[
i
].
sign
=
get_binary_prob
(
nmv_
count
->
comps
[
i
].
sign
[
0
],
nmv_
count
->
comps
[
i
].
sign
[
1
]);
branch_ct_sign
[
i
][
0
]
=
nmv_
count
->
comps
[
i
].
sign
[
0
];
branch_ct_sign
[
i
][
1
]
=
nmv_
count
->
comps
[
i
].
sign
[
1
];
vp9_tree_probs_from_distribution
(
vp9_mv_class_tree
,
prob
->
comps
[
i
].
classes
,
branch_ct_classes
[
i
],
NMV
count
->
comps
[
i
].
classes
,
0
);
nmv_
count
->
comps
[
i
].
classes
,
0
);
vp9_tree_probs_from_distribution
(
vp9_mv_class0_tree
,
prob
->
comps
[
i
].
class0
,
branch_ct_class0
[
i
],
NMV
count
->
comps
[
i
].
class0
,
0
);
nmv_
count
->
comps
[
i
].
class0
,
0
);
for
(
j
=
0
;
j
<
MV_OFFSET_BITS
;
++
j
)
{
prob
->
comps
[
i
].
bits
[
j
]
=
get_binary_prob
(
NMV
count
->
comps
[
i
].
bits
[
j
][
0
],
NMV
count
->
comps
[
i
].
bits
[
j
][
1
]);
branch_ct_bits
[
i
][
j
][
0
]
=
NMV
count
->
comps
[
i
].
bits
[
j
][
0
];
branch_ct_bits
[
i
][
j
][
1
]
=
NMV
count
->
comps
[
i
].
bits
[
j
][
1
];
prob
->
comps
[
i
].
bits
[
j
]
=
get_binary_prob
(
nmv_
count
->
comps
[
i
].
bits
[
j
][
0
],
nmv_
count
->
comps
[
i
].
bits
[
j
][
1
]);
branch_ct_bits
[
i
][
j
][
0
]
=
nmv_
count
->
comps
[
i
].
bits
[
j
][
0
];
branch_ct_bits
[
i
][
j
][
1
]
=
nmv_
count
->
comps
[
i
].
bits
[
j
][
1
];
}
}
for
(
i
=
0
;
i
<
2
;
++
i
)
{
...
...
@@ -280,25 +277,25 @@ void vp9_counts_to_nmv_context(
vp9_tree_probs_from_distribution
(
vp9_mv_fp_tree
,
prob
->
comps
[
i
].
class0_fp
[
k
],
branch_ct_class0_fp
[
i
][
k
],
NMV
count
->
comps
[
i
].
class0_fp
[
k
],
0
);
nmv_
count
->
comps
[
i
].
class0_fp
[
k
],
0
);
}
vp9_tree_probs_from_distribution
(
vp9_mv_fp_tree
,
prob
->
comps
[
i
].
fp
,
branch_ct_fp
[
i
],
NMV
count
->
comps
[
i
].
fp
,
0
);
nmv_
count
->
comps
[
i
].
fp
,
0
);
}
if
(
usehp
)
{
for
(
i
=
0
;
i
<
2
;
++
i
)
{
prob
->
comps
[
i
].
class0_hp
=
get_binary_prob
(
NMV
count
->
comps
[
i
].
class0_hp
[
0
],
NMV
count
->
comps
[
i
].
class0_hp
[
1
]);
branch_ct_class0_hp
[
i
][
0
]
=
NMV
count
->
comps
[
i
].
class0_hp
[
0
];
branch_ct_class0_hp
[
i
][
1
]
=
NMV
count
->
comps
[
i
].
class0_hp
[
1
];
prob
->
comps
[
i
].
hp
=
get_binary_prob
(
NMV
count
->
comps
[
i
].
hp
[
0
],
NMV
count
->
comps
[
i
].
hp
[
1
]);
branch_ct_hp
[
i
][
0
]
=
NMV
count
->
comps
[
i
].
hp
[
0
];
branch_ct_hp
[
i
][
1
]
=
NMV
count
->
comps
[
i
].
hp
[
1
];
get_binary_prob
(
nmv_
count
->
comps
[
i
].
class0_hp
[
0
],
nmv_
count
->
comps
[
i
].
class0_hp
[
1
]);
branch_ct_class0_hp
[
i
][
0
]
=
nmv_
count
->
comps
[
i
].
class0_hp
[
0
];
branch_ct_class0_hp
[
i
][
1
]
=
nmv_
count
->
comps
[
i
].
class0_hp
[
1
];
prob
->
comps
[
i
].
hp
=
get_binary_prob
(
nmv_
count
->
comps
[
i
].
hp
[
0
],
nmv_
count
->
comps
[
i
].
hp
[
1
]);
branch_ct_hp
[
i
][
0
]
=
nmv_
count
->
comps
[
i
].
hp
[
0
];
branch_ct_hp
[
i
][
1
]
=
nmv_
count
->
comps
[
i
].
hp
[
1
];
}
}
}
...
...
@@ -308,32 +305,26 @@ static unsigned int adapt_probs(unsigned int i,
vp9_prob
this_probs
[],
const
vp9_prob
last_probs
[],
const
unsigned
int
num_events
[])
{
unsigned
int
left
,
right
,
weight
;
vp9_prob
this_prob
;
if
(
tree
[
i
]
<=
0
)
{
left
=
num_events
[
-
tree
[
i
]];
}
else
{
left
=
adapt_probs
(
tree
[
i
],
tree
,
this_probs
,
last_probs
,
num_events
);
}
if
(
tree
[
i
+
1
]
<=
0
)
{
right
=
num_events
[
-
tree
[
i
+
1
]];
}
else
{
right
=
adapt_probs
(
tree
[
i
+
1
],
tree
,
this_probs
,
last_probs
,
num_events
);
}
const
uint32_t
left
=
tree
[
i
]
<=
0
?
num_events
[
-
tree
[
i
]]
:
adapt_probs
(
tree
[
i
],
tree
,
this_probs
,
last_probs
,
num_events
);
const
uint32_t
right
=
tree
[
i
+
1
]
<=
0
?
num_events
[
-
tree
[
i
+
1
]]
:
adapt_probs
(
tree
[
i
+
1
],
tree
,
this_probs
,
last_probs
,
num_events
);
weight
=
left
+
right
;
uint32_t
weight
=
left
+
right
;
if
(
weight
)
{
this_prob
=
get_binary_prob
(
left
,
right
);
weight
=
weight
>
MV_COUNT_SAT
?
MV_COUNT_SAT
:
weight
;
this_prob
=
weighted_prob
(
last_probs
[
i
>>
1
],
this_prob
,
this_prob
=
weighted_prob
(
last_probs
[
i
>>
1
],
this_prob
,
MV_MAX_UPDATE_FACTOR
*
weight
/
MV_COUNT_SAT
);
}
else
{
this_prob
=
last_probs
[
i
>>
1
];
}
this_probs
[
i
>>
1
]
=
this_prob
;
this_probs
[
i
>>
1
]
=
this_prob
;
return
left
+
right
;
}
...
...
vp9/common/vp9_extend.c
View file @
2e181c2d
...
...
@@ -11,159 +11,137 @@
#include
"vp9/common/vp9_extend.h"
#include
"vpx_mem/vpx_mem.h"
static
void
copy_and_extend_plane
(
uint8_t
*
s
,
/* source */
int
sp
,
/* source pitch */
uint8_t
*
d
,
/* destination */
int
dp
,
/* destination pitch */
int
h
,
/* height */
int
w
,
/* width */
int
et
,
/* extend top border */
int
el
,
/* extend left border */
int
eb
,
/* extend bottom border */
int
er
)
{
/* extend right border */
int
i
;
uint8_t
*
src_ptr1
,
*
src_ptr2
;
uint8_t
*
dest_ptr1
,
*
dest_ptr2
;
int
linesize
;
/* copy the left and right most columns out */
src_ptr1
=
s
;
src_ptr2
=
s
+
w
-
1
;
dest_ptr1
=
d
-
el
;
dest_ptr2
=
d
+
w
;
static
void
copy_and_extend_plane
(
const
uint8_t
*
src
,
int
src_pitch
,
uint8_t
*
dst
,
int
dst_pitch
,
int
w
,
int
h
,
int
extend_top
,
int
extend_left
,
int
extend_bottom
,
int
extend_right
)
{
int
i
,
linesize
;
// copy the left and right most columns out
const
uint8_t
*
src_ptr1
=
src
;
const
uint8_t
*
src_ptr2
=
src
+
w
-
1
;
uint8_t
*
dst_ptr1
=
dst
-
extend_left
;
uint8_t
*
dst_ptr2
=
dst
+
w
;
for
(
i
=
0
;
i
<
h
;
i
++
)
{
vpx_memset
(
d
e
st_ptr1
,
src_ptr1
[
0
],
e
l
);
vpx_memcpy
(
d
e
st_ptr1
+
e
l
,
src_ptr1
,
w
);
vpx_memset
(
d
e
st_ptr2
,
src_ptr2
[
0
],
e
r
);
src_ptr1
+=
s
p
;
src_ptr2
+=
s
p
;
d
e
st_ptr1
+=
d
p
;
d
e
st_ptr2
+=
d
p
;
vpx_memset
(
dst_ptr1
,
src_ptr1
[
0
],
e
xtend_left
);
vpx_memcpy
(
dst_ptr1
+
e
xtend_left
,
src_ptr1
,
w
);
vpx_memset
(
dst_ptr2
,
src_ptr2
[
0
],
e
xtend_right
);
src_ptr1
+=
s
rc_pitch
;
src_ptr2
+=
s
rc_pitch
;
dst_ptr1
+=
d
st_pitch
;
dst_ptr2
+=
d
st_pitch
;
}
/* Now copy the top and bottom lines into each line of the respective
* borders
*/
src_ptr1
=
d
-
el
;
src_ptr2
=
d
+
dp
*
(
h
-
1
)
-
el
;
dest_ptr1
=
d
+
dp
*
(
-
et
)
-
el
;
dest_ptr2
=
d
+
dp
*
(
h
)
-
el
;
linesize
=
el
+
er
+
w
;
for
(
i
=
0
;
i
<
et
;
i
++
)
{
vpx_memcpy
(
dest_ptr1
,
src_ptr1
,
linesize
);
dest_ptr1
+=
dp
;
// Now copy the top and bottom lines into each line of the respective
// borders
src_ptr1
=
dst
-
extend_left
;
src_ptr2
=
dst
+
dst_pitch
*
(
h
-
1
)
-
extend_left
;
dst_ptr1
=
dst
+
dst_pitch
*
(
-
extend_top
)
-
extend_left
;
dst_ptr2
=
dst
+
dst_pitch
*
(
h
)
-
extend_left
;
linesize
=
extend_left
+
extend_right
+
w
;
for
(
i
=
0
;
i
<
extend_top
;
i
++
)
{
vpx_memcpy
(
dst_ptr1
,
src_ptr1
,
linesize
);
dst_ptr1
+=
dst_pitch
;
}
for
(
i
=
0
;
i
<
e
b
;
i
++
)
{
vpx_memcpy
(
d
e
st_ptr2
,
src_ptr2
,
linesize
);
d
e
st_ptr2
+=
d
p
;
for
(
i
=
0
;
i
<
e
xtend_bottom
;
i
++
)
{
vpx_memcpy
(
dst_ptr2
,
src_ptr2
,
linesize
);
dst_ptr2
+=
d
st_pitch
;
}
}
void
vp9_copy_and_extend_frame
(
YV12_BUFFER_CONFIG
*
src
,
void
vp9_copy_and_extend_frame
(
const
YV12_BUFFER_CONFIG
*
src
,
YV12_BUFFER_CONFIG
*
dst
)
{
int
et
=
dst
->
border
;
int
el
=
dst
->
border
;
int
eb
=
dst
->
border
+
dst
->
y_height
-
src
->
y_height
;
int
er
=
dst
->
border
+
dst
->
y_width
-
src
->
y_width
;
const
int
et_y
=
dst
->
border
;
const
int
el_y
=
dst
->
border
;
const
int
eb_y
=
dst
->
border
+
dst
->
y_height
-
src
->
y_height
;
const
int
er_y
=
dst
->
border
+
dst
->
y_width
-
src
->
y_width
;
const
int
et_uv
=
dst
->
border
>>
1
;
const
int
el_uv
=
dst
->
border
>>
1
;
const
int
eb_uv
=
(
dst
->
border
>>
1
)
+
dst
->
uv_height
-
src
->
uv_height
;
const
int
er_uv
=
(
dst
->
border
>>
1
)
+
dst
->
uv_width
-
src
->
uv_width
;
copy_and_extend_plane
(
src
->
y_buffer
,
src
->
y_stride
,
dst
->
y_buffer
,
dst
->
y_stride
,
src
->
y_height
,
src
->
y_width
,
et
,
el
,
eb
,
er
);
et
=
dst
->
border
>>
1
;
el
=
dst
->
border
>>
1
;
eb
=
(
dst
->
border
>>
1
)
+
dst
->
uv_height
-
src
->
uv_height
;
er
=
(
dst
->
border
>>
1
)
+
dst
->
uv_width
-
src
->
uv_width
;
src
->
y_width
,
src
->
y_height
,
et_y
,
el_y
,
eb_y
,
er_y
);
copy_and_extend_plane
(
src
->
u_buffer
,
src
->
uv_stride
,
dst
->
u_buffer
,
dst
->
uv_stride
,
src
->
uv_
height
,
src
->
uv_
width
,
et
,
el
,
eb
,
er
);
src
->
uv_
width
,
src
->
uv_
height
,
et
_uv
,
el
_uv
,
eb
_uv
,
er
_uv
);
copy_and_extend_plane
(
src
->
v_buffer
,
src
->
uv_stride
,
dst
->
v_buffer
,
dst
->
uv_stride
,
src
->
uv_
height
,
src
->
uv_
width
,
et
,
el
,
eb
,
er
);
src
->
uv_
width
,
src
->
uv_
height
,
et
_y
,
el
_y
,
eb
_uv
,
er
_uv
);
}
void
vp9_copy_and_extend_frame_with_rect
(
YV12_BUFFER_CONFIG
*
src
,
void
vp9_copy_and_extend_frame_with_rect
(
const
YV12_BUFFER_CONFIG
*
src
,
YV12_BUFFER_CONFIG
*
dst
,
int
srcy
,
int
srcx
,
int
srch
,
int
srcw
)
{
int
et
=
dst
->
border
;
int
el
=
dst
->
border
;
int
eb
=
dst
->
border
+
dst
->
y_height
-
src
->
y_height
;
int
er
=
dst
->
border
+
dst
->
y_width
-
src
->
y_width
;
int
src_y_offset
=
srcy
*
src
->
y_stride
+
srcx
;
int
dst_y_offset
=
srcy
*
dst
->
y_stride
+
srcx
;
int
src_uv_offset
=
((
srcy
*
src
->
uv_stride
)
>>
1
)
+
(
srcx
>>
1
);
int
dst_uv_offset
=
((
srcy
*
dst
->
uv_stride
)
>>
1
)
+
(
srcx
>>
1
);
// If the side is not touching the bounder then don't extend.
if
(
srcy
)
et
=
0
;
if
(
srcx
)
el
=
0
;
if
(
srcy
+
srch
!=
src
->
y_height
)
eb
=
0
;
if
(
srcx
+
srcw
!=
src
->
y_width
)
er
=
0
;
copy_and_extend_plane
(
src
->
y_buffer
+
src_y_offset
,
src
->
y_stride
,
dst
->
y_buffer
+
dst_y_offset
,
dst
->
y_stride
,
srch
,
srcw
,
et
,
el
,
eb
,
er
);
et
=
(
et
+
1
)
>>
1
;
el
=
(
el
+
1
)
>>
1
;
eb
=
(
eb
+
1
)
>>
1
;
er
=
(
er
+
1
)
>>
1
;
srch
=
(
srch
+
1
)
>>
1
;
srcw
=
(
srcw
+
1
)
>>
1
;
copy_and_extend_plane
(
src
->
u_buffer
+
src_uv_offset
,
src
->
uv_stride
,
dst
->
u_buffer
+
dst_uv_offset
,
dst
->
uv_stride
,
srch
,
srcw
,
et
,
el
,
eb
,
er
);
copy_and_extend_plane
(
src
->
v_buffer
+
src_uv_offset
,
src
->
uv_stride
,
dst
->
v_buffer
+
dst_uv_offset
,
dst
->
uv_stride
,
srch
,
srcw
,
et
,
el
,
eb
,
er
);
const
int
et_y
=
srcy
?
0
:
dst
->
border
;
const
int
el_y
=
srcx
?
0
:
dst
->
border
;
const
int
eb_y
=
srcy
+
srch
!=
src
->
y_height
?
0
:
dst
->
border
+
dst
->
y_height
-
src
->
y_height
;
const
int
er_y
=
srcx
+
srcw
!=
src
->
y_width
?
0
:
dst
->
border
+
dst
->
y_width
-
src
->
y_width
;
const
int
src_y_offset
=
srcy
*
src
->
y_stride
+
srcx
;
const
int
dst_y_offset
=
srcy
*
dst
->
y_stride
+
srcx
;
const
int
et_uv
=
(
et_y
+
1
)
>>
1
;
const
int
el_uv
=
(
el_y
+
1
)
>>
1
;
const
int
eb_uv
=
(
eb_y
+
1
)
>>
1
;
const
int
er_uv
=
(
er_y
+
1
)
>>
1
;
const
int
src_uv_offset
=
((
srcy
*
src
->
uv_stride
)
>>
1
)
+
(
srcx
>>
1
);
const
int
dst_uv_offset
=
((
srcy
*
dst
->
uv_stride
)
>>
1
)
+
(
srcx
>>
1
);
const
int
srch_uv
=
(
srch
+
1
)
>>
1
;
const
int
srcw_uv
=
(
srcw
+
1
)
>>
1
;
copy_and_extend_plane
(
src
->
y_buffer
+
src_y_offset
,
src
->
y_stride
,
dst
->
y_buffer
+
dst_y_offset
,
dst
->
y_stride
,
srcw
,
srch
,
et_y
,
el_y
,
eb_y
,
er_y
);
copy_and_extend_plane
(
src
->
u_buffer
+
src_uv_offset
,
src
->
uv_stride
,
dst
->
u_buffer
+
dst_uv_offset
,
dst
->
uv_stride
,
srcw_uv
,
srch_uv
,
et_uv
,
el_uv
,
eb_uv
,
er_uv
);
copy_and_extend_plane
(
src
->
v_buffer
+
src_uv_offset
,
src
->
uv_stride
,
dst
->
v_buffer
+
dst_uv_offset
,
dst
->
uv_stride
,
srcw_uv
,
srch_uv
,
et_uv
,
el_uv
,
eb_uv
,
er_uv
);
}
/
*
note the extension is only for the last row, for intra prediction purpose
*/
void
vp9_extend_mb_row
(
YV12_BUFFER_CONFIG
*
ybf
,
uint8_t
*
YPtr
,
uint8_t
*
UPtr
,
uint8_t
*
VPtr
)
{
/
/
note the extension is only for the last row, for intra prediction purpose
void
vp9_extend_mb_row
(
YV12_BUFFER_CONFIG
*
buf
,
uint8_t
*
y
,
uint8_t
*
u
,
uint8_t
*
v
)
{
int
i
;
YPtr
+=
y
bf
->
y_stride
*
14
;
UPtr
+=
y
bf
->
uv_stride
*
6
;
VPtr
+=
y
bf
->
uv_stride
*
6
;
y
+=
b
u
f
->
y_stride
*
14
;
u
+=
b
u
f
->
uv_stride
*
6
;
v
+=
b
u
f
->
uv_stride
*
6
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
YPtr
[
i
]
=
YPtr
[
-
1
];
UPtr
[
i
]
=
UPtr
[
-
1
];
VPtr
[
i
]
=
VPtr
[
-
1
];
y
[
i
]
=
y
[
-
1
];
u
[
i
]
=
u
[
-
1
];
v
[
i
]
=
v
[
-
1
];
}
YPtr
+=
y
bf
->
y_stride
;
UPtr
+=
y
bf
->
uv_stride
;
VPtr
+=
y
bf
->
uv_stride
;
y
+=
b
u
f
->
y_stride
;
u
+=
b
u
f
->
uv_stride
;
v
+=
b
u
f
->
uv_stride
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
YPtr
[
i
]
=
YPtr
[
-
1
];
UPtr
[
i
]
=
UPtr
[
-
1
];
VPtr
[
i
]
=
VPtr
[
-
1
];
y
[
i
]
=
y
[
-
1
];
u
[
i
]
=
u
[
-
1
];
v
[
i
]
=
v
[
-
1
];
}
}
vp9/common/vp9_extend.h
View file @
2e181c2d
...
...
@@ -14,15 +14,17 @@
#include
"vpx_scale/yv12config.h"
#include
"vpx/vpx_integer.h"
void
vp9_extend_mb_row
(
YV12_BUFFER_CONFIG
*
ybf
,
uint8_t
*
YPtr
,
uint8_t
*
UPtr
,
uint8_t
*
VPtr
);
void
vp9_copy_and_extend_frame
(
YV12_BUFFER_CONFIG
*
src
,
void
vp9_copy_and_extend_frame
(
const
YV12_BUFFER_CONFIG
*
src
,
YV12_BUFFER_CONFIG
*
dst
);
void
vp9_copy_and_extend_frame_with_rect
(
YV12_BUFFER_CONFIG
*
src
,
void
vp9_copy_and_extend_frame_with_rect
(
const
YV12_BUFFER_CONFIG
*
src
,
YV12_BUFFER_CONFIG
*
dst
,
int
srcy
,
int
srcx
,
int
srch
,
int
srcw
);
void
vp9_extend_mb_row
(
YV12_BUFFER_CONFIG
*
buf
,
uint8_t
*
y
,
uint8_t
*
u
,
uint8_t
*
v
);
#endif // VP9_COMMON_VP9_EXTEND_H_
vp9/common/vp9_postproc.c
View file @
2e181c2d
...
...
@@ -336,11 +336,8 @@ void vp9_deblock(YV12_BUFFER_CONFIG *source,
source
->
uv_height
,
source
->
uv_width
,
ppl
);
}
void
vp9_de_noise
(
YV12_BUFFER_CONFIG
*
src
,
YV12_BUFFER_CONFIG
*
post
,
int
q
,
int
low_var_thresh
,
int
flag
)
{
void
vp9_denoise
(
YV12_BUFFER_CONFIG
*
src
,
YV12_BUFFER_CONFIG
*
post
,
int
q
,
int
low_var_thresh
,
int
flag
)
{
double
level
=
6.0e-05
*
q
*
q
*
q
-
.
0067
*
q
*
q
+
.
306
*
q
+
.
0065
;
int
ppl
=
(
int
)(
level
+
.
5
);
(
void
)
post
;
...
...
vp9/common/vp9_postproc.h
View file @
2e181c2d
...
...
@@ -29,8 +29,8 @@ struct postproc_state {
int
vp9_post_proc_frame
(
struct
VP9Common
*
oci
,
YV12_BUFFER_CONFIG
*
dest
,
vp9_ppflags_t
*
flags
);
void
vp9_de
_
noise
(
YV12_BUFFER_CONFIG
*
source
,
YV12_BUFFER_CONFIG
*
post
,
int
q
,
int
low_var_thresh
,
int
flag
);
void
vp9_denoise
(
YV12_BUFFER_CONFIG
*
source
,
YV12_BUFFER_CONFIG
*
post
,
int
q
,
int
low_var_thresh
,
int
flag
);
void
vp9_deblock
(
YV12_BUFFER_CONFIG
*
source
,
YV12_BUFFER_CONFIG
*
post
,
int
q
,
int
low_var_thresh
,
int
flag
);
...
...
vp9/decoder/vp9_dboolhuff.h
View file @
2e181c2d
...
...
@@ -88,34 +88,28 @@ static int decode_value(BOOL_DECODER *br, int bits) {
int
bit
;
for
(
bit
=
bits
-
1
;
bit
>=
0
;
bit
--
)
{
z
|=
(
decode_bool
(
br
,
0x80
)
<<
bit
)
;
z
|=
decode_bool
(
br
,
0x80
)
<<
bit
;
}
return
z
;
}
static
int
bool_error
(
BOOL_DECODER
*
br
)
{
/* Check if we have reached the end of the buffer.
*
* Variable 'count' stores the number of bits in the 'value' buffer, minus
* 8. The top byte is part of the algorithm, and the remainder is buffered
* to be shifted into it. So if count == 8, the top 16 bits of 'value' are
* occupied, 8 for the algorithm and 8 in the buffer.
*
* When reading a byte from the user's buffer, count is filled with 8 and
* one byte is filled into the value buffer. When we reach the end of the
* data, count is additionally filled with VP9_LOTS_OF_BITS. So when
* count == VP9_LOTS_OF_BITS - 1, the user's data has been exhausted.
*/
if
((
br
->
count
>
VP9_BD_VALUE_SIZE
)
&&
(
br
->
count
<
VP9_LOTS_OF_BITS
))
{
/* We have tried to decode bits after the end of
* stream was encountered.
*/
return
1
;
}
/* No error. */
return
0
;
// Check if we have reached the end of the buffer.
//
// Variable 'count' stores the number of bits in the 'value' buffer, minus
// 8. The top byte is part of the algorithm, and the remainder is buffered
// to be shifted into it. So if count == 8, the top 16 bits of 'value' are
// occupied, 8 for the algorithm and 8 in the buffer.
//
// When reading a byte from the user's buffer, count is filled with 8 and
// one byte is filled into the value buffer. When we reach the end of the
// data, count is additionally filled with VP9_LOTS_OF_BITS. So when
// count == VP9_LOTS_OF_BITS - 1, the user's data has been exhausted.
//
// 1 if we have tried to decode bits after the end of stream was encountered.
// 0 No error.
return
br
->
count
>
VP9_BD_VALUE_SIZE
&&
br
->
count
<
VP9_LOTS_OF_BITS
;
}
int
vp9_decode_unsigned_max
(
BOOL_DECODER
*
br
,
int
max
);
...
...
vp9/decoder/vp9_onyxd_if.c
View file @
2e181c2d
...
...
@@ -154,8 +154,8 @@ void vp9_remove_decompressor(VP9D_PTR ptr) {
if
(
!
pbi
)
return
;
// Delete sementation map
if
(
pbi
->
common
.
last_frame_seg_map
!=
0
)
// Delete se
g
mentation map
if
(
pbi
->
common
.
last_frame_seg_map
)
vpx_free
(
pbi
->
common
.
last_frame_seg_map
);
vp9_remove_common
(
&
pbi
->
common
);
...
...
@@ -163,6 +163,10 @@ void vp9_remove_decompressor(VP9D_PTR ptr) {
vpx_free
(
pbi
);
}
static
int
equal_dimensions
(
YV12_BUFFER_CONFIG
*
a
,
YV12_BUFFER_CONFIG
*
b
)
{
return
a
->
y_height
==
b
->
y_height
&&
a
->
y_width
==
b
->
y_width
&&
a
->
uv_height
==
b
->
uv_height
&&
a
->
uv_width
==
b
->
uv_width
;
}
vpx_codec_err_t
vp9_copy_reference_dec
(
VP9D_PTR
ptr
,
VP9_REFFRAME
ref_frame_flag
,
...
...
@@ -176,22 +180,20 @@ vpx_codec_err_t vp9_copy_reference_dec(VP9D_PTR ptr,
* vpxenc --test-decode functionality working, and will be replaced in a
* later commit that adds VP9-specific controls for this functionality.
*/
if
(
ref_frame_flag
==
VP9_LAST_FLAG
)
if
(
ref_frame_flag
==
VP9_LAST_FLAG
)
{
ref_fb_idx
=
pbi
->
common
.
ref_frame_map
[
0
];
else
{
}
else
{
vpx_internal_error
(
&
pbi
->
common
.
error
,
VPX_CODEC_ERROR
,
"Invalid reference frame"
);
return
pbi
->
common
.
error
.
error_code
;
}
if
(
cm
->
yv12_fb
[
ref_fb_idx
].
y_height
!=
sd
->
y_height
||
cm
->
yv12_fb
[
ref_fb_idx
].
y_width
!=
sd
->
y_width
||
cm
->
yv12_fb
[
ref_fb_idx
].
uv_height
!=
sd
->
uv_height
||
cm
->
yv12_fb
[
ref_fb_idx
].
uv_width
!=
sd
->
uv_width
)
{
if
(
!
equal_dimensions
(
&
cm
->
yv12_fb
[
ref_fb_idx
],
sd
))
{
vpx_internal_error
(
&
pbi
->
common
.
error
,
VPX_CODEC_ERROR
,
"Incorrect buffer dimensions"
);
}
else
}
else
{
vp8_yv12_copy_frame
(
&
cm
->
yv12_fb
[
ref_fb_idx
],
sd
);
}
return
pbi
->
common
.
error
.
error_code
;
}
...
...
@@ -202,7 +204,6 @@ vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR ptr, VP9_REFFRAME ref_frame_flag,
VP9D_COMP
*
pbi
=
(
VP9D_COMP
*
)
ptr
;
VP9_COMMON
*
cm
=
&
pbi
->
common
;
int
*
ref_fb_ptr
=
NULL
;
int
free_fb
;
/* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the
* encoder is using the frame buffers for. This is just a stub to keep the
...
...
@@ -221,20 +222,17 @@ vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR ptr, VP9_REFFRAME ref_frame_flag,
return
pbi
->
common
.
error
.
error_code
;
}
if
(
cm
->
yv12_fb
[
*
ref_fb_ptr
].
y_height
!=
sd
->
y_height
||
cm
->
yv12_fb
[
*
ref_fb_ptr
].
y_width
!=
sd
->
y_width
||
cm
->
yv12_fb
[
*
ref_fb_ptr
].
uv_height
!=
sd
->
uv_height
||
cm
->
yv12_fb
[
*
ref_fb_ptr
].
uv_width
!=
sd
->
uv_width
)
{
if
(
!
equal_dimensions
(
&
cm
->
yv12_fb
[
*
ref_fb_ptr
],
sd
))
{
vpx_internal_error
(
&
pbi
->
common
.
error
,
VPX_CODEC_ERROR
,
"Incorrect buffer dimensions"
);
}
else
{
/
*
Find an empty frame buffer.
*/
free_fb
=
get_free_fb
(
cm
);
/
*
Decrease fb_idx_ref_cnt since it will be increased again in
*
ref_cnt_fb() below.
*/
/
/
Find an empty frame buffer.
const
int
free_fb
=
get_free_fb
(
cm
);
/
/
Decrease fb_idx_ref_cnt since it will be increased again in
//
ref_cnt_fb() below.
cm
->
fb_idx_ref_cnt
[
free_fb
]
--
;