Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
0b0fa5c2
Commit
0b0fa5c2
authored
Apr 13, 2023
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fftools/ffmpeg_enc: make data_size_enc private to encoding code
It is no longer used outside of ffmpeg_enc.c
parent
30699c10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
ffmpeg.h
fftools/ffmpeg.h
+0
-2
ffmpeg_enc.c
fftools/ffmpeg_enc.c
+10
-4
No files found.
fftools/ffmpeg.h
View file @
0b0fa5c2
...
@@ -662,8 +662,6 @@ typedef struct OutputStream {
...
@@ -662,8 +662,6 @@ typedef struct OutputStream {
int
keep_pix_fmt
;
int
keep_pix_fmt
;
/* stats */
/* stats */
// combined size of all the packets received from the encoder
uint64_t
data_size_enc
;
// number of packets send to the muxer
// number of packets send to the muxer
atomic_uint_least64_t
packets_written
;
atomic_uint_least64_t
packets_written
;
// number of frames/samples sent to the encoder
// number of frames/samples sent to the encoder
...
...
fftools/ffmpeg_enc.c
View file @
0b0fa5c2
...
@@ -56,6 +56,9 @@ struct Encoder {
...
@@ -56,6 +56,9 @@ struct Encoder {
int64_t
frames_prev_hist
[
3
];
int64_t
frames_prev_hist
[
3
];
AVFrame
*
sq_frame
;
AVFrame
*
sq_frame
;
// combined size of all the packets received from the encoder
uint64_t
data_size
;
};
};
static
uint64_t
dup_warning
=
1000
;
static
uint64_t
dup_warning
=
1000
;
...
@@ -513,6 +516,7 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
...
@@ -513,6 +516,7 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
const
AVFrame
*
frame
,
const
AVPacket
*
pkt
,
const
AVFrame
*
frame
,
const
AVPacket
*
pkt
,
uint64_t
frame_num
)
uint64_t
frame_num
)
{
{
Encoder
*
e
=
ost
->
enc
;
AVIOContext
*
io
=
es
->
io
;
AVIOContext
*
io
=
es
->
io
;
AVRational
tb
=
frame
?
frame
->
time_base
:
pkt
->
time_base
;
AVRational
tb
=
frame
?
frame
->
time_base
:
pkt
->
time_base
;
int64_t
pts
=
frame
?
frame
->
pts
:
pkt
->
pts
;
int64_t
pts
=
frame
?
frame
->
pts
:
pkt
->
pts
;
...
@@ -564,7 +568,7 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
...
@@ -564,7 +568,7 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
}
}
case
ENC_STATS_AVG_BITRATE
:
{
case
ENC_STATS_AVG_BITRATE
:
{
double
duration
=
pkt
->
dts
*
av_q2d
(
tb
);
double
duration
=
pkt
->
dts
*
av_q2d
(
tb
);
avio_printf
(
io
,
"%g"
,
duration
>
0
?
8
.
0
*
ost
->
data_size_enc
/
duration
:
-
1
.);
avio_printf
(
io
,
"%g"
,
duration
>
0
?
8
.
0
*
e
->
data_size
/
duration
:
-
1
.);
continue
;
continue
;
}
}
default:
av_assert0
(
0
);
default:
av_assert0
(
0
);
...
@@ -577,6 +581,7 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
...
@@ -577,6 +581,7 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
static
void
update_video_stats
(
OutputStream
*
ost
,
const
AVPacket
*
pkt
,
int
write_vstats
)
static
void
update_video_stats
(
OutputStream
*
ost
,
const
AVPacket
*
pkt
,
int
write_vstats
)
{
{
Encoder
*
e
=
ost
->
enc
;
const
uint8_t
*
sd
=
av_packet_get_side_data
(
pkt
,
AV_PKT_DATA_QUALITY_STATS
,
const
uint8_t
*
sd
=
av_packet_get_side_data
(
pkt
,
AV_PKT_DATA_QUALITY_STATS
,
NULL
);
NULL
);
AVCodecContext
*
enc
=
ost
->
enc_ctx
;
AVCodecContext
*
enc
=
ost
->
enc_ctx
;
...
@@ -624,14 +629,15 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write
...
@@ -624,14 +629,15 @@ static void update_video_stats(OutputStream *ost, const AVPacket *pkt, int write
ti1
=
0
.
01
;
ti1
=
0
.
01
;
bitrate
=
(
pkt
->
size
*
8
)
/
av_q2d
(
enc
->
time_base
)
/
1000
.
0
;
bitrate
=
(
pkt
->
size
*
8
)
/
av_q2d
(
enc
->
time_base
)
/
1000
.
0
;
avg_bitrate
=
(
double
)(
ost
->
data_size_enc
*
8
)
/
ti1
/
1000
.
0
;
avg_bitrate
=
(
double
)(
e
->
data_size
*
8
)
/
ti1
/
1000
.
0
;
fprintf
(
vstats_file
,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s "
,
fprintf
(
vstats_file
,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s "
,
(
double
)
ost
->
data_size_enc
/
1024
,
ti1
,
bitrate
,
avg_bitrate
);
(
double
)
e
->
data_size
/
1024
,
ti1
,
bitrate
,
avg_bitrate
);
fprintf
(
vstats_file
,
"type= %c
\n
"
,
av_get_picture_type_char
(
ost
->
pict_type
));
fprintf
(
vstats_file
,
"type= %c
\n
"
,
av_get_picture_type_char
(
ost
->
pict_type
));
}
}
static
int
encode_frame
(
OutputFile
*
of
,
OutputStream
*
ost
,
AVFrame
*
frame
)
static
int
encode_frame
(
OutputFile
*
of
,
OutputStream
*
ost
,
AVFrame
*
frame
)
{
{
Encoder
*
e
=
ost
->
enc
;
AVCodecContext
*
enc
=
ost
->
enc_ctx
;
AVCodecContext
*
enc
=
ost
->
enc_ctx
;
AVPacket
*
pkt
=
ost
->
pkt
;
AVPacket
*
pkt
=
ost
->
pkt
;
const
char
*
type_desc
=
av_get_media_type_string
(
enc
->
codec_type
);
const
char
*
type_desc
=
av_get_media_type_string
(
enc
->
codec_type
);
...
@@ -725,7 +731,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
...
@@ -725,7 +731,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
exit_program
(
1
);
exit_program
(
1
);
}
}
ost
->
data_size_enc
+=
pkt
->
size
;
e
->
data_size
+=
pkt
->
size
;
ost
->
packets_encoded
++
;
ost
->
packets_encoded
++
;
...
...
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