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
15d4dbfd
Commit
15d4dbfd
authored
Apr 12, 2016
by
Alexandra Hájková
Committed by
Anton Khirnov
Nov 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jvdec: Convert to the new bitstream reader
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
1df549bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
jvdec.c
libavcodec/jvdec.c
+26
-26
No files found.
libavcodec/jvdec.c
View file @
15d4dbfd
...
...
@@ -28,8 +28,8 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bitstream.h"
#include "blockdsp.h"
#include "get_bits.h"
#include "internal.h"
typedef
struct
JvContext
{
...
...
@@ -62,84 +62,84 @@ static av_cold int decode_init(AVCodecContext *avctx)
/**
* Decode 2x2 block
*/
static
inline
void
decode2x2
(
GetBitContext
*
gb
,
uint8_t
*
dst
,
int
linesize
)
static
inline
void
decode2x2
(
BitstreamContext
*
bc
,
uint8_t
*
dst
,
int
linesize
)
{
int
i
,
j
,
v
[
2
];
switch
(
get_bits
(
gb
,
2
))
{
switch
(
bitstream_read
(
bc
,
2
))
{
case
1
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
0
]
=
bitstream_read
(
bc
,
8
);
for
(
j
=
0
;
j
<
2
;
j
++
)
memset
(
dst
+
j
*
linesize
,
v
[
0
],
2
);
break
;
case
2
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
1
]
=
get_bits
(
gb
,
8
);
v
[
0
]
=
bitstream_read
(
bc
,
8
);
v
[
1
]
=
bitstream_read
(
bc
,
8
);
for
(
j
=
0
;
j
<
2
;
j
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[
j
*
linesize
+
i
]
=
v
[
bitstream_read_bit
(
bc
)];
break
;
case
3
:
for
(
j
=
0
;
j
<
2
;
j
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
get_bits
(
gb
,
8
);
dst
[
j
*
linesize
+
i
]
=
bitstream_read
(
bc
,
8
);
}
}
/**
* Decode 4x4 block
*/
static
inline
void
decode4x4
(
GetBitContext
*
gb
,
uint8_t
*
dst
,
int
linesize
)
static
inline
void
decode4x4
(
BitstreamContext
*
bc
,
uint8_t
*
dst
,
int
linesize
)
{
int
i
,
j
,
v
[
2
];
switch
(
get_bits
(
gb
,
2
))
{
switch
(
bitstream_read
(
bc
,
2
))
{
case
1
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
0
]
=
bitstream_read
(
bc
,
8
);
for
(
j
=
0
;
j
<
4
;
j
++
)
memset
(
dst
+
j
*
linesize
,
v
[
0
],
4
);
break
;
case
2
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
1
]
=
get_bits
(
gb
,
8
);
v
[
0
]
=
bitstream_read
(
bc
,
8
);
v
[
1
]
=
bitstream_read
(
bc
,
8
);
for
(
j
=
2
;
j
>=
0
;
j
-=
2
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[
j
*
linesize
+
i
]
=
v
[
bitstream_read_bit
(
bc
)];
for
(
i
=
0
;
i
<
4
;
i
++
)
dst
[(
j
+
1
)
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[(
j
+
1
)
*
linesize
+
i
]
=
v
[
bitstream_read_bit
(
bc
)];
}
break
;
case
3
:
for
(
j
=
0
;
j
<
4
;
j
+=
2
)
for
(
i
=
0
;
i
<
4
;
i
+=
2
)
decode2x2
(
gb
,
dst
+
j
*
linesize
+
i
,
linesize
);
decode2x2
(
bc
,
dst
+
j
*
linesize
+
i
,
linesize
);
}
}
/**
* Decode 8x8 block
*/
static
inline
void
decode8x8
(
GetBitContext
*
gb
,
uint8_t
*
dst
,
int
linesize
,
static
inline
void
decode8x8
(
BitstreamContext
*
bc
,
uint8_t
*
dst
,
int
linesize
,
BlockDSPContext
*
bdsp
)
{
int
i
,
j
,
v
[
2
];
switch
(
get_bits
(
gb
,
2
))
{
switch
(
bitstream_read
(
bc
,
2
))
{
case
1
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
0
]
=
bitstream_read
(
bc
,
8
);
bdsp
->
fill_block_tab
[
1
](
dst
,
v
[
0
],
linesize
,
8
);
break
;
case
2
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
1
]
=
get_bits
(
gb
,
8
);
v
[
0
]
=
bitstream_read
(
bc
,
8
);
v
[
1
]
=
bitstream_read
(
bc
,
8
);
for
(
j
=
7
;
j
>=
0
;
j
--
)
for
(
i
=
0
;
i
<
8
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[
j
*
linesize
+
i
]
=
v
[
bitstream_read_bit
(
bc
)];
break
;
case
3
:
for
(
j
=
0
;
j
<
8
;
j
+=
4
)
for
(
i
=
0
;
i
<
8
;
i
+=
4
)
decode4x4
(
gb
,
dst
+
j
*
linesize
+
i
,
linesize
);
decode4x4
(
bc
,
dst
+
j
*
linesize
+
i
,
linesize
);
}
}
...
...
@@ -163,12 +163,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
}
if
(
video_type
==
0
||
video_type
==
1
)
{
GetBitContext
gb
;
init_get_bits
(
&
gb
,
buf
,
8
*
FFMIN
(
video_size
,
buf_end
-
buf
));
BitstreamContext
bc
;
bitstream_init
(
&
bc
,
buf
,
8
*
FFMIN
(
video_size
,
buf_end
-
buf
));
for
(
j
=
0
;
j
<
avctx
->
height
;
j
+=
8
)
for
(
i
=
0
;
i
<
avctx
->
width
;
i
+=
8
)
decode8x8
(
&
gb
,
decode8x8
(
&
bc
,
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
]
+
i
,
s
->
frame
->
linesize
[
0
],
&
s
->
bdsp
);
...
...
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