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
ef3a3519
Commit
ef3a3519
authored
Oct 14, 2015
by
Luca Barbato
Committed by
Vittorio Giovara
Oct 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rawdec: Replace avpicture functions with imgutils
Signed-off-by:
Vittorio Giovara
<
vittorio.giovara@gmail.com
>
parent
fcc1280a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
rawdec.c
libavcodec/rawdec.c
+14
-12
No files found.
libavcodec/rawdec.c
View file @
ef3a3519
...
...
@@ -109,8 +109,10 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
memset
(
context
->
palette
->
data
,
0
,
AVPALETTE_SIZE
);
}
context
->
frame_size
=
avpicture_get_size
(
avctx
->
pix_fmt
,
avctx
->
width
,
avctx
->
height
);
context
->
frame_size
=
av_image_get_buffer_size
(
avctx
->
pix_fmt
,
avctx
->
width
,
avctx
->
height
,
1
);
if
((
avctx
->
bits_per_coded_sample
==
4
||
avctx
->
bits_per_coded_sample
==
2
)
&&
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
&&
(
!
avctx
->
codec_tag
||
avctx
->
codec_tag
==
MKTAG
(
'r'
,
'a'
,
'w'
,
' '
)))
...
...
@@ -129,10 +131,10 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
return
0
;
}
static
void
flip
(
AVCodecContext
*
avctx
,
AV
Picture
*
pictur
e
)
static
void
flip
(
AVCodecContext
*
avctx
,
AV
Frame
*
fram
e
)
{
picture
->
data
[
0
]
+=
pictur
e
->
linesize
[
0
]
*
(
avctx
->
height
-
1
);
pictur
e
->
linesize
[
0
]
*=
-
1
;
frame
->
data
[
0
]
+=
fram
e
->
linesize
[
0
]
*
(
avctx
->
height
-
1
);
fram
e
->
linesize
[
0
]
*=
-
1
;
}
static
int
raw_decode
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
...
...
@@ -146,7 +148,6 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
int
res
;
AVFrame
*
frame
=
data
;
AVPicture
*
picture
=
data
;
frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
frame
->
key_frame
=
1
;
...
...
@@ -194,8 +195,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
avctx
->
codec_tag
==
MKTAG
(
'A'
,
'V'
,
'u'
,
'p'
))
buf
+=
buf_size
-
context
->
frame_size
;
if
((
res
=
avpicture_fill
(
picture
,
buf
,
avctx
->
pix_fmt
,
avctx
->
width
,
avctx
->
height
))
<
0
)
if
((
res
=
av_image_fill_arrays
(
frame
->
data
,
frame
->
linesize
,
buf
,
avctx
->
pix_fmt
,
avctx
->
width
,
avctx
->
height
,
1
))
<
0
)
return
res
;
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
{
...
...
@@ -224,22 +226,22 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
frame
->
linesize
[
0
]
=
(
frame
->
linesize
[
0
]
+
3
)
&
~
3
;
if
(
context
->
flip
)
flip
(
avctx
,
pictur
e
);
flip
(
avctx
,
fram
e
);
if
(
avctx
->
codec_tag
==
MKTAG
(
'Y'
,
'V'
,
'1'
,
'2'
)
||
avctx
->
codec_tag
==
MKTAG
(
'Y'
,
'V'
,
'1'
,
'6'
)
||
avctx
->
codec_tag
==
MKTAG
(
'Y'
,
'V'
,
'2'
,
'4'
)
||
avctx
->
codec_tag
==
MKTAG
(
'Y'
,
'V'
,
'U'
,
'9'
))
FFSWAP
(
uint8_t
*
,
picture
->
data
[
1
],
pictur
e
->
data
[
2
]);
FFSWAP
(
uint8_t
*
,
frame
->
data
[
1
],
fram
e
->
data
[
2
]);
if
(
avctx
->
codec_tag
==
AV_RL32
(
"yuv2"
)
&&
avctx
->
pix_fmt
==
AV_PIX_FMT_YUYV422
)
{
int
x
,
y
;
uint8_t
*
line
=
pictur
e
->
data
[
0
];
uint8_t
*
line
=
fram
e
->
data
[
0
];
for
(
y
=
0
;
y
<
avctx
->
height
;
y
++
)
{
for
(
x
=
0
;
x
<
avctx
->
width
;
x
++
)
line
[
2
*
x
+
1
]
^=
0x80
;
line
+=
pictur
e
->
linesize
[
0
];
line
+=
fram
e
->
linesize
[
0
];
}
}
...
...
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