Of course inline! Actually you can remove the masking for the 24 bit shifts. For the inner two bytes I don't see an improvement. Thanks Gary for the follow up :) Jürgen Eidt http://cpicture.de/en
Jurgen Eidt 0
Posts
-
swap bytes in a ushort/ulong -
swap bytes in a ushort/ulongThanks Gary, that a good way to do it! Jürgen Eidt http://cpicture.de/en
-
swap bytes in a ushort/ulongDidn't thought of a union :) But even swapping with the xor trick I'm not sure how the compiler optimization would be. I guess looking at the asm code would make the final judgement. Thanks. Jürgen Eidt http://cpicture.de/en
-
swap bytes in a ushort/ulongWhat is the fasted way to swap bytes in a ushort/ulong? For example: 0x1234 -> 0x3412 0x12345678 -> 0x78563412
unsigned short short_exch(const unsigned short a) { // 0x1234 -> 0x3412 return (a << 8) + (a >> 8); }; unsigned long long_exch(unsigned long a) { // 0x12345678 -> 0x78563412 unsigned long t = a&0xff; a >>= 8; t <<= 8; t += a&0xff; a >>= 8; t <<= 8; t += a&0xff; a >>= 8; t <<= 8; return t + a; };
Jürgen Eidt http://cpicture.de/en
-
online payment processors...Interesting topic. I have been searching for month to find a service that can send out registration keys that are not made out of some numbers and letters. No one is able to use a tool provided by the client (that would be the author) to generate the keys. Does someone know a service that can handle this? Jürgen cpicture.de
-
First frame of an compressed AVIThanks for your suggestion. I just wanted to give the icons in my listview a small preview of the AVI files from my camera :) Wouldn't introducing DirectShow to an app make a dependency on the DirectShow components installed on the system? For example I use the latest version of DirectShow but the system has an older version installed? Thanks Jürgen
-
First frame of an compressed AVIDoes anyone know how to get the first frame of an compressed AVI? Using the AVI-APIs the AVIStreamGetFrameOpen is returning a NULL when the video stream is compressed. Works fine for non compressed videos. I also tried the suggestion from Jung Jinhyuck ( http://www.codeproject.com/audio/avitowmv.asp ) which looked very promising. Looks like the decompression is not done, but the same compressed AVI can be viewed with the Media player on the same machine. Thought the AVI-API could access the same decompressors. (Using WinXP and VC .NET) Thanks Jürgen