Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
f6baa62c
Commit
f6baa62c
authored
11 years ago
by
Dmitry Kovalev
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Cleaning up vp9_quantize_b_c() function."
parents
3aa4b42a
d54ff9dc
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
forest
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
mcw
mcw2
nextgen
nextgenv2
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/debargha/playground
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
v1.3.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/encoder/vp9_quantize.c
+29
-43
vp9/encoder/vp9_quantize.c
with
29 additions
and
43 deletions
vp9/encoder/vp9_quantize.c
+
29
−
43
View file @
f6baa62c
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
extern
int
enc_debug
;
extern
int
enc_debug
;
#endif
#endif
void
vp9_quantize_b_c
(
const
int16_t
*
coeff_ptr
,
intptr_t
n_coeffs
,
void
vp9_quantize_b_c
(
const
int16_t
*
coeff_ptr
,
intptr_t
count
,
int
skip_block
,
int
skip_block
,
const
int16_t
*
zbin_ptr
,
const
int16_t
*
round_ptr
,
const
int16_t
*
zbin_ptr
,
const
int16_t
*
round_ptr
,
const
int16_t
*
quant_ptr
,
const
int16_t
*
quant_shift_ptr
,
const
int16_t
*
quant_ptr
,
const
int16_t
*
quant_shift_ptr
,
...
@@ -30,58 +30,44 @@ void vp9_quantize_b_c(const int16_t *coeff_ptr, intptr_t n_coeffs,
...
@@ -30,58 +30,44 @@ void vp9_quantize_b_c(const int16_t *coeff_ptr, intptr_t n_coeffs,
const
int16_t
*
dequant_ptr
,
const
int16_t
*
dequant_ptr
,
int
zbin_oq_value
,
uint16_t
*
eob_ptr
,
int
zbin_oq_value
,
uint16_t
*
eob_ptr
,
const
int16_t
*
scan
,
const
int16_t
*
iscan
)
{
const
int16_t
*
scan
,
const
int16_t
*
iscan
)
{
int
i
,
rc
,
eob
;
int
i
,
non_zero_count
=
count
,
eob
=
-
1
;
int
zbins
[
2
],
nzbins
[
2
],
zbin
;
const
int
zbins
[
2
]
=
{
zbin_ptr
[
0
]
+
zbin_oq_value
,
int
x
,
y
,
z
,
sz
;
zbin_ptr
[
1
]
+
zbin_oq_value
};
int
zero_flag
=
n_coeffs
;
const
int
nzbins
[
2
]
=
{
zbins
[
0
]
*
-
1
,
zbins
[
1
]
*
-
1
};
vpx_memset
(
qcoeff_ptr
,
0
,
n_coeffs
*
sizeof
(
int16_t
));
vpx_memset
(
qcoeff_ptr
,
0
,
count
*
sizeof
(
int16_t
));
vpx_memset
(
dqcoeff_ptr
,
0
,
n_coeffs
*
sizeof
(
int16_t
));
vpx_memset
(
dqcoeff_ptr
,
0
,
count
*
sizeof
(
int16_t
));
eob
=
-
1
;
// Base ZBIN
zbins
[
0
]
=
zbin_ptr
[
0
]
+
zbin_oq_value
;
zbins
[
1
]
=
zbin_ptr
[
1
]
+
zbin_oq_value
;
nzbins
[
0
]
=
zbins
[
0
]
*
-
1
;
nzbins
[
1
]
=
zbins
[
1
]
*
-
1
;
if
(
!
skip_block
)
{
if
(
!
skip_block
)
{
// Pre-scan pass
// Pre-scan pass
for
(
i
=
n_coeffs
-
1
;
i
>=
0
;
i
--
)
{
for
(
i
=
count
-
1
;
i
>=
0
;
i
--
)
{
rc
=
scan
[
i
];
const
int
rc
=
scan
[
i
];
z
=
coeff_ptr
[
rc
];
const
int
coeff
=
coeff_ptr
[
rc
];
if
(
z
<
zbins
[
rc
!=
0
]
&&
z
>
nzbins
[
rc
!=
0
])
{
if
(
coeff
<
zbins
[
rc
!=
0
]
&&
coeff
>
nzbins
[
rc
!=
0
])
zero_
flag
--
;
non_
zero_
count
--
;
}
else
{
else
break
;
break
;
}
}
}
// Quantization pass: All coefficients with index >= zero_flag are
// Quantization pass: All coefficients with index >= zero_flag are
// skippable. Note: zero_flag can be zero.
// skippable. Note: zero_flag can be zero.
for
(
i
=
0
;
i
<
zero_flag
;
i
++
)
{
for
(
i
=
0
;
i
<
non_zero_count
;
i
++
)
{
rc
=
scan
[
i
];
const
int
rc
=
scan
[
i
];
z
=
coeff_ptr
[
rc
];
const
int
coeff
=
coeff_ptr
[
rc
];
const
int
coeff_sign
=
(
coeff
>>
31
);
zbin
=
(
zbins
[
rc
!=
0
]);
const
int
abs_coeff
=
(
coeff
^
coeff_sign
)
-
coeff_sign
;
sz
=
(
z
>>
31
);
// sign of z
if
(
abs_coeff
>=
zbins
[
rc
!=
0
])
{
x
=
(
z
^
sz
)
-
sz
;
int
tmp
=
clamp
(
abs_coeff
+
round_ptr
[
rc
!=
0
],
INT16_MIN
,
INT16_MAX
);
tmp
=
((((
tmp
*
quant_ptr
[
rc
!=
0
])
>>
16
)
+
tmp
)
*
if
(
x
>=
zbin
)
{
quant_shift_ptr
[
rc
!=
0
])
>>
16
;
// quantization
x
+=
(
round_ptr
[
rc
!=
0
]);
qcoeff_ptr
[
rc
]
=
(
tmp
^
coeff_sign
)
-
coeff_sign
;
x
=
clamp
(
x
,
INT16_MIN
,
INT16_MAX
);
dqcoeff_ptr
[
rc
]
=
qcoeff_ptr
[
rc
]
*
dequant_ptr
[
rc
!=
0
];
y
=
(((
int
)(((
int
)(
x
*
quant_ptr
[
rc
!=
0
])
>>
16
)
+
x
))
*
quant_shift_ptr
[
rc
!=
0
])
>>
16
;
// quantize (x)
if
(
tmp
)
x
=
(
y
^
sz
)
-
sz
;
// get the sign back
eob
=
i
;
qcoeff_ptr
[
rc
]
=
x
;
// write to destination
dqcoeff_ptr
[
rc
]
=
x
*
dequant_ptr
[
rc
!=
0
];
// dequantized value
if
(
y
)
{
eob
=
i
;
// last nonzero coeffs
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets