mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 11:40:22 +00:00
Libavcodec: added VP9
This commit is contained in:
@@ -77,6 +77,7 @@ typedef enum {
|
||||
H265, ///< H.264 frame
|
||||
MJPG, ///< JPEG image, without restart intervals.
|
||||
VP8, ///< VP8 frame
|
||||
VP9, ///< VP9 frame
|
||||
BGR, ///< 8-bit BGR
|
||||
J2K, ///< JPEG 2000
|
||||
VIDEO_CODEC_COUNT ///< count of known video codecs (including VIDEO_CODEC_NONE)
|
||||
|
||||
@@ -154,6 +154,8 @@ static const struct codec_info_t codec_info[] = {
|
||||
to_fourcc('M','J','P','G'), 0, 1.0, 8, 0, FALSE, TRUE, FALSE, "jpg"},
|
||||
[VP8] = {"VP8", "Google VP8",
|
||||
to_fourcc('V','P','8','0'), 0, 1.0, 8, 0, FALSE, TRUE, TRUE, "vp8"},
|
||||
[VP9] = {"VP9", "Google VP9",
|
||||
to_fourcc('V','P','9','0'), 0, 1.0, 8, 0, FALSE, TRUE, TRUE, "vp9"},
|
||||
[BGR] = {"BGR", "Blue Green Red 24bit",
|
||||
to_fourcc('B','G','R','2'), 1, 3.0, 8, 0, TRUE, FALSE, FALSE, "bgr"},
|
||||
[J2K] = {"J2K", "JPEG 2000",
|
||||
|
||||
@@ -95,7 +95,7 @@ typedef struct {
|
||||
|
||||
static void setparam_default(AVCodecContext *, struct setparam_param *);
|
||||
static void setparam_h264_h265(AVCodecContext *, struct setparam_param *);
|
||||
static void setparam_vp8(AVCodecContext *, struct setparam_param *);
|
||||
static void setparam_vp8_vp9(AVCodecContext *, struct setparam_param *);
|
||||
static void libavcodec_check_messages(struct state_video_compress_libav *s);
|
||||
static void libavcodec_compress_done(struct module *mod);
|
||||
|
||||
@@ -139,7 +139,14 @@ static unordered_map<codec_t, codec_params_t, hash<int>> codec_params = {
|
||||
nullptr,
|
||||
0.4,
|
||||
list<pair<regex, string>>(),
|
||||
setparam_vp8
|
||||
setparam_vp8_vp9
|
||||
}},
|
||||
{ VP9, codec_params_t{
|
||||
AV_CODEC_ID_VP9,
|
||||
nullptr,
|
||||
0.4,
|
||||
list<pair<regex, string>>(),
|
||||
setparam_vp8_vp9,
|
||||
}},
|
||||
};
|
||||
|
||||
@@ -1242,16 +1249,17 @@ static void setparam_h264_h265(AVCodecContext *codec_ctx, struct setparam_param
|
||||
}
|
||||
}
|
||||
|
||||
static void setparam_vp8(AVCodecContext *codec_ctx, struct setparam_param *param)
|
||||
static void setparam_vp8_vp9(AVCodecContext *codec_ctx, struct setparam_param *param)
|
||||
{
|
||||
codec_ctx->thread_count = param->cpu_count;
|
||||
codec_ctx->profile = 0;
|
||||
codec_ctx->slices = 4;
|
||||
codec_ctx->rc_buffer_size = codec_ctx->bit_rate / param->fps;
|
||||
//codec_ctx->rc_buffer_aggressivity = 0.5;
|
||||
if (av_opt_set(codec_ctx->priv_data, "deadline", "realtime", 0) != 0) {
|
||||
log_msg(LOG_LEVEL_WARNING, "[lavc] Unable to set deadline.\n");
|
||||
}
|
||||
|
||||
if (av_opt_set(codec_ctx->priv_data, "cpu-used", "8", 0)) {
|
||||
log_msg(LOG_LEVEL_WARNING, "[lavc] Unable to set quality/speed ratio modifier.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +193,9 @@ static bool configure_with(struct state_libavcodec_decompress *s,
|
||||
case VP8:
|
||||
codec_id = AV_CODEC_ID_VP8;
|
||||
break;
|
||||
case VP9:
|
||||
codec_id = AV_CODEC_ID_VP9;
|
||||
break;
|
||||
default:
|
||||
log_msg(LOG_LEVEL_ERROR, "[lavd] Unsupported codec!!!\n");
|
||||
return false;
|
||||
@@ -745,6 +748,7 @@ static const struct decode_from_to libavcodec_decoders[] = {
|
||||
{ MJPG, UYVY, 500 },
|
||||
{ J2K, RGB, 500 },
|
||||
{ VP8, UYVY, 500 },
|
||||
{ VP9, UYVY, 500 },
|
||||
{ VIDEO_CODEC_NONE, VIDEO_CODEC_NONE, 0 },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user