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
efdb198e
Commit
efdb198e
authored
Jun 27, 2011
by
Reimar Döffinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
targa: Simplify using bytestream_get functions.
Signed-off-by:
Reimar Döffinger
<
Reimar.Doeffinger@gmx.de
>
parent
51293367
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
targa.c
libavcodec/targa.c
+8
-10
No files found.
libavcodec/targa.c
View file @
efdb198e
...
...
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "targa.h"
typedef
struct
TargaContext
{
...
...
@@ -116,13 +117,13 @@ static int decode_frame(AVCodecContext *avctx,
idlen
=
*
buf
++
;
buf
++
;
/* pal */
compr
=
*
buf
++
;
first_clr
=
AV_RL16
(
buf
);
buf
+=
2
;
colors
=
AV_RL16
(
buf
);
buf
+=
2
;
first_clr
=
bytestream_get_le16
(
&
buf
)
;
colors
=
bytestream_get_le16
(
&
buf
)
;
csize
=
*
buf
++
;
buf
+=
2
;
/* x */
y
=
AV_RL16
(
buf
);
buf
+=
2
;
w
=
AV_RL16
(
buf
);
buf
+=
2
;
h
=
AV_RL16
(
buf
);
buf
+=
2
;
y
=
bytestream_get_le16
(
&
buf
)
;
w
=
bytestream_get_le16
(
&
buf
)
;
h
=
bytestream_get_le16
(
&
buf
)
;
bpp
=
*
buf
++
;
flags
=
*
buf
++
;
//skip identifier if any
...
...
@@ -186,13 +187,10 @@ static int decode_frame(AVCodecContext *avctx,
if
(
avctx
->
pix_fmt
!=
PIX_FMT_PAL8
)
//should not occur but skip palette anyway
buf
+=
pal_size
;
else
{
int
r
,
g
,
b
,
t
;
int
t
;
int32_t
*
pal
=
((
int32_t
*
)
p
->
data
[
1
])
+
first_clr
;
for
(
t
=
0
;
t
<
colors
;
t
++
){
b
=
*
buf
++
;
g
=
*
buf
++
;
r
=
*
buf
++
;
*
pal
++
=
(
0xff
<<
24
)
|
(
r
<<
16
)
|
(
g
<<
8
)
|
b
;
*
pal
++
=
(
0xff
<<
24
)
|
bytestream_get_le24
(
&
buf
);
}
p
->
palette_has_changed
=
1
;
}
...
...
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