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
6c916192
Commit
6c916192
authored
Apr 10, 2016
by
Alexandra Hájková
Committed by
Diego Biurrun
Dec 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mimic: Convert to the new bitstream reader
parent
cdc6727c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
mimic.c
libavcodec/mimic.c
+12
-12
No files found.
libavcodec/mimic.c
View file @
6c916192
...
...
@@ -24,9 +24,9 @@
#include <stdint.h>
#include "avcodec.h"
#include "bitstream.h"
#include "blockdsp.h"
#include "internal.h"
#include "get_bits.h"
#include "bytestream.h"
#include "bswapdsp.h"
#include "hpeldsp.h"
...
...
@@ -51,7 +51,7 @@ typedef struct MimicContext {
DECLARE_ALIGNED
(
16
,
int16_t
,
dct_block
)[
64
];
GetBitContext
gb
;
BitstreamContext
bc
;
ScanTable
scantable
;
BlockDSPContext
bdsp
;
BswapDSPContext
bbdsp
;
...
...
@@ -232,14 +232,14 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
ctx
->
bdsp
.
clear_block
(
block
);
block
[
0
]
=
get_bits
(
&
ctx
->
gb
,
8
)
<<
3
;
block
[
0
]
=
bitstream_read
(
&
ctx
->
bc
,
8
)
<<
3
;
for
(
pos
=
1
;
pos
<
num_coeffs
;
pos
++
)
{
uint32_t
vlc
,
num_bits
;
int
value
;
int
coeff
;
vlc
=
get_vlc2
(
&
ctx
->
gb
,
ctx
->
vlc
.
table
,
ctx
->
vlc
.
bits
,
3
);
vlc
=
bitstream_read_vlc
(
&
ctx
->
bc
,
ctx
->
vlc
.
table
,
ctx
->
vlc
.
bits
,
3
);
if
(
!
vlc
)
/* end-of-block code */
return
0
;
if
(
vlc
==
-
1
)
...
...
@@ -252,7 +252,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
if
(
pos
>=
64
)
return
AVERROR_INVALIDDATA
;
value
=
get_bits
(
&
ctx
->
gb
,
num_bits
);
value
=
bitstream_read
(
&
ctx
->
bc
,
num_bits
);
/* Libav's IDCT behaves somewhat different from the original code, so
* a factor of 4 was added to the input */
...
...
@@ -286,13 +286,13 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
for
(
x
=
0
;
x
<
ctx
->
num_hblocks
[
plane
];
x
++
)
{
/* Check for a change condition in the current block.
* - iframes always change.
* - Luma plane changes on
get_bits1
== 0
* - Chroma planes change on
get_bits1
== 1 */
if
(
is_iframe
||
get_bits1
(
&
ctx
->
gb
)
==
is_chroma
)
{
* - Luma plane changes on
bitstream_read_bit
== 0
* - Chroma planes change on
bitstream_read_bit
== 1 */
if
(
is_iframe
||
bitstream_read_bit
(
&
ctx
->
bc
)
==
is_chroma
)
{
/* Luma planes may use a backreference from the 15 last
* frames preceding the previous. (
get_bits1
== 1)
* frames preceding the previous. (
bitstream_read_bit
== 1)
* Chroma planes don't use backreferences. */
if
(
is_chroma
||
is_iframe
||
!
get_bits1
(
&
ctx
->
gb
))
{
if
(
is_chroma
||
is_iframe
||
!
bitstream_read_bit
(
&
ctx
->
bc
))
{
if
((
ret
=
vlc_decode_block
(
ctx
,
num_coeffs
,
qscale
))
<
0
)
{
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"Error decoding "
...
...
@@ -301,7 +301,7 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
}
ctx
->
idsp
.
idct_put
(
dst
,
stride
,
ctx
->
dct_block
);
}
else
{
unsigned
int
backref
=
get_bits
(
&
ctx
->
gb
,
4
);
unsigned
int
backref
=
bitstream_read
(
&
ctx
->
bc
,
4
);
int
index
=
(
ctx
->
cur_index
+
backref
)
&
15
;
uint8_t
*
p
=
ctx
->
frames
[
index
].
f
->
data
[
0
];
...
...
@@ -426,7 +426,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
ctx
->
bbdsp
.
bswap_buf
(
ctx
->
swap_buf
,
(
const
uint32_t
*
)
(
buf
+
MIMIC_HEADER_SIZE
),
swap_buf_size
>>
2
);
init_get_bits
(
&
ctx
->
gb
,
ctx
->
swap_buf
,
swap_buf_size
<<
3
);
bitstream_init
(
&
ctx
->
bc
,
ctx
->
swap_buf
,
swap_buf_size
<<
3
);
res
=
decode
(
ctx
,
quality
,
num_coeffs
,
!
is_pframe
);
ff_thread_report_progress
(
&
ctx
->
frames
[
ctx
->
cur_index
],
INT_MAX
,
0
);
...
...
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