1 /***************************************************************************** 2 3 ResampleUtil.h 4 Author: Laurent de Soras, 2021 5 6 --- Legal stuff --- 7 8 This program is free software. It comes without any warranty, to 9 the extent permitted by applicable law. You can redistribute it 10 and/or modify it under the terms of the Do What The Fuck You Want 11 To Public License, Version 2, as published by Sam Hocevar. See 12 http://www.wtfpl.net/ for more details. 13 14 *Tab=3***********************************************************************/ 15 16 17 18 #pragma once 19 #if ! defined (fmtcl_ResampleUtil_HEADER_INCLUDED) 20 #define fmtcl_ResampleUtil_HEADER_INCLUDED 21 22 23 24 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 26 #include "fmtcl/ChromaPlacement.h" 27 #include "fmtcl/ColorFamily.h" 28 29 30 31 namespace fmtcl 32 { 33 34 35 36 class ResamplePlaneData; 37 38 class ResampleUtil 39 { 40 41 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 43 public: 44 45 static constexpr int _max_nbr_taps = 128; 46 47 class FrameInfo 48 { 49 public: 50 bool _itl_s_flag = false; 51 bool _top_s_flag = false; 52 bool _itl_d_flag = false; 53 bool _top_d_flag = false; 54 }; 55 56 enum InterlacingParam 57 { 58 InterlacingParam_INVALID = -1, 59 60 InterlacingParam_FRAMES = 0, 61 InterlacingParam_FIELDS, 62 InterlacingParam_AUTO, 63 64 InterlacingParam_NBR_ELT 65 }; 66 67 enum FieldOrder 68 { 69 FieldOrder_INVALID = -1, 70 71 FieldOrder_BFF = 0, 72 FieldOrder_TFF, 73 FieldOrder_AUTO, 74 75 FieldOrder_NBR_ELT 76 }; 77 78 // Frame properties, common to Vapoursynth and Avisynth+ 79 80 enum FieldBased 81 { 82 FieldBased_INVALID = -1, 83 84 FieldBased_FRAMES = 0, 85 FieldBased_BFF, 86 FieldBased_TFF, 87 88 FieldBased_NBR_ELT 89 }; 90 91 enum Field 92 { 93 Field_INVALID = -1, 94 95 Field_BOT = 0, 96 Field_TOP, 97 98 Field_NBR_ELT 99 }; 100 101 static ChromaPlacement 102 conv_str_to_chroma_placement (std::string cplace); 103 static int conv_str_to_chroma_subspl (int &ssh, int &ssv, std::string css); 104 static void create_plane_specs (ResamplePlaneData &plane_data, int plane_index, ColorFamily src_cf, int src_w, int src_ss_h, int src_h, int src_ss_v, ChromaPlacement cplace_s, ColorFamily dst_cf, int dst_w, int dst_ss_h, int dst_h, int dst_ss_v, ChromaPlacement cplace_d); 105 static void get_interlacing_param (bool &itl_flag, bool &top_flag, int field_index, InterlacingParam interlaced, FieldOrder field_order, FieldBased prop_fieldbased, Field prop_field, bool old_behaviour_flag); 106 107 108 109 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 110 111 protected: 112 113 114 115 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 116 117 private: 118 119 120 121 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 122 123 private: 124 125 ResampleUtil () = delete; 126 ResampleUtil (const ResampleUtil &other) = delete; 127 ResampleUtil (ResampleUtil &&other) = delete; 128 ResampleUtil & operator = (const ResampleUtil &other) = delete; 129 ResampleUtil & operator = (ResampleUtil &&other) = delete; 130 bool operator == (const ResampleUtil &other) const = delete; 131 bool operator != (const ResampleUtil &other) const = delete; 132 133 }; // class ResampleUtil 134 135 136 137 } // namespace fmtcl 138 139 140 141 //#include "fmtcl/ResampleUtil.hpp" 142 143 144 145 #endif // fmtcl_ResampleUtil_HEADER_INCLUDED 146 147 148 149 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 150