#include "bytestream.h"
#include "get_bits.h"
#include "hevc.h"
+#include "hevcdec.h"
+#include "h2645_parse.h"
#include "internal.h"
#include "qsv.h"
#include "qsv_internal.h"
PutByteContext pbc;
GetBitContext gb;
- HEVCNAL sps_nal = { NULL };
+ H2645NAL sps_nal = { NULL };
HEVCSPS sps = { 0 };
HEVCVPS vps = { 0 };
uint8_t vps_buf[128], vps_rbsp_buf[128];
}
/* parse the SPS */
- ret = ff_hevc_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal);
+ ret = ff_h2645_extract_rbsp(avctx->extradata + 4, avctx->extradata_size - 4, &sps_nal);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error unescaping the SPS buffer\n");
return ret;
get_bits(&gb, 1);
type = get_bits(&gb, 6);
- if (type != NAL_SPS) {
+ if (type != HEVC_NAL_SPS) {
av_log(avctx, AV_LOG_ERROR, "Unexpected NAL type in the extradata: %d\n",
type);
av_freep(&sps_nal.rbsp_buffer);
vps.vps_max_sub_layers = sps.max_sub_layers;
memcpy(&vps.ptl, &sps.ptl, sizeof(vps.ptl));
vps.vps_sub_layer_ordering_info_present_flag = 1;
- for (i = 0; i < MAX_SUB_LAYERS; i++) {
+ for (i = 0; i < HEVC_MAX_SUB_LAYERS; i++) {
vps.vps_max_dec_pic_buffering[i] = sps.temporal_layer[i].max_dec_pic_buffering;
vps.vps_num_reorder_pics[i] = sps.temporal_layer[i].num_reorder_pics;
vps.vps_max_latency_increase[i] = sps.temporal_layer[i].max_latency_increase;
bytestream2_init(&gbc, vps_rbsp_buf, ret);
bytestream2_init_writer(&pbc, vps_buf, sizeof(vps_buf));
- bytestream2_put_be32(&pbc, 1); // startcode
- bytestream2_put_byte(&pbc, NAL_VPS << 1); // NAL
- bytestream2_put_byte(&pbc, 1); // header
+ bytestream2_put_be32(&pbc, 1); // startcode
+ bytestream2_put_byte(&pbc, HEVC_NAL_VPS << 1); // NAL
+ bytestream2_put_byte(&pbc, 1); // header
while (bytestream2_get_bytes_left(&gbc)) {
uint32_t b = bytestream2_peek_be24(&gbc);
int ret;
if (q->load_plugin != LOAD_PLUGIN_NONE) {
- static const char *uid_hevcenc_sw = "2fca99749fdb49aeb121a5b63ef568f7";
- static const char *uid_hevcenc_hw = "6fadc791a0c2eb479ab6dcd5ea9da347";
+ static const char * const uid_hevcenc_sw = "2fca99749fdb49aeb121a5b63ef568f7";
+ static const char * const uid_hevcenc_hw = "6fadc791a0c2eb479ab6dcd5ea9da347";
if (q->qsv.load_plugins[0]) {
av_log(avctx, AV_LOG_WARNING,
return ff_qsv_enc_close(avctx, &q->qsv);
}
+#if defined(_WIN32)
+#define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_SW
+#else
+#define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_HW
+#endif
+
#define OFFSET(x) offsetof(QSVHEVCEncContext, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
QSV_COMMON_OPTS
- { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
+ { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_DEFAULT }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE }, 0, 0, VE, "load_plugin" },
{ "hevc_sw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VE, "load_plugin" },
{ "hevc_hw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_HW }, 0, 0, VE, "load_plugin" },
{ "b", "1M" },
{ "refs", "0" },
// same as the x264 default
- { "g", "250" },
- { "bf", "3" },
+ { "g", "248" },
+ { "bf", "8" },
{ "flags", "+cgop" },
+#if FF_API_PRIVATE_OPT
+ { "b_strategy", "-1" },
+#endif
{ NULL },
};
.close = qsv_enc_close,
.capabilities = AV_CODEC_CAP_DELAY,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+ AV_PIX_FMT_P010,
AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE },
.priv_class = &class,