Skip to content

Instantly share code, notes, and snippets.

@mfkl
Created November 6, 2018 05:08
Show Gist options
  • Save mfkl/cf54e2cb6593aecc27a6b3e4146e4cfb to your computer and use it in GitHub Desktop.
Save mfkl/cf54e2cb6593aecc27a6b3e4146e4cfb to your computer and use it in GitHub Desktop.
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace dav1dSharp
{
public unsafe partial class Dav1dData : IDisposable
{
public partial struct __Internal
{
internal global::System.IntPtr data;
internal ulong sz;
internal global::System.IntPtr @ref;
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dData> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dData>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::dav1dSharp.Dav1dData __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dData(native.ToPointer(), skipVTables);
}
internal static global::dav1dSharp.Dav1dData __CreateInstance(global::dav1dSharp.Dav1dData.__Internal native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dData(native, skipVTables);
}
private static void* __CopyValue(global::dav1dSharp.Dav1dData.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::dav1dSharp.Dav1dData.__Internal));
*(global::dav1dSharp.Dav1dData.__Internal*)ret = native;
return ret.ToPointer();
}
private Dav1dData(global::dav1dSharp.Dav1dData.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected Dav1dData(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::dav1dSharp.Dav1dData __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public byte* Data
{
get
{
return (byte*)((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->data;
}
set
{
((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->data = (global::System.IntPtr)value;
}
}
public ulong Sz
{
get
{
return ((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->sz;
}
set
{
((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->sz = value;
}
}
public global::dav1dSharp.Dav1dRef Ref
{
get
{
global::dav1dSharp.Dav1dRef __result0;
if (((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->@ref == IntPtr.Zero) __result0 = null;
else if (global::dav1dSharp.Dav1dRef.NativeToManagedMap.ContainsKey(((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->@ref))
__result0 = (global::dav1dSharp.Dav1dRef)global::dav1dSharp.Dav1dRef.NativeToManagedMap[((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->@ref];
else __result0 = global::dav1dSharp.Dav1dRef.__CreateInstance(((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->@ref);
return __result0;
}
set
{
((global::dav1dSharp.Dav1dData.__Internal*)__Instance)->@ref = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
}
public unsafe partial class Dav1dRef
{
public partial struct __Internal
{
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dRef> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dRef>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::dav1dSharp.Dav1dRef __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dRef(native.ToPointer(), skipVTables);
}
internal static global::dav1dSharp.Dav1dRef __CreateInstance(global::dav1dSharp.Dav1dRef.__Internal native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dRef(native, skipVTables);
}
private static void* __CopyValue(global::dav1dSharp.Dav1dRef.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::dav1dSharp.Dav1dRef.__Internal));
*(global::dav1dSharp.Dav1dRef.__Internal*)ret = native;
return ret.ToPointer();
}
private Dav1dRef(global::dav1dSharp.Dav1dRef.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected Dav1dRef(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
}
public unsafe partial class data
{
public partial struct __Internal
{
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_data_create")]
internal static extern byte* Dav1dDataCreate(global::System.IntPtr data, ulong sz);
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_data_wrap")]
internal static extern int Dav1dDataWrap(global::System.IntPtr data, byte* buf, ulong sz, global::System.IntPtr free_callback, global::System.IntPtr user_data);
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_data_unref")]
internal static extern void Dav1dDataUnref(global::System.IntPtr data);
}
/// <summary>Allocate data.</summary>
/// <param name="data">Input context.</param>
/// <param name="sz">Size of the data that should be allocated.</param>
/// <returns>Pointer to the allocated bufferon success. NULL on error.</returns>
public static byte* Dav1dDataCreate(global::dav1dSharp.Dav1dData data, ulong sz)
{
var __arg0 = ReferenceEquals(data, null) ? global::System.IntPtr.Zero : data.__Instance;
var __ret = __Internal.Dav1dDataCreate(__arg0, sz);
return __ret;
}
/// <summary>Wrap an existing data array.</summary>
/// <param name="data">Input context.</param>
/// <param name="buf">The data to be wrapped.</param>
/// <param name="sz">Size of the data.</param>
/// <param name="free_callback">
/// <para>Function to be called when we release our last</para>
/// <para>reference to this data. In this callback, $buf will be</para>
/// <para>the $buf argument to this function, and $user_data</para>
/// <para>will be the $user_data input argument to this function.</para>
/// </param>
/// <param name="user_data">Opaque parameter passed to free_callback().</param>
/// <returns>0 on success. A negative errno value on error.</returns>
public static int Dav1dDataWrap(global::dav1dSharp.Dav1dData data, byte* buf, ulong sz, global::dav1dSharp.Delegates.Action_bytePtr_IntPtr free_callback, global::System.IntPtr user_data)
{
var __arg0 = ReferenceEquals(data, null) ? global::System.IntPtr.Zero : data.__Instance;
var __arg3 = free_callback == null ? global::System.IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(free_callback);
var __ret = __Internal.Dav1dDataWrap(__arg0, buf, sz, __arg3, user_data);
return __ret;
}
/// <summary>Free the data reference.</summary>
/// <param name="data">Input context.</param>
public static void Dav1dDataUnref(global::dav1dSharp.Dav1dData data)
{
var __arg0 = ReferenceEquals(data, null) ? global::System.IntPtr.Zero : data.__Instance;
__Internal.Dav1dDataUnref(__arg0);
}
}
public struct Dav1dContext
{
IntPtr fc;
uint n_fc;
struct tile
{
Dav1dData data;
int start, end;
}
int n_tile_data, have_seq_hdr, have_frame_hdr;
int n_tiles;
Av1SequenceHeader
}
public struct Av1SequenceHeader
{
public int profile;
public int still_picture;
public int reduced_still_picture_header;
public int timing_info_present;
public int num_units_in_tick;
public int time_scale;
public int equal_picture_interval;
public int num_ticks_per_picture;
public int decoder_model_info_present;
public int encoder_decoder_buffer_delay_length;
public int num_units_in_decoding_tick;
public int buffer_removal_delay_length;
public int frame_presentation_delay_length;
public int display_model_info_present;
public int num_operating_points;
public struct Av1SequenceHeaderOperatingPoint
{
public int idc;
public int major_level, minor_level;
public int tier;
public int decoder_model_param_present;
public int decoder_buffer_delay;
public int encoder_buffer_delay;
public int low_delay_mode;
public int display_model_param_present;
public int initial_display_delay;
}
public int max_width, max_height, width_n_bits, height_n_bits;
public int frame_id_numbers_present;
public int delta_frame_id_n_bits;
public int frame_id_n_bits;
public int sb128;
public int filter_intra;
public int intra_edge_filter;
public int inter_intra;
public int masked_compound;
public int warped_motion;
public int dual_filter;
public int order_hint;
public int jnt_comp;
public int ref_frame_mvs;
public AdaptiveBoolean screen_content_tools;
public AdaptiveBoolean force_integer_mv;
public int order_hint_n_bits;
public int super_res;
public int cdef;
public int restoration;
public int bpc;
public int hbd;
public int color_description_present;
public Dav1dPixelLayout layout;
public Dav1dColorPrimaries pri;
public Dav1dTransferCharacteristics trc;
public Dav1dMatrixCoefficients mtrx;
public Dav1dChromaSamplePosition chr;
public int color_range;
public int separate_uv_delta_q;
public int film_grain_present;
}
unsafe struct Av1FrameHeader
{
int show_existing_frame;
int existing_frame_idx;
int frame_id;
int frame_presentation_delay;
Dav1dFrameType frame_type;
int show_frame;
int showable_frame;
int error_resilient_mode;
int disable_cdf_update;
int allow_screen_content_tools;
int force_integer_mv;
int frame_size_override;
int primary_ref_frame;
int buffer_removal_time_present;
struct Av1FrameHeaderOperatingPoint
{
int buffer_removal_time;
}
int frame_offset;
int refresh_frame_flags;
int width, height;
int render_width, render_height;
int super_res;
int have_render_size;
int allow_intrabc;
int frame_ref_short_signaling;
fixed int refidx[7];
int hp;
FilterMode subpel_filter_mode;
int switchable_motion_mode;
int use_ref_frame_mvs;
int refresh_context;
struct tiling
{
int uniform;
uint n_bytes;
int min_log2_cols, max_log2_cols, log2_cols, cols;
fixed int col_start_sb[1025];
int min_log2_rows, max_log2_rows, log2_rows, rows;
fixed int row_start_sb[1025];
int update;
}
struct quant
{
int yac;
int ydc_delta;
int udc_delta, uac_delta, vdc_delta, vac_delta;
int qm, qm_y, qm_u, qm_v;
}
struct segmentation
{
int enabled, update_map, temporal, update_data;
Av1SegmentationDataSet seg_data;
fixed int lossless[8], qidx[8];
}
struct delta
{
struct q
{
int present;
int res_log2;
}
struct lf
{
int present;
int res_log2;
int multi;
}
}
int all_lossless;
struct loopfilter
{
fixed int level_y[2];
int level_u, level_v;
int mode_ref_delta_enabled;
int mode_ref_delta_update;
Av1LoopfilterModeRefDeltas mode_ref_deltas;
int sharpness;
}
struct cdef
{
int damping;
int n_bits;
fixed int y_strength[8];
fixed int uv_strength[8];
}
struct restoration
{
RestorationType[] type;
fixed int unit_size[2];
}
TxfmMode txfm_mode;
int switchable_comp_refs;
int skip_mode_allowed, skip_mode_enabled, skip_mode_refs[2];
int warp_motion;
int reduced_txtp_set;
WarpedMotionParams gmv[7];
struct {
int present, update, seed;
Av1FilmGrainData data;
} film_grain;
}
public enum AdaptiveBoolean
{
OFF = 0,
ON = 1,
ADAPTIVE = 2,
};
unsafe struct Av1LoopfilterModeRefDeltas
{
fixed int mode_delta[2];
fixed int ref_delta[8];
}
unsafe struct Av1SegmentationDataSet
{
//fixed Av1SegmentationData d[8]; //FIXME
int preskip;
int last_active_segid;
}
unsafe struct WarpedMotionParams
{
WarpedMotionType type;
fixed int matrix[6];
// union {
// struct {
// int16_t alpha, beta, gamma, delta;
//};
//int16_t abcd[4];
// };
}
public enum WarpedMotionType
{
WM_TYPE_IDENTITY,
WM_TYPE_TRANSLATION,
WM_TYPE_ROT_ZOOM,
WM_TYPE_AFFINE,
};
struct Av1SegmentationData
{
int delta_q;
int delta_lf_y_v, delta_lf_y_h, delta_lf_u, delta_lf_v;
int reff;
int skip;
int globalmv;
}
public enum TxfmMode
{
TX_4X4_ONLY,
TX_LARGEST,
TX_SWITCHABLE,
N_TX_MODES,
};
public enum FilterMode
{
FILTER_8TAP_REGULAR,
FILTER_8TAP_SMOOTH,
FILTER_8TAP_SHARP,
N_SWITCHABLE_FILTERS,
FILTER_BILINEAR = N_SWITCHABLE_FILTERS,
N_FILTERS,
FILTER_SWITCHABLE = N_FILTERS,
};
public enum RestorationType
{
RESTORATION_NONE,
RESTORATION_SWITCHABLE,
RESTORATION_WIENER,
RESTORATION_SGRPROJ,
};
public struct Dav1dSettings
{
public int n_frame_threads;
public int n_tile_threads;
public Dav1dPicAllocator allocator;
}
public unsafe partial class dav1d
{
public partial struct __Internal
{
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_version")]
internal static extern global::System.IntPtr Dav1dVersion();
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_default_settings")]
internal static extern void Dav1dDefaultSettings(ref Dav1dSettings s);
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_open")]
internal static extern int Dav1dOpen(Dav1dContext c_out, Dav1dSettings s);
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_decode")]
internal static extern int Dav1dDecode(global::System.IntPtr c, global::System.IntPtr @in, global::System.IntPtr @out);
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_close")]
internal static extern void Dav1dClose(global::System.IntPtr c_out);
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_flush")]
internal static extern void Dav1dFlush(global::System.IntPtr c);
}
/// <summary>Get library version.</summary>
public static string Dav1dVersion()
{
var __ret = __Internal.Dav1dVersion();
return Marshal.PtrToStringAnsi(__ret);
}
/// <summary>Initialize settings to default values.</summary>
/// <param name="s">Input settings context.</param>
public static void Dav1dDefaultSettings(ref global::dav1dSharp.Dav1dSettings s)
{
//var ptr = new IntPtr();
//Marshal.StructureToPtr<Dav1dSettings>(s, ptr, true);
//var __arg0 = ReferenceEquals(s, null) ? global::System.IntPtr.Zero : ptr;
__Internal.Dav1dDefaultSettings(ref s);
}
/// <summary>Allocate and open a decoder instance.</summary>
/// <param name="c_out">
/// <para>The decoder instance to open. To be used in iterative calls to</para>
/// <para>dav1d_decode(). *c_out will be set to the allocated context.</para>
/// </param>
/// <param name="s">Input settings context.</param>
/// <returns>0 on success, or&lt;0 (a negative errno code) on error.</returns>
/// <remarks>
/// <para>The context must be freed using dav1d_close() when decoding is</para>
/// <para>finished.</para>
/// </remarks>
public static int Dav1dOpen(global::dav1dSharp.Dav1dContext c_out, global::dav1dSharp.Dav1dSettings s)
{
var __ret = __Internal.Dav1dOpen(c_out, s);
return __ret;
}
/// <summary>Decode one frame.</summary>
/// <param name="c">Input decoder instance.</param>
/// <param name="in">
/// <para>Input bitstream data. On success, the caller retains ownership of</para>
/// <para>the input reference if the data was not fully consumed.</para>
/// </param>
/// <param name="out">
/// <para>Output frame. The caller assumes ownership of the returned</para>
/// <para>reference.</para>
/// </param>
/// <returns>
/// <para>0: Success, and a frame is returned.</para>
/// <para>-EAGAIN: Not enough data to output a frame. The fuction should be called</para>
/// <para>again with new input.</para>
/// <para>other negative errno codes: Error during decoding or because of invalid</para>
/// <para>passed-in arguments.</para>
/// </returns>
/// <remarks>
/// <para>To flush the decoder (i.e. all input is finished), feed it NULL input</para>
/// <para>data until it returns -EAGAIN.</para>
/// </remarks>
public static int Dav1dDecode(global::dav1dSharp.Dav1dContext c, global::dav1dSharp.Dav1dData @in, global::dav1dSharp.Dav1dPicture @out)
{
var __arg0 = ReferenceEquals(c, null) ? global::System.IntPtr.Zero : c.__Instance;
var __arg1 = ReferenceEquals(@in, null) ? global::System.IntPtr.Zero : @in.__Instance;
var __arg2 = ReferenceEquals(@out, null) ? global::System.IntPtr.Zero : @out.__Instance;
var __ret = __Internal.Dav1dDecode(__arg0, __arg1, __arg2);
return __ret;
}
/// <summary>Close a decoder instance and free all associated memory.</summary>
/// <param name="c_out">The decoder instance to close. *c_out will be set to NULL.</param>
public static void Dav1dClose(global::dav1dSharp.Dav1dContext c_out)
{
var __arg0 = ReferenceEquals(c_out, null) ? global::System.IntPtr.Zero : c_out.__Instance;
__Internal.Dav1dClose(__arg0);
}
/// <summary>Flush all delayed frames in decoder, to be used when seeking.</summary>
/// <param name="c">Input decoder instance.</param>
public static void Dav1dFlush(global::dav1dSharp.Dav1dContext c)
{
var __arg0 = ReferenceEquals(c, null) ? global::System.IntPtr.Zero : c.__Instance;
__Internal.Dav1dFlush(__arg0);
}
}
public enum Dav1dPixelLayout
{
/// <summary>monochrome</summary>
DAV1D_PIXEL_LAYOUT_I400 = 0,
/// <summary>4:2:0 planar</summary>
DAV1D_PIXEL_LAYOUT_I420 = 1,
/// <summary>4:2:2 planar</summary>
DAV1D_PIXEL_LAYOUT_I422 = 2,
/// <summary>4:4:4 planar</summary>
DAV1D_PIXEL_LAYOUT_I444 = 3
}
public enum Dav1dFrameType
{
/// <summary>Key Intra frame</summary>
DAV1D_FRAME_TYPE_KEY = 0,
/// <summary>Inter frame</summary>
DAV1D_FRAME_TYPE_INTER = 1,
/// <summary>Non key Intra frame</summary>
DAV1D_FRAME_TYPE_INTRA = 2,
/// <summary>Switch Inter frame</summary>
DAV1D_FRAME_TYPE_SWITCH = 3
}
public enum Dav1dColorPrimaries
{
DAV1D_COLOR_PRI_BT709 = 1,
DAV1D_COLOR_PRI_UNKNOWN = 2,
DAV1D_COLOR_PRI_BT470M = 4,
DAV1D_COLOR_PRI_BT470BG = 5,
DAV1D_COLOR_PRI_BT601 = 6,
DAV1D_COLOR_PRI_SMPTE240 = 7,
DAV1D_COLOR_PRI_FILM = 8,
DAV1D_COLOR_PRI_BT2020 = 9,
DAV1D_COLOR_PRI_XYZ = 10,
DAV1D_COLOR_PRI_SMPTE431 = 11,
DAV1D_COLOR_PRI_SMPTE432 = 12,
DAV1D_COLOR_PRI_EBU3213 = 22
}
public enum Dav1dTransferCharacteristics
{
DAV1D_TRC_BT709 = 1,
DAV1D_TRC_UNKNOWN = 2,
DAV1D_TRC_BT470M = 4,
DAV1D_TRC_BT470BG = 5,
DAV1D_TRC_BT601 = 6,
DAV1D_TRC_SMPTE240 = 7,
DAV1D_TRC_LINEAR = 8,
/// <summary>logarithmic (100:1 range)</summary>
DAV1D_TRC_LOG100 = 9,
/// <summary>lograithmic (100*sqrt(10):1 range)</summary>
DAV1D_TRC_LOG100SQRT10 = 10,
DAV1D_TRC_IEC61966 = 11,
DAV1D_TRC_BT1361 = 12,
DAV1D_TRC_SRGB = 13,
DAV1D_TRC_BT2020_10BIT = 14,
DAV1D_TRC_BT2020_12BIT = 15,
/// <summary>PQ</summary>
DAV1D_TRC_SMPTE2084 = 16,
DAV1D_TRC_SMPTE428 = 17,
/// <summary>hybrid log/gamma (BT.2100 / ARIB STD-B67)</summary>
DAV1D_TRC_HLG = 18
}
public enum Dav1dMatrixCoefficients
{
DAV1D_MC_IDENTITY = 0,
DAV1D_MC_BT709 = 1,
DAV1D_MC_UNKNOWN = 2,
DAV1D_MC_FCC = 4,
DAV1D_MC_BT470BG = 5,
DAV1D_MC_BT601 = 6,
DAV1D_MC_SMPTE240 = 7,
DAV1D_MC_SMPTE_YCGCO = 8,
DAV1D_MC_BT2020NCL = 9,
DAV1D_MC_BT2020CL = 10,
DAV1D_MC_SMPTE2085 = 11,
/// <summary>Chromaticity-derived</summary>
DAV1D_MC_CHROMAT_NCL = 12,
DAV1D_MC_CHROMAT_CL = 13,
DAV1D_MC_ICTCP = 14
}
public enum Dav1dChromaSamplePosition
{
DAV1D_CHR_UNKNOWN = 0,
/// <summary>
/// <para>Horizontally co-located with luma(0, 0)</para>
/// <para>sample, between two vertical samples</para>
/// </summary>
DAV1D_CHR_VERTICAL = 1,
/// <summary>Co-located with luma(0, 0) sample</summary>
DAV1D_CHR_COLOCATED = 2
}
public unsafe partial class Dav1dPictureParameters : IDisposable
{
public partial struct __Internal
{
internal int w;
internal int h;
internal global::dav1dSharp.Dav1dPixelLayout layout;
internal global::dav1dSharp.Dav1dFrameType type;
internal int bpc;
internal global::dav1dSharp.Dav1dColorPrimaries pri;
internal global::dav1dSharp.Dav1dTransferCharacteristics trc;
internal global::dav1dSharp.Dav1dMatrixCoefficients mtrx;
internal global::dav1dSharp.Dav1dChromaSamplePosition chr;
internal int fullrange;
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dPictureParameters> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dPictureParameters>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::dav1dSharp.Dav1dPictureParameters __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dPictureParameters(native.ToPointer(), skipVTables);
}
internal static global::dav1dSharp.Dav1dPictureParameters __CreateInstance(global::dav1dSharp.Dav1dPictureParameters.__Internal native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dPictureParameters(native, skipVTables);
}
private static void* __CopyValue(global::dav1dSharp.Dav1dPictureParameters.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::dav1dSharp.Dav1dPictureParameters.__Internal));
*(global::dav1dSharp.Dav1dPictureParameters.__Internal*)ret = native;
return ret.ToPointer();
}
private Dav1dPictureParameters(global::dav1dSharp.Dav1dPictureParameters.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected Dav1dPictureParameters(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::dav1dSharp.Dav1dPictureParameters __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public int W
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->w;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->w = value;
}
}
public int H
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->h;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->h = value;
}
}
public global::dav1dSharp.Dav1dPixelLayout Layout
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->layout;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->layout = value;
}
}
public global::dav1dSharp.Dav1dFrameType Type
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->type;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->type = value;
}
}
public int Bpc
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->bpc;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->bpc = value;
}
}
public global::dav1dSharp.Dav1dColorPrimaries Pri
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->pri;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->pri = value;
}
}
public global::dav1dSharp.Dav1dTransferCharacteristics Trc
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->trc;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->trc = value;
}
}
public global::dav1dSharp.Dav1dMatrixCoefficients Mtrx
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->mtrx;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->mtrx = value;
}
}
public global::dav1dSharp.Dav1dChromaSamplePosition Chr
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->chr;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->chr = value;
}
}
public int Fullrange
{
get
{
return ((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->fullrange;
}
set
{
((global::dav1dSharp.Dav1dPictureParameters.__Internal*)__Instance)->fullrange = value;
}
}
}
public unsafe partial class Dav1dPicture : IDisposable
{
public partial struct __Internal
{
internal int poc;
internal void* data;
internal global::System.IntPtr @ref;
internal fixed long stride[2];
internal global::dav1dSharp.Dav1dPictureParameters.__Internal p;
internal global::System.IntPtr allocator_data;
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dPicture> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::dav1dSharp.Dav1dPicture>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::dav1dSharp.Dav1dPicture __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dPicture(native.ToPointer(), skipVTables);
}
internal static global::dav1dSharp.Dav1dPicture __CreateInstance(global::dav1dSharp.Dav1dPicture.__Internal native, bool skipVTables = false)
{
return new global::dav1dSharp.Dav1dPicture(native, skipVTables);
}
private static void* __CopyValue(global::dav1dSharp.Dav1dPicture.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::dav1dSharp.Dav1dPicture.__Internal));
*(global::dav1dSharp.Dav1dPicture.__Internal*)ret = native;
return ret.ToPointer();
}
private Dav1dPicture(global::dav1dSharp.Dav1dPicture.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected Dav1dPicture(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::dav1dSharp.Dav1dPicture __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public int Poc
{
get
{
return ((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->poc;
}
set
{
((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->poc = value;
}
}
/// <summary>
/// <para>Pointers to planar image data (Y is [0], U is [1], V is [2]). The data</para>
/// <para>should be bytes (for 8 bpc) or words (for 10 bpc). In case of words</para>
/// <para>containing 10 bpc image data, the pixels should be located in the LSB</para>
/// <para>bits, so that values range between [0, 1023]; the upper bits should be</para>
/// <para>zero'ed out.</para>
/// </summary>
private global::System.IntPtr[] __data;
private bool __dataInitialised;
public global::System.IntPtr[] Data
{
get
{
if (!__dataInitialised)
{
__data = null;
__dataInitialised = true;
}
return __data;
}
set
{
__data = value;
if (!__dataInitialised)
{
__dataInitialised = true;
}
}
}
public global::dav1dSharp.Dav1dRef Ref
{
get
{
global::dav1dSharp.Dav1dRef __result0;
if (((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->@ref == IntPtr.Zero) __result0 = null;
else if (global::dav1dSharp.Dav1dRef.NativeToManagedMap.ContainsKey(((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->@ref))
__result0 = (global::dav1dSharp.Dav1dRef)global::dav1dSharp.Dav1dRef.NativeToManagedMap[((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->@ref];
else __result0 = global::dav1dSharp.Dav1dRef.__CreateInstance(((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->@ref);
return __result0;
}
set
{
((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->@ref = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
public long[] Stride
{
get
{
long[] __value = null;
if (((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->stride != null)
{
__value = new long[2];
for (int i = 0; i < 2; i++)
__value[i] = ((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->stride[i];
}
return __value;
}
set
{
if (value != null)
{
for (int i = 0; i < 2; i++)
((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->stride[i] = value[i];
}
}
}
public global::dav1dSharp.Dav1dPictureParameters P
{
get
{
return global::dav1dSharp.Dav1dPictureParameters.__CreateInstance(new global::System.IntPtr(&((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->p));
}
set
{
((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->p = ReferenceEquals(value, null) ? new global::dav1dSharp.Dav1dPictureParameters.__Internal() : *(global::dav1dSharp.Dav1dPictureParameters.__Internal*)value.__Instance;
}
}
public global::System.IntPtr AllocatorData
{
get
{
return ((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->allocator_data;
}
set
{
((global::dav1dSharp.Dav1dPicture.__Internal*)__Instance)->allocator_data = (global::System.IntPtr)value;
}
}
}
public struct Dav1dPicAllocator
{
public IntPtr Cookie;
public IntPtr alloc_picture_callback;
public IntPtr release_picture_callback;
}
public unsafe partial class picture
{
public partial struct __Internal
{
[DllImport("dav1d", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "dav1d_picture_unref")]
internal static extern void Dav1dPictureUnref(global::System.IntPtr p);
}
/// <summary>Release reference to a picture.</summary>
public static void Dav1dPictureUnref(global::dav1dSharp.Dav1dPicture p)
{
var __arg0 = ReferenceEquals(p, null) ? global::System.IntPtr.Zero : p.__Instance;
__Internal.Dav1dPictureUnref(__arg0);
}
}
namespace Delegates
{
[UnmanagedFunctionPointer(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate void Action_bytePtr_IntPtr(byte* _0, global::System.IntPtr _1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment