Project

General

Profile

Feature #3080 » qsv-fix.patch

B C, 2015-11-04 12:57

View differences:

src/plumbing/transcoding.c
1035 1035
{
1036 1036
  AVFilterInOut *flt_inputs, *flt_outputs;
1037 1037
  AVFilter *flt_bufsrc, *flt_bufsink;
1038
  enum AVPixelFormat pix_fmts[] = { 0, AV_PIX_FMT_NONE };
1038 1039
  char opt[128];
1039 1040
  int err;
1040 1041

  
......
1088 1089
    goto out_err;
1089 1090
  }
1090 1091

  
1092
  pix_fmts[0] = octx->pix_fmt;
1093
  err = av_opt_set_int_list(vs->flt_bufsinkctx, "pix_fmts", pix_fmts,
1094
                            AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
1095
  if (err < 0) {
1096
    tvherror("transcode", "%08X: fltchain cannot set output pixfmt",
1097
             shortid(t));
1098
    goto out_err;
1099
  }
1100

  
1091 1101
  flt_outputs->name = av_strdup("in");
1092 1102
  flt_outputs->filter_ctx = vs->flt_bufsrcctx;
1093 1103
  flt_outputs->pad_idx = 0;
......
1240 1250

  
1241 1251
    switch (ts->ts_type) {
1242 1252
    case SCT_MPEG2VIDEO:
1243
      octx->pix_fmt        = AV_PIX_FMT_YUV420P;
1253
       if (!strcmp(ocodec->name, "nvenc") || !strcmp(ocodec->name, "mpeg2_qsv"))
1254
          octx->pix_fmt    = AV_PIX_FMT_NV12;
1255
      else
1256
          octx->pix_fmt    = AV_PIX_FMT_YUV420P;      octx->flags         |= CODEC_FLAG_GLOBAL_HEADER;
1257

  
1244 1258
      octx->flags         |= CODEC_FLAG_GLOBAL_HEADER;
1245 1259

  
1246 1260
      if (t->t_props.tp_vbitrate < 64) {
......
1287 1301
      break;
1288 1302

  
1289 1303
    case SCT_H264:
1290
      octx->pix_fmt        = AV_PIX_FMT_YUV420P;
1304
       if (!strcmp(ocodec->name, "nvenc") || !strcmp(ocodec->name, "h264_qsv"))
1305
          octx->pix_fmt    = AV_PIX_FMT_NV12;
1306
      else
1307
          octx->pix_fmt    = AV_PIX_FMT_YUV420P;
1308

  
1291 1309
      octx->flags         |= CODEC_FLAG_GLOBAL_HEADER;
1292 1310

  
1293 1311
      // Default = "medium". We gain more encoding speed compared to the loss of quality when lowering it _slightly_.
1294
      av_dict_set(&opts, "preset",  "faster", 0);
1312
      if (!strcmp(ocodec->name, "nvenc"))
1313
         av_dict_set(&opts, "preset",  "hq", 0);
1314
      else if (!strcmp(ocodec->name, "h264_qsv"))
1315
         av_dict_set(&opts, "preset",  "medium", 0);
1316
      else
1317
         av_dict_set(&opts, "preset",  "faster", 0);
1295 1318

  
1296 1319
      // All modern devices should support "high" profile
1297 1320
      av_dict_set(&opts, "profile", "high", 0);
(1-1/4)