A linked list would allow the add, but copying from it will be a perf hit,
so that may be of no use. How are you getting frame data now? If you can
"get" it into the second byte of your array, then you could simply set the
first. Some massaging of the P/Invoke may be able to do that.
--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
"Lionel Reyero" <(E-Mail Removed)> wrote in message
news:B85F3058-35C2-4B5B-9DBD-(E-Mail Removed)...
>
> Hi,
>
> In my C# video streaming app, I have to write a video frame to a socket.
> In
> the socket I write video packet, which are composed of a 5 bytes header,
> followed by the video frame bytes. My question is all about how to
> create
> the packet (adding the 5 bytes header to the bytes of the frame) the most
> efficiently.
>
> The video frame is a ushort[], precisely : ushort[19200]
> And I need the packet : byte[38405], with the byte 0-5 being the header,
> and the rest being the frame data.
>
> So I have 2 issues : adding the header, converting the ushort to bytes.
>
> I am doing the copy of the ushort to the right place of the packet, by
> using
> memory pointers (in unsage block) which I cast to bytes.
>
> It is working good, but it is taking approximately 7 ms.
> I would like to reduce this time... so I have two questios :
>
> - How can I "cast", "convert", or "copy" the ushort[] frame data to the
> byte[] packet ? Faster than what I already do
>
> - Is it possible to add/insert the header bytes at the begining of the
> ushort[] so that I do not need to copy the entire frame data.. ?
> I find it stupid to copy the whole video data, simply to add a small
> header... but I can't see how I can do it differently.... do you ?
>
> Thanks a lot!
>
> Lionel Reyero