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
f7e30cc1
Commit
f7e30cc1
authored
Jan 01, 2012
by
Aneesh Dogra
Committed by
Anton Khirnov
Jan 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bfi: K&R cosmetics
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
87d98748
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
bfi.c
libavcodec/bfi.c
+12
-11
No files found.
libavcodec/bfi.c
View file @
f7e30cc1
...
@@ -36,7 +36,7 @@ typedef struct BFIContext {
...
@@ -36,7 +36,7 @@ typedef struct BFIContext {
uint8_t
*
dst
;
uint8_t
*
dst
;
}
BFIContext
;
}
BFIContext
;
static
av_cold
int
bfi_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
bfi_decode_init
(
AVCodecContext
*
avctx
)
{
{
BFIContext
*
bfi
=
avctx
->
priv_data
;
BFIContext
*
bfi
=
avctx
->
priv_data
;
avctx
->
pix_fmt
=
PIX_FMT_PAL8
;
avctx
->
pix_fmt
=
PIX_FMT_PAL8
;
...
@@ -44,7 +44,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
...
@@ -44,7 +44,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
return
0
;
return
0
;
}
}
static
int
bfi_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
bfi_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
int
*
data_size
,
AVPacket
*
avpkt
)
{
{
const
uint8_t
*
buf
=
avpkt
->
data
,
*
buf_end
=
avpkt
->
data
+
avpkt
->
size
;
const
uint8_t
*
buf
=
avpkt
->
data
,
*
buf_end
=
avpkt
->
data
+
avpkt
->
size
;
...
@@ -71,11 +71,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -71,11 +71,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
bfi
->
frame
.
pict_type
=
AV_PICTURE_TYPE_I
;
bfi
->
frame
.
pict_type
=
AV_PICTURE_TYPE_I
;
bfi
->
frame
.
key_frame
=
1
;
bfi
->
frame
.
key_frame
=
1
;
/* Setting the palette */
/* Setting the palette */
if
(
avctx
->
extradata_size
>
768
)
{
if
(
avctx
->
extradata_size
>
768
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Palette is too large.
\n
"
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Palette is too large.
\n
"
);
return
-
1
;
return
-
1
;
}
}
pal
=
(
uint32_t
*
)
bfi
->
frame
.
data
[
1
];
pal
=
(
uint32_t
*
)
bfi
->
frame
.
data
[
1
];
for
(
i
=
0
;
i
<
avctx
->
extradata_size
/
3
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
extradata_size
/
3
;
i
++
)
{
int
shift
=
16
;
int
shift
=
16
;
*
pal
=
0
;
*
pal
=
0
;
...
@@ -91,16 +91,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -91,16 +91,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
bfi
->
frame
.
key_frame
=
0
;
bfi
->
frame
.
key_frame
=
0
;
}
}
buf
+=
4
;
//Unpacked size, not required.
buf
+=
4
;
//
Unpacked size, not required.
while
(
dst
!=
frame_end
)
{
while
(
dst
!=
frame_end
)
{
static
const
uint8_t
lentab
[
4
]
=
{
0
,
2
,
0
,
1
};
static
const
uint8_t
lentab
[
4
]
=
{
0
,
2
,
0
,
1
};
unsigned
int
byte
=
*
buf
++
,
av_uninit
(
offset
);
unsigned
int
byte
=
*
buf
++
,
av_uninit
(
offset
);
unsigned
int
code
=
byte
>>
6
;
unsigned
int
code
=
byte
>>
6
;
unsigned
int
length
=
byte
&
~
0xC0
;
unsigned
int
length
=
byte
&
~
0xC0
;
if
(
buf
>=
buf_end
)
{
if
(
buf
>=
buf_end
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Input resolution larger than actual frame.
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Input resolution larger than actual frame.
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -120,7 +121,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -120,7 +121,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
}
}
/* Do boundary check */
/* Do boundary check */
if
(
dst
+
(
length
<<
lentab
[
code
])
>
frame_end
)
if
(
dst
+
(
length
<<
lentab
[
code
])
>
frame_end
)
break
;
break
;
switch
(
code
)
{
switch
(
code
)
{
...
@@ -167,7 +168,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -167,7 +168,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
dst
+=
bfi
->
frame
.
linesize
[
0
];
dst
+=
bfi
->
frame
.
linesize
[
0
];
}
}
*
data_size
=
sizeof
(
AVFrame
);
*
data_size
=
sizeof
(
AVFrame
);
*
(
AVFrame
*
)
data
=
bfi
->
frame
;
*
(
AVFrame
*
)
data
=
bfi
->
frame
;
return
buf_size
;
return
buf_size
;
}
}
...
...
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