[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50248] branches/soc-2011-tomato: Merging r50245 through r50247 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Mon Aug 27 14:00:40 CEST 2012


Revision: 50248
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50248
Author:   nazgul
Date:     2012-08-27 12:00:39 +0000 (Mon, 27 Aug 2012)
Log Message:
-----------
Merging r50245 through r50247 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50245
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50247

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/imbuf/intern/bmp.c
    branches/soc-2011-tomato/source/blender/imbuf/intern/jp2.c
    branches/soc-2011-tomato/source/blender/imbuf/intern/util.c

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-50244
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-50247


Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-50244
   + /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-50247


Property changes on: branches/soc-2011-tomato/source/blender/editors/space_outliner
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-50244
   + /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-50247

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/bmp.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/bmp.c	2012-08-27 11:59:26 UTC (rev 50247)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/bmp.c	2012-08-27 12:00:39 UTC (rev 50248)
@@ -69,16 +69,25 @@
 
 static int checkbmp(unsigned char *mem)
 {
+#define CHECK_HEADER_FIELD(mem, field) ((mem[0] == field[0]) && (mem[1] == field[0]))
+
 	int ret_val = 0;
 	BMPINFOHEADER bmi;
 	unsigned int u;
 
 	if (mem) {
-		if ((mem[0] == 'B') && (mem[1] == 'M')) {
+		if (CHECK_HEADER_FIELD(mem, "BM") ||
+		    CHECK_HEADER_FIELD(mem, "BA") ||
+		    CHECK_HEADER_FIELD(mem, "CI") ||
+		    CHECK_HEADER_FIELD(mem, "CP") ||
+		    CHECK_HEADER_FIELD(mem, "IC") ||
+		    CHECK_HEADER_FIELD(mem, "PT"))
+		{
 			/* skip fileheader */
 			mem += BMP_FILEHEADER_SIZE;
 		}
 		else {
+			return 0;
 		}
 
 		/* for systems where an int needs to be 4 bytes aligned */
@@ -97,6 +106,8 @@
 	}
 
 	return(ret_val);
+
+#undef CHECK_HEADER_FIELD
 }
 
 int imb_is_a_bmp(unsigned char *buf)

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/jp2.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/jp2.c	2012-08-27 11:59:26 UTC (rev 50247)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/jp2.c	2012-08-27 12:00:39 UTC (rev 50248)
@@ -41,6 +41,7 @@
 #define JP2_FILEHEADER_SIZE 14
 
 static char JP2_HEAD[] = {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
+static char J2K_HEAD[] = {0xFF, 0x4F, 0xFF, 0x51, 0x00};
 
 /* We only need this because of how the presets are set */
 /* this typedef is copied from 'openjpeg-1.5.0/applications/codec/image_to_j2k.c' */
@@ -59,15 +60,19 @@
 
 static int check_jp2(unsigned char *mem) /* J2K_CFMT */
 {
-	return memcmp(JP2_HEAD, mem, 12) ? 0 : 1;
+	return memcmp(JP2_HEAD, mem, sizeof(JP2_HEAD)) ? 0 : 1;
 }
 
+static int check_j2k(unsigned char *mem) /* J2K_CFMT */
+{
+	return memcmp(J2K_HEAD, mem, sizeof(J2K_HEAD)) ? 0 : 1;
+}
+
 int imb_is_a_jp2(unsigned char *buf)
-{	
+{
 	return check_jp2(buf);
 }
 
-
 /**
  * sample error callback expecting a FILE* client object
  */
@@ -116,6 +121,7 @@
 	unsigned int i, i_next, w, h, planes;
 	unsigned int y;
 	int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */
+	int is_jp2, is_j2k;
 	
 	opj_dparameters_t parameters;   /* decompression parameters */
 	
@@ -125,8 +131,12 @@
 	opj_dinfo_t *dinfo = NULL;  /* handle to a decompressor */
 	opj_cio_t *cio = NULL;
 
-	if (check_jp2(mem) == 0) return(NULL);
+	is_jp2 = check_jp2(mem);
+	is_j2k = check_j2k(mem);
 
+	if (!is_jp2 && !is_j2k)
+		return(NULL);
+
 	/* configure the event callbacks (not required) */
 	memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
 	event_mgr.error_handler = error_callback;
@@ -141,7 +151,7 @@
 	/* JPEG 2000 compressed image data */
 
 	/* get a decoder handle */
-	dinfo = opj_create_decompress(CODEC_JP2);
+	dinfo = opj_create_decompress(is_jp2 ? CODEC_JP2 : CODEC_J2K);
 
 	/* catch events using our callbacks and give a local context */
 	opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/util.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/util.c	2012-08-27 11:59:26 UTC (rev 50247)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/util.c	2012-08-27 12:00:39 UTC (rev 50248)
@@ -83,6 +83,7 @@
 #endif
 #ifdef WITH_OPENJPEG
 	".jp2",
+	".j2c",
 #endif
 #ifdef WITH_HDR
 	".hdr",




More information about the Bf-blender-cvs mailing list