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
a8014534
Commit
a8014534
authored
Mar 07, 2014
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g2meet: K&R formatting cosmetics
parent
f87a6e50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
30 deletions
+41
-30
g2meet.c
libavcodec/g2meet.c
+41
-30
No files found.
libavcodec/g2meet.c
View file @
a8014534
...
@@ -198,8 +198,8 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
...
@@ -198,8 +198,8 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
if
(
dc
)
if
(
dc
)
dc
=
get_xbits
(
gb
,
dc
);
dc
=
get_xbits
(
gb
,
dc
);
dc
=
dc
*
qmat
[
0
]
+
c
->
prev_dc
[
plane
];
dc
=
dc
*
qmat
[
0
]
+
c
->
prev_dc
[
plane
];
block
[
0
]
=
dc
;
block
[
0
]
=
dc
;
c
->
prev_dc
[
plane
]
=
dc
;
c
->
prev_dc
[
plane
]
=
dc
;
pos
=
0
;
pos
=
0
;
...
@@ -214,8 +214,8 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
...
@@ -214,8 +214,8 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
if
(
val
)
{
if
(
val
)
{
int
nbits
=
val
;
int
nbits
=
val
;
val
=
get_xbits
(
gb
,
nbits
);
val
=
get_xbits
(
gb
,
nbits
);
val
*=
qmat
[
ff_zigzag_direct
[
pos
]];
val
*=
qmat
[
ff_zigzag_direct
[
pos
]];
block
[
c
->
scantable
.
permutated
[
pos
]]
=
val
;
block
[
c
->
scantable
.
permutated
[
pos
]]
=
val
;
}
}
}
}
...
@@ -359,7 +359,7 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
...
@@ -359,7 +359,7 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
width
=
FFMIN
(
c
->
width
-
tile_x
*
c
->
tile_width
,
c
->
tile_width
);
width
=
FFMIN
(
c
->
width
-
tile_x
*
c
->
tile_width
,
c
->
tile_width
);
height
=
FFMIN
(
c
->
height
-
tile_y
*
c
->
tile_height
,
c
->
tile_height
);
height
=
FFMIN
(
c
->
height
-
tile_y
*
c
->
tile_height
,
c
->
tile_height
);
hdr
=
*
src
++
;
hdr
=
*
src
++
;
sub_type
=
hdr
>>
5
;
sub_type
=
hdr
>>
5
;
if
(
sub_type
==
0
)
{
if
(
sub_type
==
0
)
{
int
j
;
int
j
;
...
@@ -379,19 +379,21 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
...
@@ -379,19 +379,21 @@ static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y,
src
+=
3
;
src
+=
3
;
}
}
npal
=
*
src
++
+
1
;
npal
=
*
src
++
+
1
;
memcpy
(
pal
,
src
,
npal
*
3
);
src
+=
npal
*
3
;
memcpy
(
pal
,
src
,
npal
*
3
);
src
+=
npal
*
3
;
if
(
sub_type
!=
2
)
{
if
(
sub_type
!=
2
)
{
for
(
i
=
0
;
i
<
npal
;
i
++
)
{
for
(
i
=
0
;
i
<
npal
;
i
++
)
{
if
(
!
memcmp
(
pal
+
i
*
3
,
transp
,
3
))
{
if
(
!
memcmp
(
pal
+
i
*
3
,
transp
,
3
))
{
tidx
=
i
;
tidx
=
i
;
break
;
break
;
}
}
}
}
}
}
if
(
src_end
-
src
<
2
)
if
(
src_end
-
src
<
2
)
return
0
;
return
0
;
zsize
=
(
src
[
0
]
<<
8
)
|
src
[
1
];
src
+=
2
;
zsize
=
(
src
[
0
]
<<
8
)
|
src
[
1
];
src
+=
2
;
if
(
src_end
-
src
<
zsize
)
if
(
src_end
-
src
<
zsize
)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
...
@@ -487,12 +489,12 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
...
@@ -487,12 +489,12 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
uint32_t
cursor_hot_x
,
cursor_hot_y
;
uint32_t
cursor_hot_x
,
cursor_hot_y
;
int
cursor_fmt
,
err
;
int
cursor_fmt
,
err
;
cur_size
=
bytestream2_get_be32
(
gb
);
cur_size
=
bytestream2_get_be32
(
gb
);
cursor_w
=
bytestream2_get_byte
(
gb
);
cursor_w
=
bytestream2_get_byte
(
gb
);
cursor_h
=
bytestream2_get_byte
(
gb
);
cursor_h
=
bytestream2_get_byte
(
gb
);
cursor_hot_x
=
bytestream2_get_byte
(
gb
);
cursor_hot_x
=
bytestream2_get_byte
(
gb
);
cursor_hot_y
=
bytestream2_get_byte
(
gb
);
cursor_hot_y
=
bytestream2_get_byte
(
gb
);
cursor_fmt
=
bytestream2_get_byte
(
gb
);
cursor_fmt
=
bytestream2_get_byte
(
gb
);
cursor_stride
=
FFALIGN
(
cursor_w
,
32
)
*
4
;
cursor_stride
=
FFALIGN
(
cursor_w
,
32
)
*
4
;
...
@@ -540,7 +542,7 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
...
@@ -540,7 +542,7 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
bits
=
bytestream2_get_be32
(
gb
);
bits
=
bytestream2_get_be32
(
gb
);
for
(
k
=
0
;
k
<
32
;
k
++
)
{
for
(
k
=
0
;
k
<
32
;
k
++
)
{
dst
[
0
]
=
!!
(
bits
&
0x80000000
);
dst
[
0
]
=
!!
(
bits
&
0x80000000
);
dst
+=
4
;
dst
+=
4
;
bits
<<=
1
;
bits
<<=
1
;
}
}
}
}
...
@@ -555,18 +557,24 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
...
@@ -555,18 +557,24 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
int
mask_bit
=
!!
(
bits
&
0x80000000
);
int
mask_bit
=
!!
(
bits
&
0x80000000
);
switch
(
dst
[
0
]
*
2
+
mask_bit
)
{
switch
(
dst
[
0
]
*
2
+
mask_bit
)
{
case
0
:
case
0
:
dst
[
0
]
=
0xFF
;
dst
[
1
]
=
0x00
;
dst
[
0
]
=
0xFF
;
dst
[
2
]
=
0x00
;
dst
[
3
]
=
0x00
;
dst
[
1
]
=
0x00
;
dst
[
2
]
=
0x00
;
dst
[
3
]
=
0x00
;
break
;
break
;
case
1
:
case
1
:
dst
[
0
]
=
0xFF
;
dst
[
1
]
=
0xFF
;
dst
[
0
]
=
0xFF
;
dst
[
2
]
=
0xFF
;
dst
[
3
]
=
0xFF
;
dst
[
1
]
=
0xFF
;
dst
[
2
]
=
0xFF
;
dst
[
3
]
=
0xFF
;
break
;
break
;
default:
default:
dst
[
0
]
=
0x00
;
dst
[
1
]
=
0x00
;
dst
[
0
]
=
0x00
;
dst
[
2
]
=
0x00
;
dst
[
3
]
=
0x00
;
dst
[
1
]
=
0x00
;
dst
[
2
]
=
0x00
;
dst
[
3
]
=
0x00
;
}
}
dst
+=
4
;
dst
+=
4
;
bits
<<=
1
;
bits
<<=
1
;
}
}
}
}
...
@@ -727,10 +735,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -727,10 +735,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
}
}
c
->
tiles_x
=
(
c
->
width
+
c
->
tile_width
-
1
)
/
c
->
tile_width
;
c
->
tiles_x
=
(
c
->
width
+
c
->
tile_width
-
1
)
/
c
->
tile_width
;
c
->
tiles_y
=
(
c
->
height
+
c
->
tile_height
-
1
)
/
c
->
tile_height
;
c
->
tiles_y
=
(
c
->
height
+
c
->
tile_height
-
1
)
/
c
->
tile_height
;
c
->
bpp
=
bytestream2_get_byte
(
&
bc
);
c
->
bpp
=
bytestream2_get_byte
(
&
bc
);
if
(
c
->
bpp
==
32
)
{
if
(
c
->
bpp
==
32
)
{
if
(
bytestream2_get_bytes_left
(
&
bc
)
<
16
||
if
(
bytestream2_get_bytes_left
(
&
bc
)
<
16
||
(
chunk_size
-
21
)
<
16
)
{
(
chunk_size
-
21
)
<
16
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Display info: missing bitmasks!
\n
"
);
"Display info: missing bitmasks!
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
...
@@ -833,7 +841,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -833,7 +841,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
memcpy
(
pic
->
data
[
0
]
+
i
*
pic
->
linesize
[
0
],
memcpy
(
pic
->
data
[
0
]
+
i
*
pic
->
linesize
[
0
],
c
->
framebuf
+
i
*
c
->
framebuf_stride
,
c
->
framebuf
+
i
*
c
->
framebuf_stride
,
c
->
width
*
3
);
c
->
width
*
3
);
g2m_paint_cursor
(
c
,
pic
->
data
[
0
],
pic
->
linesize
[
0
]);
g2m_paint_cursor
(
c
,
pic
->
data
[
0
],
pic
->
linesize
[
0
]);
...
@@ -841,15 +849,18 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -841,15 +849,18 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
}
}
return
buf_size
;
return
buf_size
;
header_fail:
header_fail:
c
->
width
=
c
->
height
=
0
;
c
->
width
=
c
->
tiles_x
=
c
->
tiles_y
=
0
;
c
->
height
=
0
;
c
->
tiles_x
=
c
->
tiles_y
=
0
;
return
ret
;
return
ret
;
}
}
static
av_cold
int
g2m_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
g2m_decode_init
(
AVCodecContext
*
avctx
)
{
{
G2MContext
*
const
c
=
avctx
->
priv_data
;
G2MContext
*
const
c
=
avctx
->
priv_data
;
int
ret
;
int
ret
;
if
((
ret
=
jpg_init
(
avctx
,
&
c
->
jc
))
!=
0
)
{
if
((
ret
=
jpg_init
(
avctx
,
&
c
->
jc
))
!=
0
)
{
...
@@ -865,7 +876,7 @@ static av_cold int g2m_decode_init(AVCodecContext *avctx)
...
@@ -865,7 +876,7 @@ static av_cold int g2m_decode_init(AVCodecContext *avctx)
static
av_cold
int
g2m_decode_end
(
AVCodecContext
*
avctx
)
static
av_cold
int
g2m_decode_end
(
AVCodecContext
*
avctx
)
{
{
G2MContext
*
const
c
=
avctx
->
priv_data
;
G2MContext
*
const
c
=
avctx
->
priv_data
;
jpg_free_context
(
&
c
->
jc
);
jpg_free_context
(
&
c
->
jc
);
...
...
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