1: // ------------------------------------------------------------------------------
2: // Copyright (c) Microsoft Corporation. All rights reserved.
3: // ------------------------------------------------------------------------------
4:
5: using System;
6:
7: namespace Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdprfx
8: {
9: /// <summary>
10: /// RomoteFX context class
11: /// </summary>
12: public class RemoteFXCodecContext
13: {
14: /// <summary>
15: /// RLGR entropy algorithm
16: /// </summary>
17: public EntropyAlgorithm Mode;
18:
19: #region RGB data
20: /// <summary>
21: /// Red component
22: /// </summary>
23: public byte[,] RSet;
24:
25: /// <summary>
26: /// Green component
27: /// </summary>
28: public byte[,] GSet;
29:
30: /// <summary>
31: /// Blue component
32: /// </summary>
33: public byte[,] BSet;
34: #endregion
35:
36: #region YUV data
37: /// <summary>
38: /// Y component
39: /// </summary>
40: public short[,] YSet;
41:
42: /// <summary>
43: /// Cb component
44: /// </summary>
45: public short[,] CbSet;
46:
47: /// <summary>
48: /// Cr component
49: /// </summary>
50: public short[,] CrSet;
51: #endregion
52:
53: #region Linearized YUV component
54: /// <summary>
55: /// Linearized Y component
56: /// </summary>
57: public short[] YComponent;
58:
59: /// <summary>
60: /// Linearized U component
61: /// </summary>
62: public short[] CbComponent;
63:
64: /// <summary>
65: /// Linearized V component
66: /// </summary>
67: public short[] CrComponent;
68: #endregion
69:
70: #region RLGR encoded YUV data
71: /// <summary>
72: /// RLGR encoded Y data
73: /// </summary>
74: public byte[] YData;
75:
76: /// <summary>
77: /// RLGR encoded U data
78: /// </summary>
79: public byte[] CbData;
80:
81: /// <summary>
82: /// RLGR encoded V data
83: /// </summary>
84: public byte[] CrData;
85: #endregion
86:
87: /// <summary>
88: /// The scalar quantization values for the ten sub-bands in the 3-level DWT decomposition.
89: /// </summary>
90: public TS_RFX_CODEC_QUANT[] CodecQuantVals;
91:
92: public byte QuantIdxY;
93:
94: public byte QuantIdxCb;
95:
96: public byte QuantIdxCr;
97:
98: /// <summary>
99: /// Constructor
100: /// </summary>
101: /// <param name="tsRfxCodecQuant"></param>
102: /// <param name="mode"></param>
103: public RemoteFXCodecContext(TS_RFX_CODEC_QUANT tsRfxCodecQuant, EntropyAlgorithm mode)
104: {
105: this.CodecQuantVals = new TS_RFX_CODEC_QUANT[] { tsRfxCodecQuant };
106: this.QuantIdxY = 0;
107: this.QuantIdxCb = 0;
108: this.QuantIdxCr = 0;
109: this.Mode = mode;
110: }
111:
112: /// <summary>
113: /// Constructor
114: /// </summary>
115: /// <param name="tsRfxCodecQuantVals"></param>
116: /// <param name="quantIdxY"></param>
117: /// <param name="quantIdxCb"></param>
118: /// <param name="quantIdxCr"></param>
119: /// <param name="mode"></param>
120: public RemoteFXCodecContext(TS_RFX_CODEC_QUANT[] tsRfxCodecQuantVals, byte quantIdxY, byte quantIdxCb, byte quantIdxCr, EntropyAlgorithm mode)
121: {
122: if(tsRfxCodecQuantVals == null || tsRfxCodecQuantVals.Length == 0)
123: {
124: throw new ArgumentException("Parameter tsRfxCodecQuantVals cannot be null and its length must larger than 0.");
125: }
126: int maxIndex = tsRfxCodecQuantVals.Length -1;
127: if (quantIdxY > maxIndex || quantIdxCb > maxIndex || quantIdxCr > maxIndex)
128: {
129: throw new ArgumentException("Quant index for Y , Cb or Cr is/are larger than the size of tsRfxCodecQuantVals.");
130: }
131: this.CodecQuantVals = tsRfxCodecQuantVals;
132: this.QuantIdxY = quantIdxY;
133: this.QuantIdxCb = quantIdxCb;
134: this.QuantIdxCr = quantIdxCr;
135: this.Mode = mode;
136: }
137: }
138:
139: /// <summary>
140: /// DWT direction enumeration
141: /// </summary>
142: enum ArrayDirection
143: {
144: Vertical,
145: Horizontal
146: }
147: }