Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
0a666470
Commit
0a666470
authored
Nov 04, 2014
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo_enc: factor out denominator and explicitly cast operands
CC: libav-stable@libav.org Bug-Id: CID 608053
parent
e0a1d0a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+7
-9
No files found.
libavcodec/mpegvideo_enc.c
View file @
0a666470
...
...
@@ -95,42 +95,40 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
fdsp
->
fdct
==
ff_jpeg_fdct_islow_10
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
const
int
j
=
s
->
idsp
.
idct_permutation
[
i
];
int64_t
den
=
(
int64_t
)
qscale
*
quant_matrix
[
j
];
/* 16 <= qscale * quant_matrix[i] <= 7905
* Assume x = ff_aanscales[i] * qscale * quant_matrix[i]
* 19952 <= x <= 249205026
* (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 249205026
* 3444240 >= (1 << 36) / (x) >= 275 */
qmat
[
qscale
][
i
]
=
(
int
)((
UINT64_C
(
1
)
<<
QMAT_SHIFT
)
/
(
qscale
*
quant_matrix
[
j
]));
qmat
[
qscale
][
i
]
=
(
int
)((
UINT64_C
(
1
)
<<
QMAT_SHIFT
)
/
den
);
}
}
else
if
(
fdsp
->
fdct
==
ff_fdct_ifast
)
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
const
int
j
=
s
->
idsp
.
idct_permutation
[
i
];
int64_t
den
=
ff_aanscales
[
i
]
*
(
int64_t
)
qscale
*
quant_matrix
[
j
];
/* 16 <= qscale * quant_matrix[i] <= 7905
* Assume x = ff_aanscales[i] * qscale * quant_matrix[i]
* 19952 <= x <= 249205026
* (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 249205026
* 3444240 >= (1 << 36) / (x) >= 275 */
qmat
[
qscale
][
i
]
=
(
int
)((
UINT64_C
(
1
)
<<
(
QMAT_SHIFT
+
14
))
/
(
ff_aanscales
[
i
]
*
qscale
*
quant_matrix
[
j
]));
qmat
[
qscale
][
i
]
=
(
int
)((
UINT64_C
(
1
)
<<
(
QMAT_SHIFT
+
14
))
/
den
);
}
}
else
{
for
(
i
=
0
;
i
<
64
;
i
++
)
{
const
int
j
=
s
->
idsp
.
idct_permutation
[
i
];
int64_t
den
=
(
int64_t
)
qscale
*
quant_matrix
[
j
];
/* We can safely suppose that 16 <= quant_matrix[i] <= 255
* Assume x = qscale * quant_matrix[i]
* So 16 <= x <= 7905
* so (1 << 19) / 16 >= (1 << 19) / (x) >= (1 << 19) / 7905
* so 32768 >= (1 << 19) / (x) >= 67 */
qmat
[
qscale
][
i
]
=
(
int
)((
UINT64_C
(
1
)
<<
QMAT_SHIFT
)
/
(
qscale
*
quant_matrix
[
j
]));
qmat
[
qscale
][
i
]
=
(
int
)((
UINT64_C
(
1
)
<<
QMAT_SHIFT
)
/
den
);
//qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) /
// (qscale * quant_matrix[i]);
qmat16
[
qscale
][
0
][
i
]
=
(
1
<<
QMAT_SHIFT_MMX
)
/
(
qscale
*
quant_matrix
[
j
]);
qmat16
[
qscale
][
0
][
i
]
=
(
1
<<
QMAT_SHIFT_MMX
)
/
den
;
if
(
qmat16
[
qscale
][
0
][
i
]
==
0
||
qmat16
[
qscale
][
0
][
i
]
==
128
*
256
)
...
...
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