Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
97168b20
Commit
97168b20
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eatgv: use the AVFrame API properly.
parent
b18c7c8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
eatgv.c
libavcodec/eatgv.c
+13
-8
No files found.
libavcodec/eatgv.c
View file @
97168b20
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
typedef
struct
TgvContext
{
typedef
struct
TgvContext
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
last_frame
;
AVFrame
*
last_frame
;
uint8_t
*
frame_buffer
;
uint8_t
*
frame_buffer
;
int
width
,
height
;
int
width
,
height
;
uint32_t
palette
[
AVPALETTE_COUNT
];
uint32_t
palette
[
AVPALETTE_COUNT
];
...
@@ -57,6 +57,11 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx)
...
@@ -57,6 +57,11 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx)
s
->
avctx
=
avctx
;
s
->
avctx
=
avctx
;
avctx
->
time_base
=
(
AVRational
){
1
,
15
};
avctx
->
time_base
=
(
AVRational
){
1
,
15
};
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
s
->
last_frame
=
av_frame_alloc
();
if
(
!
s
->
last_frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
return
0
;
}
}
...
@@ -223,8 +228,8 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame,
...
@@ -223,8 +228,8 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame,
my
<
0
||
my
+
4
>
s
->
avctx
->
height
)
my
<
0
||
my
+
4
>
s
->
avctx
->
height
)
continue
;
continue
;
src
=
s
->
last_frame
.
data
[
0
]
+
mx
+
my
*
s
->
last_frame
.
linesize
[
0
];
src
=
s
->
last_frame
->
data
[
0
]
+
mx
+
my
*
s
->
last_frame
->
linesize
[
0
];
src_stride
=
s
->
last_frame
.
linesize
[
0
];
src_stride
=
s
->
last_frame
->
linesize
[
0
];
}
else
{
}
else
{
int
offset
=
vector
-
num_mvs
;
int
offset
=
vector
-
num_mvs
;
if
(
offset
<
num_blocks_raw
)
if
(
offset
<
num_blocks_raw
)
...
@@ -270,7 +275,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
...
@@ -270,7 +275,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
s
->
height
=
AV_RL16
(
&
buf
[
2
]);
s
->
height
=
AV_RL16
(
&
buf
[
2
]);
if
(
s
->
avctx
->
width
!=
s
->
width
||
s
->
avctx
->
height
!=
s
->
height
)
{
if
(
s
->
avctx
->
width
!=
s
->
width
||
s
->
avctx
->
height
!=
s
->
height
)
{
av_freep
(
&
s
->
frame_buffer
);
av_freep
(
&
s
->
frame_buffer
);
av_frame_unref
(
&
s
->
last_frame
);
av_frame_unref
(
s
->
last_frame
);
if
((
ret
=
ff_set_dimensions
(
s
->
avctx
,
s
->
width
,
s
->
height
))
<
0
)
if
((
ret
=
ff_set_dimensions
(
s
->
avctx
,
s
->
width
,
s
->
height
))
<
0
)
return
ret
;
return
ret
;
}
}
...
@@ -306,7 +311,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
...
@@ -306,7 +311,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
s
->
frame_buffer
+
y
*
s
->
width
,
s
->
frame_buffer
+
y
*
s
->
width
,
s
->
width
);
s
->
width
);
}
else
{
}
else
{
if
(
!
s
->
last_frame
.
data
[
0
])
{
if
(
!
s
->
last_frame
->
data
[
0
])
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"inter frame without corresponding intra frame
\n
"
);
av_log
(
avctx
,
AV_LOG_WARNING
,
"inter frame without corresponding intra frame
\n
"
);
return
buf_size
;
return
buf_size
;
}
}
...
@@ -318,8 +323,8 @@ static int tgv_decode_frame(AVCodecContext *avctx,
...
@@ -318,8 +323,8 @@ static int tgv_decode_frame(AVCodecContext *avctx,
}
}
}
}
av_frame_unref
(
&
s
->
last_frame
);
av_frame_unref
(
s
->
last_frame
);
if
((
ret
=
av_frame_ref
(
&
s
->
last_frame
,
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
s
->
last_frame
,
frame
))
<
0
)
return
ret
;
return
ret
;
*
got_frame
=
1
;
*
got_frame
=
1
;
...
@@ -330,7 +335,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
...
@@ -330,7 +335,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
static
av_cold
int
tgv_decode_end
(
AVCodecContext
*
avctx
)
static
av_cold
int
tgv_decode_end
(
AVCodecContext
*
avctx
)
{
{
TgvContext
*
s
=
avctx
->
priv_data
;
TgvContext
*
s
=
avctx
->
priv_data
;
av_frame_
unref
(
&
s
->
last_frame
);
av_frame_
free
(
&
s
->
last_frame
);
av_freep
(
&
s
->
frame_buffer
);
av_freep
(
&
s
->
frame_buffer
);
av_free
(
s
->
mv_codebook
);
av_free
(
s
->
mv_codebook
);
av_free
(
s
->
block_codebook
);
av_free
(
s
->
block_codebook
);
...
...
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