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
dff0f035
Commit
dff0f035
authored
Apr 20, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg2_fast_decode_block_intra()
Originally committed as revision 4146 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
bfaad39f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
3 deletions
+80
-3
mpeg12.c
libavcodec/mpeg12.c
+80
-3
No files found.
libavcodec/mpeg12.c
View file @
dff0f035
...
...
@@ -72,6 +72,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
DCTELEM
*
block
,
int
n
);
static
inline
int
mpeg2_fast_decode_block_non_intra
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
);
static
inline
int
mpeg2_fast_decode_block_intra
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
);
static
int
mpeg_decode_motion
(
MpegEncContext
*
s
,
int
fcode
,
int
pred
);
static
void
exchange_uv
(
MpegEncContext
*
s
);
...
...
@@ -1173,9 +1174,15 @@ static int mpeg_decode_mb(MpegEncContext *s,
#endif
if
(
s
->
codec_id
==
CODEC_ID_MPEG2VIDEO
)
{
for
(
i
=
0
;
i
<
mb_block_count
;
i
++
)
{
if
(
mpeg2_decode_block_intra
(
s
,
s
->
pblocks
[
i
],
i
)
<
0
)
return
-
1
;
if
(
s
->
flags2
&
CODEC_FLAG2_FAST
){
for
(
i
=
0
;
i
<
6
;
i
++
)
{
mpeg2_fast_decode_block_intra
(
s
,
s
->
pblocks
[
i
],
i
);
}
}
else
{
for
(
i
=
0
;
i
<
mb_block_count
;
i
++
)
{
if
(
mpeg2_decode_block_intra
(
s
,
s
->
pblocks
[
i
],
i
)
<
0
)
return
-
1
;
}
}
}
else
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
...
...
@@ -1928,6 +1935,76 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
return
0
;
}
static
inline
int
mpeg2_fast_decode_block_intra
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
)
{
int
level
,
dc
,
diff
,
j
,
run
;
int
component
;
RLTable
*
rl
;
uint8_t
*
scantable
=
s
->
intra_scantable
.
permutated
;
const
uint16_t
*
quant_matrix
;
const
int
qscale
=
s
->
qscale
;
/* DC coef */
if
(
n
<
4
){
quant_matrix
=
s
->
intra_matrix
;
component
=
0
;
}
else
{
quant_matrix
=
s
->
chroma_intra_matrix
;
component
=
(
n
&
1
)
+
1
;
}
diff
=
decode_dc
(
&
s
->
gb
,
component
);
if
(
diff
>=
0xffff
)
return
-
1
;
dc
=
s
->
last_dc
[
component
];
dc
+=
diff
;
s
->
last_dc
[
component
]
=
dc
;
block
[
0
]
=
dc
<<
(
3
-
s
->
intra_dc_precision
);
if
(
s
->
intra_vlc_format
)
rl
=
&
rl_mpeg2
;
else
rl
=
&
rl_mpeg1
;
{
OPEN_READER
(
re
,
&
s
->
gb
);
/* now quantify & encode AC coefs */
for
(;;)
{
UPDATE_CACHE
(
re
,
&
s
->
gb
);
GET_RL_VLC
(
level
,
run
,
re
,
&
s
->
gb
,
rl
->
rl_vlc
[
0
],
TEX_VLC_BITS
,
2
,
0
);
if
(
level
==
127
){
break
;
}
else
if
(
level
!=
0
)
{
scantable
+=
run
;
j
=
*
scantable
;
level
=
(
level
*
qscale
*
quant_matrix
[
j
])
>>
4
;
level
=
(
level
^
SHOW_SBITS
(
re
,
&
s
->
gb
,
1
))
-
SHOW_SBITS
(
re
,
&
s
->
gb
,
1
);
LAST_SKIP_BITS
(
re
,
&
s
->
gb
,
1
);
}
else
{
/* escape */
run
=
SHOW_UBITS
(
re
,
&
s
->
gb
,
6
)
+
1
;
LAST_SKIP_BITS
(
re
,
&
s
->
gb
,
6
);
UPDATE_CACHE
(
re
,
&
s
->
gb
);
level
=
SHOW_SBITS
(
re
,
&
s
->
gb
,
12
);
SKIP_BITS
(
re
,
&
s
->
gb
,
12
);
scantable
+=
run
;
j
=
*
scantable
;
if
(
level
<
0
){
level
=
(
-
level
*
qscale
*
quant_matrix
[
j
])
>>
4
;
level
=
-
level
;
}
else
{
level
=
(
level
*
qscale
*
quant_matrix
[
j
])
>>
4
;
}
}
block
[
j
]
=
level
;
}
CLOSE_READER
(
re
,
&
s
->
gb
);
}
s
->
block_last_index
[
n
]
=
scantable
-
s
->
intra_scantable
.
permutated
;
return
0
;
}
typedef
struct
Mpeg1Context
{
MpegEncContext
mpeg_enc_ctx
;
int
mpeg_enc_ctx_allocated
;
/* true if decoding context allocated */
...
...
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