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
ec8502f9
Commit
ec8502f9
authored
Dec 13, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/gif: use avctx->frame_number
parent
0aa5a7b2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
16 deletions
+9
-16
gif.c
libavcodec/gif.c
+3
-10
gifenc-bgr4_byte
tests/ref/fate/gifenc-bgr4_byte
+1
-1
gifenc-bgr8
tests/ref/fate/gifenc-bgr8
+1
-1
gifenc-gray
tests/ref/fate/gifenc-gray
+1
-1
gifenc-pal8
tests/ref/fate/gifenc-pal8
+1
-1
gifenc-rgb4_byte
tests/ref/fate/gifenc-rgb4_byte
+1
-1
gifenc-rgb8
tests/ref/fate/gifenc-rgb8
+1
-1
No files found.
libavcodec/gif.c
View file @
ec8502f9
...
...
@@ -48,7 +48,6 @@ typedef struct GIFContext {
LZWState
*
lzw
;
uint8_t
*
buf
;
int
buf_size
;
int
is_first_frame
;
AVFrame
*
last_frame
;
int
flags
;
int
image
;
...
...
@@ -268,7 +267,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
int
bcid
=
-
1
,
honor_transparency
=
(
s
->
flags
&
GF_TRANSDIFF
)
&&
s
->
last_frame
&&
!
palette
;
const
uint8_t
*
ptr
;
if
(
!
s
->
i
s_first_frame
&&
is_image_translucent
(
avctx
,
buf
,
linesize
))
{
if
(
!
s
->
i
mage
&&
avctx
->
frame_number
&&
is_image_translucent
(
avctx
,
buf
,
linesize
))
{
gif_crop_translucent
(
avctx
,
buf
,
linesize
,
&
width
,
&
height
,
&
x_start
,
&
y_start
);
honor_transparency
=
0
;
disposal
=
GCE_DISPOSAL_BACKGROUND
;
...
...
@@ -277,7 +276,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
disposal
=
GCE_DISPOSAL_INPLACE
;
}
if
(
s
->
i
s_first_frame
)
{
/* GIF header */
if
(
s
->
i
mage
||
!
avctx
->
frame_number
)
{
/* GIF header */
const
uint32_t
*
global_palette
=
palette
?
palette
:
s
->
palette
;
const
AVRational
sar
=
avctx
->
sample_aspect_ratio
;
int64_t
aspect
=
0
;
...
...
@@ -301,8 +300,6 @@ static int gif_image_write_image(AVCodecContext *avctx,
const
uint32_t
v
=
global_palette
[
i
]
&
0xffffff
;
bytestream_put_be24
(
bytestream
,
v
);
}
s
->
is_first_frame
=
0
;
}
if
(
honor_transparency
&&
trans
<
0
)
{
...
...
@@ -395,7 +392,6 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
}
s
->
transparent_index
=
-
1
;
s
->
is_first_frame
=
1
;
s
->
lzw
=
av_mallocz
(
ff_lzw_encode_state_size
);
s
->
buf_size
=
avctx
->
width
*
avctx
->
height
*
2
+
1000
;
...
...
@@ -423,9 +419,6 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
outbuf_ptr
=
pkt
->
data
;
end
=
pkt
->
data
+
pkt
->
size
;
if
(
s
->
image
)
s
->
is_first_frame
=
1
;
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
{
palette
=
(
uint32_t
*
)
pict
->
data
[
1
];
...
...
@@ -454,7 +447,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
pkt
->
size
=
outbuf_ptr
-
pkt
->
data
;
if
(
s
->
i
s_first_frame
)
if
(
s
->
i
mage
||
!
avctx
->
frame_number
)
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
...
...
tests/ref/fate/gifenc-bgr4_byte
View file @
ec8502f9
...
...
@@ -3,7 +3,7 @@
#codec_id 0: gif
#dimensions 0: 217x217
#sar 0: 0/1
0, 0, 0, 1, 1297, 0x53e8b1c1
, F=0x0
0, 0, 0, 1, 1297, 0x53e8b1c1
0, 1, 1, 1, 221, 0x52d24d05, F=0x0
0, 2, 2, 1, 139, 0xc9e32ab4, F=0x0
0, 3, 3, 1, 392, 0x9244a858, F=0x0
...
...
tests/ref/fate/gifenc-bgr8
View file @
ec8502f9
...
...
@@ -3,7 +3,7 @@
#codec_id 0: gif
#dimensions 0: 217x217
#sar 0: 0/1
0, 0, 0, 1, 1341, 0xe4e2af18
, F=0x0
0, 0, 0, 1, 1341, 0xe4e2af18
0, 1, 1, 1, 305, 0xefa98bbd, F=0x0
0, 2, 2, 1, 446, 0x9499cf43, F=0x0
0, 3, 3, 1, 458, 0x8cb7d0d5, F=0x0
...
...
tests/ref/fate/gifenc-gray
View file @
ec8502f9
...
...
@@ -3,7 +3,7 @@
#codec_id 0: gif
#dimensions 0: 217x217
#sar 0: 0/1
0, 0, 0, 1, 1368, 0x6cf0befd
, F=0x0
0, 0, 0, 1, 1368, 0x6cf0befd
0, 1, 1, 1, 158, 0xcd173bb4, F=0x0
0, 2, 2, 1, 163, 0x4f7a451d, F=0x0
0, 3, 3, 1, 152, 0x17723839, F=0x0
...
...
tests/ref/fate/gifenc-pal8
View file @
ec8502f9
...
...
@@ -3,7 +3,7 @@
#codec_id 0: gif
#dimensions 0: 217x217
#sar 0: 0/1
0, 0, 0, 1, 2109, 0x39642b3d
, F=0x0
0, 0, 0, 1, 2109, 0x39642b3d
0, 1, 1, 1, 305, 0xefa98bbd, F=0x0
0, 2, 2, 1, 446, 0x9499cf43, F=0x0
0, 3, 3, 1, 458, 0x8cb7d0d5, F=0x0
...
...
tests/ref/fate/gifenc-rgb4_byte
View file @
ec8502f9
...
...
@@ -3,7 +3,7 @@
#codec_id 0: gif
#dimensions 0: 217x217
#sar 0: 0/1
0, 0, 0, 1, 1297, 0x5618fe71
, F=0x0
0, 0, 0, 1, 1297, 0x5618fe71
0, 1, 1, 1, 221, 0x230c4e66, F=0x0
0, 2, 2, 1, 139, 0xf87a2b65, F=0x0
0, 3, 3, 1, 392, 0x7794a5e6, F=0x0
...
...
tests/ref/fate/gifenc-rgb8
View file @
ec8502f9
...
...
@@ -3,7 +3,7 @@
#codec_id 0: gif
#dimensions 0: 217x217
#sar 0: 0/1
0, 0, 0, 1, 1341, 0xaa85adb1
, F=0x0
0, 0, 0, 1, 1341, 0xaa85adb1
0, 1, 1, 1, 305, 0xa970896f, F=0x0
0, 2, 2, 1, 446, 0x4a20d47a, F=0x0
0, 3, 3, 1, 458, 0x32ded2af, F=0x0
...
...
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