[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51137] trunk/blender/source/blender: patch [#32556] Stupid endian conversion in avi format
Campbell Barton
ideasman42 at gmail.com
Sun Oct 7 08:06:29 CEST 2012
Revision: 51137
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51137
Author: campbellbarton
Date: 2012-10-07 06:06:28 +0000 (Sun, 07 Oct 2012)
Log Message:
-----------
patch [#32556] Stupid endian conversion in avi format
from Andreas Schwab (schwab)
modified to use code from BLI_endian_switch.
Modified Paths:
--------------
trunk/blender/source/blender/avi/intern/endian.c
trunk/blender/source/blender/blenlib/BLI_endian_switch_inline.h
Modified: trunk/blender/source/blender/avi/intern/endian.c
===================================================================
--- trunk/blender/source/blender/avi/intern/endian.c 2012-10-07 04:21:37 UTC (rev 51136)
+++ trunk/blender/source/blender/avi/intern/endian.c 2012-10-07 06:06:28 UTC (rev 51137)
@@ -46,31 +46,22 @@
#endif
#ifdef __BIG_ENDIAN__
+
+/* copied from BLI_endian_switch_inline.h */
static void invert(int *num)
{
- int new = 0, i, j;
-
- for (j = 0; j < 4; j++) {
- for (i = 0; i < 8; i++) {
- new |= ((*num >> (j * 8 + i)) & 1) << ((3 - j) * 8 + i);
- }
- }
-
- *num = new;
+ int tval = *val;
+ *val = ((tval >> 24)) |
+ ((tval << 8) & 0x00ff0000) |
+ ((tval >> 8) & 0x0000ff00) |
+ ((tval << 24));
}
-static void sinvert(short int *num)
+static void sinvert(short int *val)
{
- short int new = 0;
- int i, j;
-
- for (j = 0; j < 2; j++) {
- for (i = 0; i < 8; i++) {
- new |= ((*num >> (j * 8 + i)) & 1) << ((1 - j) * 8 + i);
- }
- }
-
- *num = new;
+ short tval = *val;
+ *val = (tval >> 8) |
+ (tval << 8);
}
static void Ichunk(AviChunk *chunk)
Modified: trunk/blender/source/blender/blenlib/BLI_endian_switch_inline.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_endian_switch_inline.h 2012-10-07 04:21:37 UTC (rev 51136)
+++ trunk/blender/source/blender/blenlib/BLI_endian_switch_inline.h 2012-10-07 06:06:28 UTC (rev 51137)
@@ -40,7 +40,7 @@
{
short tval = *val;
*val = (tval >> 8) |
- (tval << 8);
+ (tval << 8);
}
BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val)
More information about the Bf-blender-cvs
mailing list