You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
ffmpeg_videotoolbox: skip memory copy if hwaccel_output_format match
Simple test results: Command: ./ffmpeg -y -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld \ -i test.mp4 -an -c:v h264_videotoolbox -benchmark out.mp4 Before: frame= 1221 fps= 66 q=-0.0 Lsize= 3144kB time=00:00:20.33 bitrate=1266.6kbits/s dup=4 drop=0 speed= 1.1x bench: utime=2.714s stime=1.218s rtime=18.574s After: frame= 1221 fps=137 q=-0.0 Lsize= 3144kB time=00:00:20.33 bitrate=1266.4kbits/s dup=4 drop=0 speed=2.28x bench: utime=1.450s stime=1.440s rtime=8.924s It has limited usecase since there is no video filter support, so a log message is added to notify the user. Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
typedef struct VTContext {
|
typedef struct VTContext {
|
||||||
AVFrame *tmp_frame;
|
AVFrame *tmp_frame;
|
||||||
|
int log_once;
|
||||||
} VTContext;
|
} VTContext;
|
||||||
|
|
||||||
char *videotoolbox_pixfmt;
|
char *videotoolbox_pixfmt;
|
||||||
@@ -44,6 +45,13 @@ static int videotoolbox_retrieve_data(AVCodecContext *s, AVFrame *frame)
|
|||||||
int linesize[4] = { 0 };
|
int linesize[4] = { 0 };
|
||||||
int planes, ret, i;
|
int planes, ret, i;
|
||||||
|
|
||||||
|
if (frame->format == ist->hwaccel_output_format) {
|
||||||
|
av_log_once(s, AV_LOG_INFO, AV_LOG_TRACE, &vt->log_once,
|
||||||
|
"There is no video filter for videotoolbox pix_fmt now, remove the "
|
||||||
|
"-hwaccel_output_format option if video filter doesn't work\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
av_frame_unref(vt->tmp_frame);
|
av_frame_unref(vt->tmp_frame);
|
||||||
|
|
||||||
switch (pixel_format) {
|
switch (pixel_format) {
|
||||||
|
Reference in New Issue
Block a user