/
rgy_prm.h
1220 lines (1060 loc) · 38.9 KB
/
rgy_prm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// -----------------------------------------------------------------------------------------
// QSVEnc/NVEnc by rigaya
// -----------------------------------------------------------------------------------------
// The MIT License
//
// Copyright (c) 2011-2016 rigaya
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// --------------------------------------------------------------------------------------------
#pragma once
#ifndef __RGY_PRM_H__
#define __RGY_PRM_H__
#include "rgy_def.h"
#include "rgy_caption.h"
#include "rgy_simd.h"
#include "rgy_hdr10plus.h"
static const int BITSTREAM_BUFFER_SIZE = 4 * 1024 * 1024;
static const int OUTPUT_BUF_SIZE = 16 * 1024 * 1024;
static const int RGY_DEFAULT_PERF_MONITOR_INTERVAL = 500;
static const int DEFAULT_IGNORE_DECODE_ERROR = 10;
#if ENCODER_NVENC
#define ENABLE_VPP_FILTER_COLORSPACE (ENABLE_NVRTC)
#else
#define ENABLE_VPP_FILTER_COLORSPACE (ENCODER_QSV || ENCODER_VCEENC)
#endif
#define ENABLE_VPP_FILTER_AFS (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_NNEDI (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_YADIF (ENCODER_NVENC)
#define ENABLE_VPP_FILTER_RFF (ENCODER_NVENC)
#define ENABLE_VPP_FILTER_SELECT_EVERY (ENCODER_NVENC)
#define ENABLE_VPP_FILTER_DECIMATE (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_MPDECIMATE (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_PAD (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_PMD (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_SMOOTH (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_UNSHARP (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_WARPSHARP (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_EDGELEVEL (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_TWEAK (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
#define ENABLE_VPP_FILTER_DEBAND (ENCODER_QSV || ENCODER_NVENC || ENCODER_VCEENC)
static const TCHAR* VMAF_DEFAULT_MODEL_VERSION = _T("vmaf_v0.6.1");
static const double FILTER_DEFAULT_COLORSPACE_LDRNITS = 100.0;
static const double FILTER_DEFAULT_COLORSPACE_NOMINAL_SOURCE_PEAK = 100.0;
static const double FILTER_DEFAULT_COLORSPACE_HDR_SOURCE_PEAK = 1000.0;
static const double FILTER_DEFAULT_HDR2SDR_DESAT_BASE = 0.18;
static const double FILTER_DEFAULT_HDR2SDR_DESAT_STRENGTH = 0.75;
static const double FILTER_DEFAULT_HDR2SDR_DESAT_EXP = 1.5;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_A = 0.22;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_B = 0.3;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_C = 0.1;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_D = 0.2;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_E = 0.01;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_F = 0.3;
static const double FILTER_DEFAULT_HDR2SDR_HABLE_W = 11.2;
static const double FILTER_DEFAULT_HDR2SDR_MOBIUS_TRANSITION = 0.3;
static const double FILTER_DEFAULT_HDR2SDR_MOBIUS_PEAK = 1.0;
static const double FILTER_DEFAULT_HDR2SDR_REINHARD_CONTRAST = 0.5;
static const double FILTER_DEFAULT_HDR2SDR_REINHARD_PEAK = 1.0;
static const int FILTER_DEFAULT_DELOGO_DEPTH = 128;
static const int FILTER_DEFAULT_AFS_CLIP_TB = 16;
static const int FILTER_DEFAULT_AFS_CLIP_LR = 32;
static const int FILTER_DEFAULT_AFS_TB_ORDER = 0;
static const int FILTER_DEFAULT_AFS_METHOD_SWITCH = 0;
static const int FILTER_DEFAULT_AFS_COEFF_SHIFT = 192;
static const int FILTER_DEFAULT_AFS_THRE_SHIFT = 128;
static const int FILTER_DEFAULT_AFS_THRE_DEINT = 48;
static const int FILTER_DEFAULT_AFS_THRE_YMOTION = 112;
static const int FILTER_DEFAULT_AFS_THRE_CMOTION = 224;
static const int FILTER_DEFAULT_AFS_ANALYZE = 3;
static const bool FILTER_DEFAULT_AFS_SHIFT = true;
static const bool FILTER_DEFAULT_AFS_DROP = false;
static const bool FILTER_DEFAULT_AFS_SMOOTH = false;
static const bool FILTER_DEFAULT_AFS_FORCE24 = false;
static const bool FILTER_DEFAULT_AFS_TUNE = false;
static const bool FILTER_DEFAULT_AFS_RFF = false;
static const int FILTER_DEFAULT_AFS_TIMECODE = 0;
static const bool FILTER_DEFAULT_AFS_LOG = false;
static const int FILTER_DEFAULT_DECIMATE_CYCLE = 5;
static const float FILTER_DEFAULT_DECIMATE_THRE_DUP = 1.1f;
static const float FILTER_DEFAULT_DECIMATE_THRE_SC = 15.0f;
static const int FILTER_DEFAULT_DECIMATE_BLOCK_X = 32;
static const int FILTER_DEFAULT_DECIMATE_BLOCK_Y = 32;
static const bool FILTER_DEFAULT_DECIMATE_PREPROCESSED = false;
static const bool FILTER_DEFAULT_DECIMATE_CHROMA = true;
static const bool FILTER_DEFAULT_DECIMATE_LOG = false;
static const int FILTER_DEFAULT_MPDECIMATE_HI = 768;
static const int FILTER_DEFAULT_MPDECIMATE_LO = 320;
static const bool FILTER_DEFAULT_MPDECIMATE_MAX = 0;
static const float FILTER_DEFAULT_MPDECIMATE_FRAC = 0.33f;
static const bool FILTER_DEFAULT_MPDECIMATE_LOG = false;
static const int FILTER_DEFAULT_KNN_RADIUS = 3;
static const float FILTER_DEFAULT_KNN_STRENGTH = 0.08f;
static const float FILTER_DEFAULT_KNN_LERPC = 0.20f;
static const float FILTER_DEFAULT_KNN_WEIGHT_THRESHOLD = 0.01f;
static const float FILTER_DEFAULT_KNN_LERPC_THRESHOLD = 0.80f;
static const float FILTER_DEFAULT_PMD_STRENGTH = 100.0f;
static const float FILTER_DEFAULT_PMD_THRESHOLD = 100.0f;
static const int FILTER_DEFAULT_PMD_APPLY_COUNT = 2;
static const bool FILTER_DEFAULT_PMD_USE_EXP = true;
static const int FILTER_DEFAULT_SMOOTH_QUALITY = 3;
static const int FILTER_DEFAULT_SMOOTH_QP = 12;
static const float FILTER_DEFAULT_SMOOTH_STRENGTH = 0.0f;
static const float FILTER_DEFAULT_SMOOTH_THRESHOLD = 0.0f;
static const int FILTER_DEFAULT_SMOOTH_MODE = 0;
static const float FILTER_DEFAULT_SMOOTH_B_RATIO = 0.5f;
static const int FILTER_DEFAULT_SMOOTH_MAX_QPTABLE_ERR = 10;
static const float FILTER_DEFAULT_TWEAK_BRIGHTNESS = 0.0f;
static const float FILTER_DEFAULT_TWEAK_CONTRAST = 1.0f;
static const float FILTER_DEFAULT_TWEAK_GAMMA = 1.0f;
static const float FILTER_DEFAULT_TWEAK_SATURATION = 1.0f;
static const float FILTER_DEFAULT_TWEAK_HUE = 0.0f;
static const float FILTER_DEFAULT_EDGELEVEL_STRENGTH = 5.0f;
static const float FILTER_DEFAULT_EDGELEVEL_THRESHOLD = 20.0f;
static const float FILTER_DEFAULT_EDGELEVEL_BLACK = 0.0f;
static const float FILTER_DEFAULT_EDGELEVEL_WHITE = 0.0f;
static const int FILTER_DEFAULT_UNSHARP_RADIUS = 3;
static const float FILTER_DEFAULT_UNSHARP_WEIGHT = 0.5f;
static const float FILTER_DEFAULT_UNSHARP_THRESHOLD = 10.0f;
static const float FILTER_DEFAULT_WARPSHARP_THRESHOLD = 128.0f;
static const int FILTER_DEFAULT_WARPSHARP_BLUR = 2;
static const int FILTER_DEFAULT_WARPSHARP_TYPE = 0;
static const float FILTER_DEFAULT_WARPSHARP_DEPTH = 16.0f;
static const int FILTER_DEFAULT_WARPSHARP_CHROMA = 0;
static const int FILTER_DEFAULT_DEBAND_RANGE = 15;
static const int FILTER_DEFAULT_DEBAND_THRE_Y = 15;
static const int FILTER_DEFAULT_DEBAND_THRE_CB = 15;
static const int FILTER_DEFAULT_DEBAND_THRE_CR = 15;
static const int FILTER_DEFAULT_DEBAND_DITHER_Y = 15;
static const int FILTER_DEFAULT_DEBAND_DITHER_C = 15;
static const int FILTER_DEFAULT_DEBAND_MODE = 1;
static const int FILTER_DEFAULT_DEBAND_SEED = 1234;
static const bool FILTER_DEFAULT_DEBAND_BLUR_FIRST = false;
static const bool FILTER_DEFAULT_DEBAND_RAND_EACH_FRAME = false;
const CX_DESC list_vpp_denoise[] = {
{ _T("none"), 0 },
#if ENCODER_QSV
{ _T("denoise"), 4 },
#endif
{ _T("knn"), 1 },
{ _T("pmd"), 2 },
{ _T("smooth"), 3 },
{ NULL, 0 }
};
const CX_DESC list_vpp_detail_enahance[] = {
{ _T("none"), 0 },
#if ENCODER_QSV
{ _T("detail-enhance"), 4 },
#endif
{ _T("unsharp"), 1 },
{ _T("edgelevel"), 2 },
{ _T("warpsharp"), 3 },
{ NULL, 0 }
};
enum HDR2SDRToneMap {
HDR2SDR_DISABLED,
HDR2SDR_HABLE,
HDR2SDR_MOBIUS,
HDR2SDR_REINHARD,
HDR2SDR_BT2390,
};
const CX_DESC list_vpp_hdr2sdr[] = {
{ _T("none"), HDR2SDR_DISABLED },
{ _T("hable"), HDR2SDR_HABLE },
{ _T("mobius"), HDR2SDR_MOBIUS },
{ _T("reinhard"), HDR2SDR_REINHARD },
{ _T("bt2390"), HDR2SDR_BT2390 },
{ NULL, 0 }
};
enum RGY_VPP_RESIZE_MODE {
RGY_VPP_RESIZE_MODE_DEFAULT,
#if ENCODER_QSV
RGY_VPP_RESIZE_MODE_MFX_LOWPOWER,
RGY_VPP_RESIZE_MODE_MFX_QUALITY,
#endif
RGY_VPP_RESIZE_MODE_UNKNOWN,
};
enum RGY_VPP_RESIZE_ALGO {
RGY_VPP_RESIZE_AUTO,
RGY_VPP_RESIZE_BILINEAR,
#if ENCODER_NVENC
RGY_VPP_RESIZE_NEAREST,
#endif
RGY_VPP_RESIZE_SPLINE16,
RGY_VPP_RESIZE_SPLINE36,
RGY_VPP_RESIZE_SPLINE64,
RGY_VPP_RESIZE_LANCZOS2,
RGY_VPP_RESIZE_LANCZOS3,
RGY_VPP_RESIZE_LANCZOS4,
RGY_VPP_RESIZE_OPENCL_CUDA_MAX,
#if ENCODER_QSV
RGY_VPP_RESIZE_MFX_NEAREST_NEIGHBOR,
RGY_VPP_RESIZE_MFX_BILINEAR,
RGY_VPP_RESIZE_MFX_ADVANCED,
RGY_VPP_RESIZE_MFX_MAX,
#endif
#if ENCODER_NVENC && (!defined(_M_IX86) || FOR_AUO)
RGY_VPP_RESIZE_NPPI_INTER_NN, /**< Nearest neighbor filtering. */
RGY_VPP_RESIZE_NPPI_INTER_LINEAR, /**< Linear interpolation. */
RGY_VPP_RESIZE_NPPI_INTER_CUBIC, /**< Cubic interpolation. */
RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_BSPLINE, /**< Two-parameter cubic filter (B=1, C=0) */
RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_CATMULLROM, /**< Two-parameter cubic filter (B=0, C=1/2) */
RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_B05C03, /**< Two-parameter cubic filter (B=1/2, C=3/10) */
RGY_VPP_RESIZE_NPPI_INTER_SUPER, /**< Super sampling. */
RGY_VPP_RESIZE_NPPI_INTER_LANCZOS, /**< Lanczos filtering. */
RGY_VPP_RESIZE_NPPI_INTER_LANCZOS3_ADVANCED, /**< Generic Lanczos filtering with order 3. */
RGY_VPP_RESIZE_NPPI_SMOOTH_EDGE, /**< Smooth edge filtering. */
RGY_VPP_RESIZE_NPPI_MAX,
#endif
RGY_VPP_RESIZE_UNKNOWN,
};
enum RGY_VPP_RESIZE_TYPE {
RGY_VPP_RESIZE_TYPE_NONE,
RGY_VPP_RESIZE_TYPE_AUTO,
RGY_VPP_RESIZE_TYPE_OPENCL,
#if ENCODER_QSV
RGY_VPP_RESIZE_TYPE_MFX,
#endif
#if ENCODER_NVENC && (!defined(_M_IX86) || FOR_AUO)
RGY_VPP_RESIZE_TYPE_NPPI,
#endif
RGY_VPP_RESIZE_TYPE_UNKNOWN,
};
RGY_VPP_RESIZE_TYPE getVppResizeType(RGY_VPP_RESIZE_ALGO resize);
const CX_DESC list_vpp_resize_mode[] = {
{ _T("auto"), RGY_VPP_RESIZE_MODE_DEFAULT },
#if ENCODER_QSV
{ _T("lowpower"), RGY_VPP_RESIZE_MODE_MFX_LOWPOWER },
{ _T("quality"), RGY_VPP_RESIZE_MODE_MFX_QUALITY },
#endif
{ NULL, 0 }
};
const CX_DESC list_vpp_resize[] = {
{ _T("auto"), RGY_VPP_RESIZE_AUTO },
{ _T("bilinear"), RGY_VPP_RESIZE_BILINEAR },
#if ENCODER_NVENC
{ _T("nearest"), RGY_VPP_RESIZE_NEAREST },
#endif
{ _T("spline16"), RGY_VPP_RESIZE_SPLINE16 },
{ _T("spline36"), RGY_VPP_RESIZE_SPLINE36 },
{ _T("spline64"), RGY_VPP_RESIZE_SPLINE64 },
{ _T("lanczos2"), RGY_VPP_RESIZE_LANCZOS2 },
{ _T("lanczos3"), RGY_VPP_RESIZE_LANCZOS3 },
{ _T("lanczos4"), RGY_VPP_RESIZE_LANCZOS4 },
#if ENCODER_QSV
#if !FOR_AUO
{ _T("bilinear"), RGY_VPP_RESIZE_MFX_BILINEAR },
#endif
{ _T("advanced"), RGY_VPP_RESIZE_MFX_ADVANCED },
{ _T("simple"), RGY_VPP_RESIZE_MFX_NEAREST_NEIGHBOR },
#if !FOR_AUO
{ _T("fine"), RGY_VPP_RESIZE_MFX_ADVANCED },
#endif
#endif
#if ENCODER_NVENC && (!defined(_M_IX86) || FOR_AUO)
{ _T("nn"), RGY_VPP_RESIZE_NPPI_INTER_NN },
{ _T("npp_linear"), RGY_VPP_RESIZE_NPPI_INTER_LINEAR },
{ _T("cubic"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC },
//下記値は無効(指定しても動作しない)
//{ _T("cubic_bspline"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_BSPLINE },
//{ _T("cubic_catmull"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_CATMULLROM },
//{ _T("cubic_b05c03"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_B05C03 },
{ _T("super"), RGY_VPP_RESIZE_NPPI_INTER_SUPER },
{ _T("lanczos"), RGY_VPP_RESIZE_NPPI_INTER_LANCZOS },
//{ _T("smooth_edge"), RGY_VPP_RESIZE_NPPI_SMOOTH_EDGE },
#endif
{ NULL, 0 }
};
const CX_DESC list_vpp_resize_help[] = {
{ _T("auto"), RGY_VPP_RESIZE_AUTO },
{ _T("bilinear"), RGY_VPP_RESIZE_BILINEAR },
#if ENCODER_NVENC
{ _T("nearest"), RGY_VPP_RESIZE_NEAREST },
#endif
{ _T("spline16"), RGY_VPP_RESIZE_SPLINE16 },
{ _T("spline36"), RGY_VPP_RESIZE_SPLINE36 },
{ _T("spline64"), RGY_VPP_RESIZE_SPLINE64 },
{ _T("lanczos2"), RGY_VPP_RESIZE_LANCZOS2 },
{ _T("lanczos3"), RGY_VPP_RESIZE_LANCZOS3 },
{ _T("lanczos4"), RGY_VPP_RESIZE_LANCZOS4 },
#if ENCODER_QSV
{ _T("bilinear"), RGY_VPP_RESIZE_MFX_BILINEAR },
{ _T("advanced"), RGY_VPP_RESIZE_MFX_ADVANCED },
{ _T("simple"), RGY_VPP_RESIZE_MFX_NEAREST_NEIGHBOR },
{ _T("fine"), RGY_VPP_RESIZE_MFX_ADVANCED },
#endif
#if ENCODER_NVENC && (!defined(_M_IX86) || FOR_AUO)
{ _T("nn"), RGY_VPP_RESIZE_NPPI_INTER_NN },
{ _T("npp_linear"), RGY_VPP_RESIZE_NPPI_INTER_LINEAR },
{ _T("cubic"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC },
//下記値は無効(指定しても動作しない)
//{ _T("cubic_bspline"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_BSPLINE },
//{ _T("cubic_catmull"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_CATMULLROM },
//{ _T("cubic_b05c03"), RGY_VPP_RESIZE_NPPI_INTER_CUBIC2P_B05C03 },
{ _T("super"), RGY_VPP_RESIZE_NPPI_INTER_SUPER },
{ _T("lanczos"), RGY_VPP_RESIZE_NPPI_INTER_LANCZOS },
//{ _T("smooth_edge"), RGY_VPP_RESIZE_NPPI_SMOOTH_EDGE },
#endif
{ NULL, 0 }
};
enum VppFpPrecision {
VPP_FP_PRECISION_UNKNOWN = -1,
VPP_FP_PRECISION_AUTO = 0,
VPP_FP_PRECISION_FP32,
VPP_FP_PRECISION_FP16,
VPP_FP_PRECISION_MAX,
};
const CX_DESC list_vpp_fp_prec[] = {
{ _T("auto"), VPP_FP_PRECISION_AUTO },
{ _T("fp32"), VPP_FP_PRECISION_FP32 },
{ _T("fp16"), VPP_FP_PRECISION_FP16 },
{ NULL, 0 }
};
enum VppNnediField {
VPP_NNEDI_FIELD_UNKNOWN = 0,
VPP_NNEDI_FIELD_BOB_AUTO,
VPP_NNEDI_FIELD_USE_AUTO,
VPP_NNEDI_FIELD_USE_TOP,
VPP_NNEDI_FIELD_USE_BOTTOM,
VPP_NNEDI_FIELD_BOB_TOP_BOTTOM,
VPP_NNEDI_FIELD_BOB_BOTTOM_TOP,
VPP_NNEDI_FIELD_MAX,
};
const CX_DESC list_vpp_nnedi_field[] = {
{ _T("bob"), VPP_NNEDI_FIELD_BOB_AUTO },
{ _T("auto"), VPP_NNEDI_FIELD_USE_AUTO },
{ _T("top"), VPP_NNEDI_FIELD_USE_TOP },
{ _T("bottom"), VPP_NNEDI_FIELD_USE_BOTTOM },
{ _T("bob_tff"), VPP_NNEDI_FIELD_BOB_TOP_BOTTOM },
{ _T("bob_bff"), VPP_NNEDI_FIELD_BOB_BOTTOM_TOP },
{ NULL, 0 }
};
const CX_DESC list_vpp_nnedi_nns[] = {
{ _T("16"), 16 },
{ _T("32"), 32 },
{ _T("64"), 64 },
{ _T("128"), 128 },
{ _T("256"), 256 },
{ NULL, 0 }
};
enum VppNnediNSize {
VPP_NNEDI_NSIZE_UNKNOWN = -1,
VPP_NNEDI_NSIZE_8x6 = 0,
VPP_NNEDI_NSIZE_16x6,
VPP_NNEDI_NSIZE_32x6,
VPP_NNEDI_NSIZE_48x6,
VPP_NNEDI_NSIZE_8x4,
VPP_NNEDI_NSIZE_16x4,
VPP_NNEDI_NSIZE_32x4,
VPP_NNEDI_NSIZE_MAX,
};
const CX_DESC list_vpp_nnedi_nsize[] = {
{ _T("8x6"), VPP_NNEDI_NSIZE_8x6 },
{ _T("16x6"), VPP_NNEDI_NSIZE_16x6 },
{ _T("32x6"), VPP_NNEDI_NSIZE_32x6 },
{ _T("48x6"), VPP_NNEDI_NSIZE_48x6 },
{ _T("8x4"), VPP_NNEDI_NSIZE_8x4 },
{ _T("16x4"), VPP_NNEDI_NSIZE_16x4 },
{ _T("32x4"), VPP_NNEDI_NSIZE_32x4 },
{ NULL, 0 }
};
enum VppNnediQuality {
VPP_NNEDI_QUALITY_UNKNOWN = 0,
VPP_NNEDI_QUALITY_FAST,
VPP_NNEDI_QUALITY_SLOW,
VPP_NNEDI_QUALITY_MAX,
};
const CX_DESC list_vpp_nnedi_quality[] = {
{ _T("fast"), VPP_NNEDI_QUALITY_FAST },
{ _T("slow"), VPP_NNEDI_QUALITY_SLOW },
{ NULL, 0 }
};
enum VppNnediPreScreen : uint32_t {
VPP_NNEDI_PRE_SCREEN_NONE = 0x00,
VPP_NNEDI_PRE_SCREEN_ORIGINAL = 0x01,
VPP_NNEDI_PRE_SCREEN_NEW = 0x02,
VPP_NNEDI_PRE_SCREEN_MODE = 0x07,
VPP_NNEDI_PRE_SCREEN_BLOCK = 0x10,
VPP_NNEDI_PRE_SCREEN_ONLY = 0x20,
VPP_NNEDI_PRE_SCREEN_ORIGINAL_BLOCK = VPP_NNEDI_PRE_SCREEN_ORIGINAL | VPP_NNEDI_PRE_SCREEN_BLOCK,
VPP_NNEDI_PRE_SCREEN_NEW_BLOCK = VPP_NNEDI_PRE_SCREEN_NEW | VPP_NNEDI_PRE_SCREEN_BLOCK,
VPP_NNEDI_PRE_SCREEN_ORIGINAL_ONLY = VPP_NNEDI_PRE_SCREEN_ORIGINAL | VPP_NNEDI_PRE_SCREEN_ONLY,
VPP_NNEDI_PRE_SCREEN_NEW_ONLY = VPP_NNEDI_PRE_SCREEN_NEW | VPP_NNEDI_PRE_SCREEN_ONLY,
VPP_NNEDI_PRE_SCREEN_MAX,
};
static VppNnediPreScreen operator|(VppNnediPreScreen a, VppNnediPreScreen b) {
return (VppNnediPreScreen)((uint32_t)a | (uint32_t)b);
}
static VppNnediPreScreen operator|=(VppNnediPreScreen& a, VppNnediPreScreen b) {
a = a | b;
return a;
}
static VppNnediPreScreen operator&(VppNnediPreScreen a, VppNnediPreScreen b) {
return (VppNnediPreScreen)((uint32_t)a & (uint32_t)b);
}
static VppNnediPreScreen operator&=(VppNnediPreScreen& a, VppNnediPreScreen b) {
a = (VppNnediPreScreen)((uint32_t)a & (uint32_t)b);
return a;
}
const CX_DESC list_vpp_nnedi_pre_screen[] = {
{ _T("none"), VPP_NNEDI_PRE_SCREEN_NONE },
{ _T("original"), VPP_NNEDI_PRE_SCREEN_ORIGINAL },
{ _T("new"), VPP_NNEDI_PRE_SCREEN_NEW },
{ _T("original_block"), VPP_NNEDI_PRE_SCREEN_ORIGINAL_BLOCK },
{ _T("new_block"), VPP_NNEDI_PRE_SCREEN_NEW_BLOCK },
{ _T("original_only"), VPP_NNEDI_PRE_SCREEN_ORIGINAL_ONLY },
{ _T("new_only"), VPP_NNEDI_PRE_SCREEN_NEW_ONLY },
{ NULL, 0 }
};
enum VppNnediErrorType {
VPP_NNEDI_ETYPE_ABS = 0,
VPP_NNEDI_ETYPE_SQUARE,
VPP_NNEDI_ETYPE_MAX,
};
const CX_DESC list_vpp_nnedi_error_type[] = {
{ _T("abs"), VPP_NNEDI_ETYPE_ABS },
{ _T("square"), VPP_NNEDI_ETYPE_SQUARE },
{ NULL, 0 }
};
const CX_DESC list_vpp_deband[] = {
{ _T("0 - 1点参照"), 0 },
{ _T("1 - 2点参照"), 1 },
{ _T("2 - 4点参照"), 2 },
{ NULL, 0 }
};
const CX_DESC list_vpp_rotate[] = {
{ _T("90"), 90 },
{ _T("180"), 180 },
{ _T("270"), 270 },
{ NULL, 0 }
};
const CX_DESC list_vpp_mirroring[] = {
{ _T("n"), 0 },
{ _T("h"), 1 /*horizontal*/ },
{ _T("v"), 2 /*vertical*/ },
{ NULL, 0 }
};
const CX_DESC list_vpp_ass_shaping[] = {
{ _T("simple"), 0 },
{ _T("complex"), 1 },
{ NULL, 0 }
};
struct ColorspaceConv {
VideoVUIInfo from, to;
double sdr_source_peak;
bool approx_gamma;
bool scene_ref;
ColorspaceConv();
void set(const VideoVUIInfo& csp_from, const VideoVUIInfo &csp_to) {
from = csp_from;
to = csp_to;
}
bool operator==(const ColorspaceConv &x) const;
bool operator!=(const ColorspaceConv &x) const;
};
struct TonemapHable {
double a, b, c, d, e, f;
TonemapHable();
bool operator==(const TonemapHable &x) const;
bool operator!=(const TonemapHable &x) const;
};
struct TonemapMobius {
double transition, peak;
TonemapMobius();
bool operator==(const TonemapMobius &x) const;
bool operator!=(const TonemapMobius &x) const;
};
struct TonemapReinhard {
double contrast, peak;
TonemapReinhard();
bool operator==(const TonemapReinhard &x) const;
bool operator!=(const TonemapReinhard &x) const;
};
struct HDR2SDRParams {
HDR2SDRToneMap tonemap;
TonemapHable hable;
TonemapMobius mobius;
TonemapReinhard reinhard;
double ldr_nits;
double hdr_source_peak;
double desat_base;
double desat_strength;
double desat_exp;
HDR2SDRParams();
bool operator==(const HDR2SDRParams &x) const;
bool operator!=(const HDR2SDRParams &x) const;
};
struct VppColorspace {
bool enable;
HDR2SDRParams hdr2sdr;
vector<ColorspaceConv> convs;
VppColorspace();
bool operator==(const VppColorspace &x) const;
bool operator!=(const VppColorspace &x) const;
};
struct VppDelogo {
bool enable;
tstring logoFilePath; //ロゴファイル名
tstring logoSelect; //ロゴの名前
int posX, posY; //位置オフセット
int depth; //透明度深度
int Y, Cb, Cr; //(輝度・色差)オフセット
int mode;
bool autoFade;
bool autoNR;
int NRArea;
int NRValue;
bool log;
VppDelogo();
bool operator==(const VppDelogo& x) const;
bool operator!=(const VppDelogo& x) const;
tstring print() const;
};
enum {
AFS_PRESET_DEFAULT = 0,
AFS_PRESET_TRIPLE, //動き重視
AFS_PRESET_DOUBLE, //二重化
AFS_PRESET_ANIME, //映画/アニメ
AFS_PRESET_CINEMA = AFS_PRESET_ANIME, //映画/アニメ
AFS_PRESET_MIN_AFTERIMG, //残像最小化
AFS_PRESET_FORCE24_SD, //24fps固定
AFS_PRESET_FORCE24_HD, //24fps固定 (HD)
AFS_PRESET_FORCE30, //30fps固定
};
const CX_DESC list_afs_preset[] = {
{ _T("default"), AFS_PRESET_DEFAULT },
{ _T("triple"), AFS_PRESET_TRIPLE },
{ _T("double"), AFS_PRESET_DOUBLE },
{ _T("anime/cinema"), AFS_PRESET_ANIME },
{ _T("anime"), AFS_PRESET_ANIME },
{ _T("cinema"), AFS_PRESET_CINEMA },
{ _T("min_afterimg"), AFS_PRESET_MIN_AFTERIMG },
{ _T("24fps"), AFS_PRESET_FORCE24_HD },
{ _T("24fps_sd"), AFS_PRESET_FORCE24_SD },
{ _T("30fps"), AFS_PRESET_FORCE30 },
{ NULL, 0 }
};
typedef struct {
int top, bottom, left, right;
} AFS_SCAN_CLIP;
static inline AFS_SCAN_CLIP scan_clip(int top, int bottom, int left, int right) {
AFS_SCAN_CLIP clip;
clip.top = top;
clip.bottom = bottom;
clip.left = left;
clip.right = right;
return clip;
}
struct VppAfs {
bool enable;
int tb_order;
AFS_SCAN_CLIP clip; //上下左右
int method_switch; //切替点
int coeff_shift; //判定比
int thre_shift; //縞(シフト)
int thre_deint; //縞(解除)
int thre_Ymotion; //Y動き
int thre_Cmotion; //C動き
int analyze; //解除Lv
bool shift; //フィールドシフト
bool drop; //間引き
bool smooth; //スムージング
bool force24; //24fps化
bool tune; //調整モード
bool rff; //rffフラグを認識して調整
int timecode; //timecode出力
bool log; //log出力
VppAfs();
void set_preset(int preset);
int read_afs_inifile(const TCHAR *inifile);
bool operator==(const VppAfs &x) const;
bool operator!=(const VppAfs &x) const;
tstring print() const;
void check();
};
enum VppYadifMode : uint32_t {
VPP_YADIF_MODE_UNKNOWN = 0x00,
VPP_YADIF_MODE_TFF = 0x01,
VPP_YADIF_MODE_BFF = 0x02,
VPP_YADIF_MODE_AUTO = 0x04,
VPP_YADIF_MODE_BOB = 0x08,
VPP_YADIF_MODE_BOB_TFF = VPP_YADIF_MODE_BOB | VPP_YADIF_MODE_TFF,
VPP_YADIF_MODE_BOB_BFF = VPP_YADIF_MODE_BOB | VPP_YADIF_MODE_BFF,
VPP_YADIF_MODE_BOB_AUTO = VPP_YADIF_MODE_BOB | VPP_YADIF_MODE_AUTO,
VPP_YADIF_MODE_MAX = VPP_YADIF_MODE_BOB_AUTO + 1,
};
static VppYadifMode operator|(VppYadifMode a, VppYadifMode b) {
return (VppYadifMode)((uint32_t)a | (uint32_t)b);
}
static VppYadifMode operator|=(VppYadifMode& a, VppYadifMode b) {
a = a | b;
return a;
}
static VppYadifMode operator&(VppYadifMode a, VppYadifMode b) {
return (VppYadifMode)((uint32_t)a & (uint32_t)b);
}
static VppYadifMode operator&=(VppYadifMode& a, VppYadifMode b) {
a = (VppYadifMode)((uint32_t)a & (uint32_t)b);
return a;
}
const CX_DESC list_vpp_yadif_mode[] = {
{ _T("unknown"), VPP_YADIF_MODE_UNKNOWN },
{ _T("tff"), VPP_YADIF_MODE_TFF },
{ _T("bff"), VPP_YADIF_MODE_BFF },
{ _T("auto"), VPP_YADIF_MODE_AUTO },
{ _T("bob_tff"), VPP_YADIF_MODE_BOB_TFF },
{ _T("bob_bff"), VPP_YADIF_MODE_BOB_BFF },
{ _T("bob"), VPP_YADIF_MODE_BOB_AUTO },
{ NULL, 0 }
};
struct VppYadif {
bool enable;
VppYadifMode mode;
VppYadif();
bool operator==(const VppYadif& x) const;
bool operator!=(const VppYadif& x) const;
tstring print() const;
};
struct VppNnedi {
bool enable;
VppNnediField field;
int nns;
VppNnediNSize nsize;
VppNnediQuality quality;
VppFpPrecision precision;
VppNnediPreScreen pre_screen;
VppNnediErrorType errortype;
tstring weightfile;
bool isbob();
VppNnedi();
bool operator==(const VppNnedi &x) const;
bool operator!=(const VppNnedi &x) const;
tstring print() const;
};
struct VppSelectEvery {
bool enable;
int step;
int offset;
VppSelectEvery();
bool operator==(const VppSelectEvery& x) const;
bool operator!=(const VppSelectEvery& x) const;
tstring print() const;
};
const CX_DESC list_vpp_decimate_block[] = {
{ _T("4"), 4 },
{ _T("8"), 8 },
{ _T("16"), 16 },
{ _T("32"), 32 },
{ _T("64"), 64 },
{ NULL, 0 }
};
struct VppDecimate {
bool enable;
int cycle;
float threDuplicate;
float threSceneChange;
int blockX;
int blockY;
bool preProcessed;
bool chroma;
bool log;
VppDecimate();
bool operator==(const VppDecimate &x) const;
bool operator!=(const VppDecimate &x) const;
tstring print() const;
};
struct VppMpdecimate {
bool enable;
int lo, hi, max;
float frac;
bool log;
VppMpdecimate();
bool operator==(const VppMpdecimate& x) const;
bool operator!=(const VppMpdecimate& x) const;
tstring print() const;
};
struct VppPad {
bool enable;
int left, top, right, bottom;
VppPad();
bool operator==(const VppPad &x) const;
bool operator!=(const VppPad &x) const;
tstring print() const;
};
struct VppKnn {
bool enable;
int radius;
float strength;
float lerpC;
float weight_threshold;
float lerp_threshold;
VppKnn();
bool operator==(const VppKnn &x) const;
bool operator!=(const VppKnn &x) const;
tstring print() const;
};
struct VppPmd {
bool enable;
float strength;
float threshold;
int applyCount;
bool useExp;
VppPmd();
bool operator==(const VppPmd &x) const;
bool operator!=(const VppPmd &x) const;
tstring print() const;
};
struct VppSmooth {
bool enable;
int quality;
int qp;
VppFpPrecision prec;
bool useQPTable;
float strength;
float threshold;
float bratio;
int maxQPTableErrCount;
VppSmooth();
bool operator==(const VppSmooth &x) const;
bool operator!=(const VppSmooth &x) const;
tstring print() const;
};
struct VppSubburn {
bool enable;
tstring filename;
std::string charcode;
tstring fontsdir;
int trackId;
int assShaping;
float scale;
float transparency_offset;
float brightness;
float contrast;
double ts_offset;
bool vid_ts_offset;
VppSubburn();
bool operator==(const VppSubburn &x) const;
bool operator!=(const VppSubburn &x) const;
tstring print() const;
};
struct VppUnsharp {
bool enable;
int radius;
float weight;
float threshold;
VppUnsharp();
bool operator==(const VppUnsharp &x) const;
bool operator!=(const VppUnsharp &x) const;
tstring print() const;
};
struct VppEdgelevel {
bool enable;
float strength;
float threshold;
float black;
float white;
VppEdgelevel();
bool operator==(const VppEdgelevel &x) const;
bool operator!=(const VppEdgelevel &x) const;
tstring print() const;
};
struct VppWarpsharp {
bool enable;
float threshold;
int blur;
int type;
float depth;
int chroma;
VppWarpsharp();
bool operator==(const VppWarpsharp& x) const;
bool operator!=(const VppWarpsharp& x) const;
tstring print() const;
};
struct VppTweak {
bool enable;
float brightness; // -1.0 - 1.0 (0.0)
float contrast; // -2.0 - 2.0 (1.0)
float gamma; // 0.1 - 10.0 (1.0)
float saturation; // 0.0 - 3.0 (1.0)
float hue; // -180 - 180 (0.0)
bool swapuv;
VppTweak();
bool operator==(const VppTweak &x) const;
bool operator!=(const VppTweak &x) const;
tstring print() const;
};
struct VppTransform {
bool enable;
bool transpose;
bool flipX;
bool flipY;
VppTransform();
int rotate() const;
bool setRotate(int rotate);
bool operator==(const VppTransform &x) const;
bool operator!=(const VppTransform &x) const;
tstring print() const;
};
struct VppDeband {
bool enable;
int range;
int threY;
int threCb;
int threCr;
int ditherY;
int ditherC;
int sample;
int seed;
bool blurFirst;
bool randEachFrame;
VppDeband();
bool operator==(const VppDeband &x) const;
bool operator!=(const VppDeband &x) const;
tstring print() const;
};
struct RGYParamVpp {
RGY_VPP_RESIZE_ALGO resize_algo;
RGY_VPP_RESIZE_MODE resize_mode;
VppColorspace colorspace;
VppDelogo delogo;
VppAfs afs;
VppNnedi nnedi;
VppYadif yadif;
bool rff;
VppSelectEvery selectevery;
VppDecimate decimate;
VppMpdecimate mpdecimate;
VppPad pad;
VppKnn knn;
VppPmd pmd;
VppSmooth smooth;
std::vector<VppSubburn> subburn;
VppUnsharp unsharp;
VppEdgelevel edgelevel;
VppWarpsharp warpsharp;
VppTweak tweak;
VppTransform transform;
VppDeband deband;
RGYParamVpp();
};
static const char *maxCLLSource = "copy";
static const char *masterDisplaySource = "copy";
static const TCHAR *RGY_METADATA_CLEAR = _T("clear");
static const TCHAR *RGY_METADATA_COPY = _T("copy");
static const int TRACK_SELECT_BY_LANG = -1;
static const int TRACK_SELECT_BY_CODEC = -2;
struct AudioSelect {
int trackID; //選択したトラックのリスト 1,2,...(1から連番で指定)
// 0 ... 全指定
// TRACK_SELECT_BY_LANG ... langによる選択