Skip to content

Commit 0092d65

Browse files
Update README.md
updated readme
1 parent 254467e commit 0092d65

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SIMD color format converters are faster than OpenCV implementation.
1515
Cisco Openh264 is chosen for its unbeatible performance compared to other available encoders. A paper involving performance metrics can be found here:
1616
<br>https://iopscience.iop.org/article/10.1088/1757-899X/1172/1/012036/pdf</br>
1717

18-
Library consist of native dll which acts as OpenH264 wrapper and color format converter (YUV420p <-> RGB,BGR,RGBA,BGRA)
18+
Library consist of native dll which acts as OpenH264 wrapper/facade and color format converter (YUV420p <-> RGB,BGR,RGBA,BGRA)
1919
<br/>Converters are vectorised(AVX2 and SSE) and can be configured for parallelisation for high performance.
2020

2121
C# library is .Net standard wrapper library for this dll and performs PInvoke to handle transcoding.
@@ -77,7 +77,7 @@ static void Main(string[] args)
7777
}
7878
```
7979
Bitmaps are not included on library to keep it cross platform.
80-
<br/>For the bitmaps and other image container types i will provide extention libraries.
80+
<br/>For the bitmaps and other image container types, an extention library is provided.
8181
``` c#
8282
private static Bitmap RgbToBitmap(RgbImage img)
8383
{
@@ -131,10 +131,24 @@ And to extract bitmap data:
131131
}
132132
}
133133
```
134+
# Info & Tips
134135

136+
Decoder has two ways of decoding:
137+
138+
- First is with the ``` out RGBImagePointer rgb``` which is a ref struct on purpose. On unmanaged side, It writes the decoded bytes into Cached array, and it reuses same array in consecutive decodes, so what you get is only a reference to that memory. So not intended for storage(hence the ref struct), but handling decoded image ephemerally.
139+
140+
- Second is with ``` ref RgbImage img``` which receives the memory externally from managed side and directly decodes there without copy. When you create new instance of RgbImage it allocates the raw image array(Unmanaged, to be interopped). This object is storable, and reusable. If you are going to use this you should either reuse same reference or pool these objects(i.e. ConcurrentBag). One should avoid making new on each decode.
141+
142+
Yuv<->Rgb converter does not allocate any memory its either uses the memory provided by managed side, or the cached array in the unmanaged side depending on which method is called, as I explained above.
143+
144+
Similarly Encoder also gives a reference object to unmanaged cached memory which is again cycled through each encode operation.
145+
It doesn't allocate any memory unless you call ``` .GetBytes()``` method of the Encoded data. Here you should use ``` .CopyTo(buffer,offset) ``` if you can.
146+
147+
- A tip, Encoded data which consists of arrays of byte arrays can be stitched(copy to) into single contiguous array and fed into decoder as single input, If you are only using single layer(standard use case).
148+
135149
# Advanced Configuration & Features
136150
## Advanced Setup
137-
If you want to initialise your encoder and able to control everything, you can use provided API which is identical to Ciso C++.
151+
If you want to initialise your encoder and able to control everything, you can use provided API which is identical to Ciso C++ Release.
138152
```c#
139153
encoder = new H264Encoder();
140154
var param = encoder.GetDefaultParameters();
@@ -200,7 +214,7 @@ Similarly for decoder
200214
```
201215

202216
Color format conversion (RGB <-> YUV420) has optional configuration where you can provide number of threads on parallelisation.
203-
<br/>Using 1 thread gives consumes least cpu cycles and most efficient but it takes more time.
217+
<br/>Using 1 thread consumes least cpu cycles and most efficient but it takes more time.
204218
Beyond 4 threads you start to get diminishing returns.
205219
<br/>Fastest performance is achieved when threadcount is same as your phyical threads on your machine.
206220
Larger the image more effective is the parallelisation.
@@ -226,8 +240,8 @@ You can get and set options to decoder and encoder on runtime. All options API i
226240
...
227241
```
228242

229-
There are many possible options and they are commented on the enum fields as well as required types. If you want more detail search as general H264 options ad params not cisco spesifically.
230-
<br/>Because you wont find any documentation on cisco side.
243+
There are many possible options and they are commented on the enum fields as well as required types. If you want more detail, search as general H264 options.
244+
<br/>Because you wont find any documentation on cisco side RTFC(Read the F. code) pinciple.
231245

232246
If you want to reuse your option structs for efficiency, you can use this method:
233247
```c#
@@ -237,7 +251,8 @@ If you want to reuse your option structs for efficiency, you can use this method
237251
decoder.GetOptionRef(DECODER_OPTION.DECODER_OPTION_GET_STATISTICS, ref ss1);
238252
```
239253
# Example App
240-
A simple example WPF application is provided. here you can explore:
254+
A simple example WPF application is provided. This app involves advanced use cases for the lossy transfers.
255+
here you can explore:
241256
- Advanced Setup and their effects.
242257
- Using LTR references and loss recovery.
243258
- Recording audio and video.

0 commit comments

Comments
 (0)