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
799703c3
Commit
799703c3
authored
Apr 10, 2016
by
Alexandra Hájková
Committed by
Anton Khirnov
Nov 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g2meet: Convert to the new bitstream reader
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
b37b681f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
g2meet.c
libavcodec/g2meet.c
+15
-15
No files found.
libavcodec/g2meet.c
View file @
799703c3
...
...
@@ -31,10 +31,10 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bitstream.h"
#include "blockdsp.h"
#include "bytestream.h"
#include "elsdec.h"
#include "get_bits.h"
#include "idctdsp.h"
#include "internal.h"
#include "jpegtables.h"
...
...
@@ -236,7 +236,7 @@ static void jpg_unescape(const uint8_t *src, int src_size,
*
dst_size
=
dst
-
dst_start
;
}
static
int
jpg_decode_block
(
JPGContext
*
c
,
GetBitContext
*
gb
,
static
int
jpg_decode_block
(
JPGContext
*
c
,
BitstreamContext
*
bc
,
int
plane
,
int16_t
*
block
)
{
int
dc
,
val
,
pos
;
...
...
@@ -244,18 +244,18 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
const
uint8_t
*
qmat
=
is_chroma
?
chroma_quant
:
luma_quant
;
c
->
bdsp
.
clear_block
(
block
);
dc
=
get_vlc2
(
gb
,
c
->
dc_vlc
[
is_chroma
].
table
,
9
,
3
);
dc
=
bitstream_read_vlc
(
bc
,
c
->
dc_vlc
[
is_chroma
].
table
,
9
,
3
);
if
(
dc
<
0
)
return
AVERROR_INVALIDDATA
;
if
(
dc
)
dc
=
get_xbits
(
gb
,
dc
);
dc
=
bitstream_read_xbits
(
bc
,
dc
);
dc
=
dc
*
qmat
[
0
]
+
c
->
prev_dc
[
plane
];
block
[
0
]
=
dc
;
c
->
prev_dc
[
plane
]
=
dc
;
pos
=
0
;
while
(
pos
<
63
)
{
val
=
get_vlc2
(
gb
,
c
->
ac_vlc
[
is_chroma
].
table
,
9
,
3
);
val
=
bitstream_read_vlc
(
bc
,
c
->
ac_vlc
[
is_chroma
].
table
,
9
,
3
);
if
(
val
<
0
)
return
AVERROR_INVALIDDATA
;
pos
+=
val
>>
4
;
...
...
@@ -265,7 +265,7 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
if
(
val
)
{
int
nbits
=
val
;
val
=
get_xbits
(
gb
,
nbits
);
val
=
bitstream_read_xbits
(
bc
,
nbits
);
val
*=
qmat
[
ff_zigzag_direct
[
pos
]];
block
[
c
->
scantable
.
permutated
[
pos
]]
=
val
;
}
...
...
@@ -286,7 +286,7 @@ static int jpg_decode_data(JPGContext *c, int width, int height,
const
uint8_t
*
mask
,
int
mask_stride
,
int
num_mbs
,
int
swapuv
)
{
GetBitContext
gb
;
BitstreamContext
bc
;
int
mb_w
,
mb_h
,
mb_x
,
mb_y
,
i
,
j
;
int
bx
,
by
;
int
unesc_size
;
...
...
@@ -298,7 +298,7 @@ static int jpg_decode_data(JPGContext *c, int width, int height,
return
ret
;
jpg_unescape
(
src
,
src_size
,
c
->
buf
,
&
unesc_size
);
memset
(
c
->
buf
+
unesc_size
,
0
,
AV_INPUT_BUFFER_PADDING_SIZE
);
init_get_bits
(
&
gb
,
c
->
buf
,
unesc_size
*
8
);
bitstream_init
(
&
bc
,
c
->
buf
,
unesc_size
*
8
);
width
=
FFALIGN
(
width
,
16
);
mb_w
=
width
>>
4
;
...
...
@@ -325,14 +325,14 @@ static int jpg_decode_data(JPGContext *c, int width, int height,
if
(
mask
&&
!
mask
[
mb_x
*
2
+
i
+
j
*
mask_stride
])
continue
;
num_mbs
--
;
if
((
ret
=
jpg_decode_block
(
c
,
&
gb
,
0
,
if
((
ret
=
jpg_decode_block
(
c
,
&
bc
,
0
,
c
->
block
[
i
+
j
*
2
]))
!=
0
)
return
ret
;
c
->
idsp
.
idct
(
c
->
block
[
i
+
j
*
2
]);
}
}
for
(
i
=
1
;
i
<
3
;
i
++
)
{
if
((
ret
=
jpg_decode_block
(
c
,
&
gb
,
i
,
c
->
block
[
i
+
3
]))
!=
0
)
if
((
ret
=
jpg_decode_block
(
c
,
&
bc
,
i
,
c
->
block
[
i
+
3
]))
!=
0
)
return
ret
;
c
->
idsp
.
idct
(
c
->
block
[
i
+
3
]);
}
...
...
@@ -1011,11 +1011,11 @@ static void kempf_restore_buf(const uint8_t *src, int len,
int
width
,
int
height
,
const
uint8_t
*
pal
,
int
npal
,
int
tidx
)
{
GetBitContext
gb
;
BitstreamContext
bc
;
int
i
,
j
,
nb
,
col
;
int
align_width
=
FFALIGN
(
width
,
16
);
init_get_bits
(
&
gb
,
src
,
len
*
8
);
bitstream_init
(
&
bc
,
src
,
len
*
8
);
if
(
npal
<=
2
)
nb
=
1
;
else
if
(
npal
<=
4
)
nb
=
2
;
...
...
@@ -1023,16 +1023,16 @@ static void kempf_restore_buf(const uint8_t *src, int len,
else
nb
=
8
;
for
(
j
=
0
;
j
<
height
;
j
++
,
dst
+=
stride
,
jpeg_tile
+=
tile_stride
)
{
if
(
get_bits
(
&
gb
,
8
))
if
(
bitstream_read
(
&
bc
,
8
))
continue
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
col
=
get_bits
(
&
gb
,
nb
);
col
=
bitstream_read
(
&
bc
,
nb
);
if
(
col
!=
tidx
)
memcpy
(
dst
+
i
*
3
,
pal
+
col
*
3
,
3
);
else
memcpy
(
dst
+
i
*
3
,
jpeg_tile
+
i
*
3
,
3
);
}
skip_bits_long
(
&
gb
,
nb
*
(
align_width
-
width
));
bitstream_skip
(
&
bc
,
nb
*
(
align_width
-
width
));
}
}
...
...
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