Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
114a2eb2
Commit
114a2eb2
authored
Feb 21, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: Use av_clip_uintp2() where possible
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
d301a134
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
adpcmenc.c
libavcodec/adpcmenc.c
+1
-1
cngenc.c
libavcodec/cngenc.c
+1
-1
cook.c
libavcodec/cook.c
+2
-2
hevc.c
libavcodec/hevc.c
+2
-2
ivi_common.c
libavcodec/ivi_common.c
+1
-1
No files found.
libavcodec/adpcmenc.c
View file @
114a2eb2
...
@@ -581,7 +581,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
...
@@ -581,7 +581,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
// init the encoder state
// init the encoder state
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
{
// clip step so it fits 6 bits
// clip step so it fits 6 bits
c
->
status
[
i
].
step_index
=
av_clip
(
c
->
status
[
i
].
step_index
,
0
,
63
);
c
->
status
[
i
].
step_index
=
av_clip
_uintp2
(
c
->
status
[
i
].
step_index
,
6
);
put_sbits
(
&
pb
,
16
,
samples
[
i
]);
put_sbits
(
&
pb
,
16
,
samples
[
i
]);
put_bits
(
&
pb
,
6
,
c
->
status
[
i
].
step_index
);
put_bits
(
&
pb
,
6
,
c
->
status
[
i
].
step_index
);
c
->
status
[
i
].
prev_sample
=
samples
[
i
];
c
->
status
[
i
].
prev_sample
=
samples
[
i
];
...
...
libavcodec/cngenc.c
View file @
114a2eb2
...
@@ -87,7 +87,7 @@ static int cng_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
...
@@ -87,7 +87,7 @@ static int cng_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
energy
/=
frame
->
nb_samples
;
energy
/=
frame
->
nb_samples
;
if
(
energy
>
0
)
{
if
(
energy
>
0
)
{
double
dbov
=
10
*
log10
(
energy
/
1081109975
);
double
dbov
=
10
*
log10
(
energy
/
1081109975
);
qdbov
=
av_clip
(
-
floor
(
dbov
),
0
,
12
7
);
qdbov
=
av_clip
_uintp2
(
-
floor
(
dbov
),
7
);
}
else
{
}
else
{
qdbov
=
127
;
qdbov
=
127
;
}
}
...
...
libavcodec/cook.c
View file @
114a2eb2
...
@@ -418,7 +418,7 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
...
@@ -418,7 +418,7 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
num_bits
=
0
;
num_bits
=
0
;
index
=
0
;
index
=
0
;
for
(
j
=
p
->
total_subbands
;
j
>
0
;
j
--
)
{
for
(
j
=
p
->
total_subbands
;
j
>
0
;
j
--
)
{
exp_idx
=
av_clip
((
i
-
quant_index_table
[
index
]
+
bias
)
/
2
,
0
,
7
);
exp_idx
=
av_clip
_uintp2
((
i
-
quant_index_table
[
index
]
+
bias
)
/
2
,
3
);
index
++
;
index
++
;
num_bits
+=
expbits_tab
[
exp_idx
];
num_bits
+=
expbits_tab
[
exp_idx
];
}
}
...
@@ -429,7 +429,7 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
...
@@ -429,7 +429,7 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
/* Calculate total number of bits. */
/* Calculate total number of bits. */
num_bits
=
0
;
num_bits
=
0
;
for
(
i
=
0
;
i
<
p
->
total_subbands
;
i
++
)
{
for
(
i
=
0
;
i
<
p
->
total_subbands
;
i
++
)
{
exp_idx
=
av_clip
((
bias
-
quant_index_table
[
i
])
/
2
,
0
,
7
);
exp_idx
=
av_clip
_uintp2
((
bias
-
quant_index_table
[
i
])
/
2
,
3
);
num_bits
+=
expbits_tab
[
exp_idx
];
num_bits
+=
expbits_tab
[
exp_idx
];
exp_index1
[
i
]
=
exp_idx
;
exp_index1
[
i
]
=
exp_idx
;
exp_index2
[
i
]
=
exp_idx
;
exp_index2
[
i
]
=
exp_idx
;
...
...
libavcodec/hevc.c
View file @
114a2eb2
...
@@ -148,10 +148,10 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
...
@@ -148,10 +148,10 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
luma_log2_weight_denom
=
get_ue_golomb_long
(
gb
);
luma_log2_weight_denom
=
get_ue_golomb_long
(
gb
);
if
(
luma_log2_weight_denom
<
0
||
luma_log2_weight_denom
>
7
)
if
(
luma_log2_weight_denom
<
0
||
luma_log2_weight_denom
>
7
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"luma_log2_weight_denom %d is invalid
\n
"
,
luma_log2_weight_denom
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"luma_log2_weight_denom %d is invalid
\n
"
,
luma_log2_weight_denom
);
s
->
sh
.
luma_log2_weight_denom
=
av_clip
(
luma_log2_weight_denom
,
0
,
7
);
s
->
sh
.
luma_log2_weight_denom
=
av_clip
_uintp2
(
luma_log2_weight_denom
,
3
);
if
(
s
->
sps
->
chroma_format_idc
!=
0
)
{
if
(
s
->
sps
->
chroma_format_idc
!=
0
)
{
int
delta
=
get_se_golomb
(
gb
);
int
delta
=
get_se_golomb
(
gb
);
s
->
sh
.
chroma_log2_weight_denom
=
av_clip
(
s
->
sh
.
luma_log2_weight_denom
+
delta
,
0
,
7
);
s
->
sh
.
chroma_log2_weight_denom
=
av_clip
_uintp2
(
s
->
sh
.
luma_log2_weight_denom
+
delta
,
3
);
}
}
for
(
i
=
0
;
i
<
s
->
sh
.
nb_refs
[
L0
];
i
++
)
{
for
(
i
=
0
;
i
<
s
->
sh
.
nb_refs
[
L0
];
i
++
)
{
...
...
libavcodec/ivi_common.c
View file @
114a2eb2
...
@@ -646,7 +646,7 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band,
...
@@ -646,7 +646,7 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band,
quant
=
band
->
glob_quant
+
mb
->
q_delta
;
quant
=
band
->
glob_quant
+
mb
->
q_delta
;
if
(
avctx
->
codec_id
==
AV_CODEC_ID_INDEO4
)
if
(
avctx
->
codec_id
==
AV_CODEC_ID_INDEO4
)
quant
=
av_clip
(
quant
,
0
,
31
);
quant
=
av_clip
_uintp2
(
quant
,
5
);
else
else
quant
=
av_clip
(
quant
,
0
,
23
);
quant
=
av_clip
(
quant
,
0
,
23
);
...
...
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