17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* 27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * you may not use this file except in compliance with the License. 67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * You may obtain a copy of the License at 77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software 117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * See the License for the specific language governing permissions and 147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * limitations under the License. 157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- includes ----------------------------------------------------------- */ 187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Math.h" 207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Functions.h" 217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_ImageEm/APhImage.h" 227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_ImageEm/ComplexImage.h" 237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ auxiliary functions } ---------------------------------------- */ 297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ constructor / destructor } ----------------------------------- */ 377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_init( struct bbs_Context* cpA, 437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA ) 447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_init( cpA, &ptrA->arrE ); 467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->widthE = 0; 477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->heightE = 0; 487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_create( struct bbs_Context* cpA, 537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA, 547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 widthA, 557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 heightA, 567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_MemSeg* mspA ) 577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( bbs_Context_error( cpA ) ) return; 597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ptrA->arrE.arrPtrE != 0 ) 607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bim_APhImage_size( cpA, ptrA, widthA, heightA ); 627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project else 647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_create( cpA, &ptrA->arrE, widthA * heightA, mspA ); 667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->widthE = widthA; 677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->heightE = heightA; 687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_exit( struct bbs_Context* cpA, 747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA ) 757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_exit( cpA, &ptrA->arrE ); 777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->widthE = 0; 787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->heightE = 0; 797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ operators } -------------------------------------------------- */ 867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_copy( struct bbs_Context* cpA, 927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA, 937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_APhImage* srcPtrA ) 947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG1 967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ptrA->arrE.allocatedSizeE < srcPtrA->arrE.allocatedSizeE ) 977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_ERROR0( "void bim_APhImage_copy( struct bim_APhImage*, uint32 sizeA ):\n" 997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project "Unsufficient allocated memory" ); 1007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return; 1017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 1027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif 1037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->widthE = srcPtrA->widthE; 1047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->heightE = srcPtrA->heightE; 1057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_copy( cpA, &ptrA->arrE, &srcPtrA->arrE ); 1067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bim_APhImage_equal( struct bbs_Context* cpA, 1117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_APhImage* ptrA, 1127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_APhImage* srcPtrA ) 1137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ptrA->widthE != srcPtrA->widthE ) return FALSE; 1157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ptrA->heightE != srcPtrA->heightE ) return FALSE; 1167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return bbs_APhArr_equal( cpA, &ptrA->arrE, &srcPtrA->arrE ); 1177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ query functions } -------------------------------------------- */ 1247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ modify functions } ------------------------------------------- */ 1327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_size( struct bbs_Context* cpA, 1387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA, 1397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 widthA, 1407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 heightA ) 1417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG1 1437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( ptrA->arrE.allocatedSizeE < widthA * heightA ) 1447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 1457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_ERROR0( "void bim_APhImage_size( struct bim_APhImage*, uint32 sizeA ):\n" 1467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project "Unsufficient allocated memory" ); 1477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return; 1487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 1497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif 1507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->widthE = widthA; 1517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->heightE = heightA; 1527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_size( cpA, &ptrA->arrE, widthA * heightA ); 1537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ I/O } -------------------------------------------------------- */ 1607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 1617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 1627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_APhImage_memSize( struct bbs_Context* cpA, 1667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_APhImage* ptrA ) 1677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return bbs_SIZEOF16( uint32 ) 1697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project + bbs_SIZEOF16( uint32 ) /* version */ 1707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project + bbs_SIZEOF16( ptrA->widthE ) 1717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project + bbs_SIZEOF16( ptrA->heightE ) 1727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project + bbs_APhArr_memSize( cpA, &ptrA->arrE ); 1737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_APhImage_memWrite( struct bbs_Context* cpA, 1787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_APhImage* ptrA, 1797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint16* memPtrA ) 1807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 memSizeL = bim_APhImage_memSize( cpA, ptrA ); 1827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memWrite32( &memSizeL, memPtrA ); 1837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memWriteUInt32( bim_APH_IMAGE_VERSION, memPtrA ); 1847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memWrite32( &ptrA->widthE, memPtrA ); 1857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memWrite32( &ptrA->heightE, memPtrA ); 1867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_memWrite( cpA, &ptrA->arrE, memPtrA ); 1877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return memSizeL; 1887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 1897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 1917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_APhImage_memRead( struct bbs_Context* cpA, 1937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA, 1947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const uint16* memPtrA, 1957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_MemSeg* mspA ) 1967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 1977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 memSizeL, widthL, heightL, versionL; 1987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( bbs_Context_error( cpA ) ) return 0; 1997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memRead32( &memSizeL, memPtrA ); 2007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memReadVersion32( cpA, &versionL, bim_APH_IMAGE_VERSION, memPtrA ); 2017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memRead32( &widthL, memPtrA ); 2027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project memPtrA += bbs_memRead32( &heightL, memPtrA ); 2037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->widthE = widthL; 2057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ptrA->heightE = heightL; 2067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APhArr_memRead( cpA, &ptrA->arrE, memPtrA, mspA ); 2077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( memSizeL != bim_APhImage_memSize( cpA, ptrA ) ) 2097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 2107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_ERR0( bbs_ERR_CORRUPT_DATA, "uint32 bim_APhImage_memRead( const struct bim_APhImage*, const void* ):\n" 2117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project "size mismatch" ); 2127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return 0; 2137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 2147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project return memSizeL; 2157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 2207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 2217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ exec functions } --------------------------------------------- */ 2227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* */ 2237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 2247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_setAllPixels( struct bbs_Context* cpA, 2287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA, 2297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_APh valueA ) 2307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 2317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project long iL; 2327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_APh* ptrL = ptrA->arrE.arrPtrE; 2337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( iL = ptrA->widthE * ptrA->heightE; iL > 0; iL-- ) 2347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 2357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *ptrL++ = valueA; 2367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 2377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 2387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 2407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** 2427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | (loop x1) | (loop x2) | (loop x3) | 2447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project o------------->-o------------>--o------------->-o 2457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ( sectionL->x1E, sectionL->y1E ) | | 2507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project---------o- R-------------------------------|---------------- 2517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project (loop y1)| | | | 2567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project V | | | | 2587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | |( 0, 0 ) | | X 2597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project---------o------------------I-------------------------------------------------> 2607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project (loop y2)| | | | 2667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project V | | | | 2707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | | 2717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project---------o------------------|---------------I | 2727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | ( srcPtrA->widthE, srcPtrA->heightE ) 2737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project (loop y3)| | | 2797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project V | | | 2827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | | | | 2837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project---------o--------------------------------------------------R 2847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | ( sectionL->x2E, sectionL->y2E ) 2857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | 2867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project Y | 2877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | 2887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project | 2897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project V 2907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project To understand how the algorithm work refer to the diagram above. 2927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project The image boundaries are indicated by letter "I" ( 0, 0 ) to ( srcPtrA->widthE, srcPtrA->heightE ) 2937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project The rectangle boundaries are indicated by letter "R" ( sectionPtrA->x1E, sectionPtrA->y1E ) to ( sectionPtrA->x2E, sectionPtrA->y2E ) 2947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project In the above example the intersection of the image and the rectange is 2967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project ( 0, 0 ), ( srcPtrA->widthE, srcPtrA->heightE ) 2977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project The size of the destination image is always ( ( sectionL->x2E, sectionL->y2E ) - ( sectionL->x1E, sectionL->y1E ) ) 2997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project All coordinates are assumed to be relative to the original image. 3017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1. parse all pixels in "loop y1" 3037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1.a. parse all pixels in "loop x1" 3047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1.b. parse all pixels in "loop x2" 3057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1.c. parse all pixels in "loop x3" 3067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2. parse all pixels in "loop y2" 3077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2.a. parse all pixels in "loop x1" 3087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2.b. parse all pixels in "loop x2" 3097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 2.c. parse all pixels in "loop x3" 3107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3. parse all pixels in "loop y3" 3117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3.a. parse all pixels in "loop x1" 3127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3.b. parse all pixels in "loop x2" 3137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3.c. parse all pixels in "loop x3" 3147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project*/ 3167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** copies a section of given image */ 3187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_copySection( struct bbs_Context* cpA, 3197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* ptrA, 3207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_APhImage* srcPtrA, 3217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bts_Int16Rect* sectionPtrA ) 3227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 3237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_APh* srcPixelPtrL; 3257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_APh* dstPixelPtrL; 3267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 yIndexL; 3277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project int32 xIndexL; 3287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Int16Rect srcImageSubSectionL; 3307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bts_Int16Rect sectionL; 3317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* make sure that the rectangle passed is correct, in case the x2 < x1 or y2 < y1, swap them */ 3337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project sectionL.x1E = bbs_min( sectionPtrA->x1E, sectionPtrA->x2E ); 3347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project sectionL.x2E = bbs_max( sectionPtrA->x1E, sectionPtrA->x2E ); 3357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project sectionL.y1E = bbs_min( sectionPtrA->y1E, sectionPtrA->y2E ); 3367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project sectionL.y2E = bbs_max( sectionPtrA->y1E, sectionPtrA->y2E ); 3377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* find the intersection betweem the rectangle and the image, the image always starts at 0,0 */ 3397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.x1E = bbs_max( 0, sectionL.x1E ); 3407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.y1E = bbs_max( 0, sectionL.y1E ); 3417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.x2E = bbs_min( ( int32 ) srcPtrA->widthE, sectionL.x2E ); 3427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.y2E = bbs_min( ( int32 ) srcPtrA->heightE, sectionL.y2E ); 3437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* If the image and the rectangle do not intersect in X direction, set the intersecting rectangle to the image coordinates */ 3457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( srcImageSubSectionL.x2E < srcImageSubSectionL.x1E ) 3467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.x1E = 0; 3487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.x2E = srcPtrA->widthE; 3497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* do the same as above in the Y direction */ 3517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project if( srcImageSubSectionL.y2E < srcImageSubSectionL.y1E ) 3527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.y1E = 0; 3547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcImageSubSectionL.y2E = srcPtrA->heightE; 3557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* set size, and allocate required memory for the destination image if required */ 3587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bim_APhImage_size( cpA, ptrA, sectionL.x2E - sectionL.x1E, sectionL.y2E - sectionL.y1E ); 3597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* get the pointer to the destination image */ 3617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project dstPixelPtrL = ptrA->arrE.arrPtrE; 3627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 1. parse all pixels in "loop y1" */ 3647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( yIndexL = sectionL.y1E; yIndexL < srcImageSubSectionL.y1E && yIndexL < sectionL.y2E; yIndexL++ ) 3657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* move to the first pixel that needs to be copied. */ 3677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcPixelPtrL = srcPtrA->arrE.arrPtrE; 3687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 1.a. parse all pixels in "loop x1" */ 3707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( xIndexL = sectionL.x1E; xIndexL < srcImageSubSectionL.x1E && xIndexL < sectionL.x2E; xIndexL++ ) 3717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL; 3737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 1.b. parse all pixels in "loop x2" */ 3757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; xIndexL < srcImageSubSectionL.x2E && xIndexL < sectionL.x2E; xIndexL++ ) 3767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL++; 3787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcPixelPtrL--; 3807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 1.c. parse all pixels in "loop x3" */ 3817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; xIndexL < sectionL.x2E; xIndexL++ ) 3827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL; 3847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 2. parse all pixels in "loop y2" */ 3877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; yIndexL < srcImageSubSectionL.y2E && yIndexL < sectionL.y2E; yIndexL++ ) 3887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* move to the first pixel that needs to be copied. */ 3907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcPixelPtrL = srcPtrA->arrE.arrPtrE + yIndexL * srcPtrA->widthE + srcImageSubSectionL.x1E; 3917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 3927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 2.a. parse all pixels in "loop x1" */ 3937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( xIndexL = sectionL.x1E; xIndexL < srcImageSubSectionL.x1E && xIndexL < sectionL.x2E; xIndexL++ ) 3947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 3957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL; 3967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 3977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 2.b. parse all pixels in "loop x2" */ 3987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; xIndexL < srcImageSubSectionL.x2E && xIndexL < sectionL.x2E; xIndexL++ ) 3997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL++; 4017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcPixelPtrL--; 4037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 2.c. parse all pixels in "loop x3" */ 4047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; xIndexL < sectionL.x2E; xIndexL++ ) 4057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL; 4077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 3. parse all pixels in "loop y3" */ 4107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; yIndexL < sectionL.y2E; yIndexL++ ) 4117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcPixelPtrL = srcPtrA->arrE.arrPtrE + ( srcImageSubSectionL.y2E - 1 ) * srcPtrA->widthE + srcImageSubSectionL.x1E; 4137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 3.a. parse all pixels in "loop x1" */ 4157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( xIndexL = sectionL.x1E; xIndexL < srcImageSubSectionL.x1E && xIndexL < sectionL.x2E; xIndexL++ ) 4167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL; 4187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 3.b. parse all pixels in "loop x3" */ 4207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; xIndexL < srcImageSubSectionL.x2E && xIndexL < sectionL.x2E; xIndexL++ ) 4217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL++; 4237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcPixelPtrL--; 4257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* 3.c. parse all pixels in "loop x3" */ 4267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( ; xIndexL < sectionL.x2E; xIndexL++ ) 4277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *dstPixelPtrL++ = *srcPixelPtrL; 4297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 4337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 4357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_APhImage_importComplex( struct bbs_Context* cpA, 4377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bim_APhImage* dstPtrA, 4387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bim_ComplexImage* srcPtrA ) 4397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 4407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project long iL; 4417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_APh* dstL; 4427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bbs_Complex* srcL; 4437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bim_APhImage_size( cpA, dstPtrA, srcPtrA->widthE, srcPtrA->heightE ); 4447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project dstL = dstPtrA->arrE.arrPtrE; 4457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project srcL = srcPtrA->arrE.arrPtrE; 4467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project for( iL = srcPtrA->widthE * srcPtrA->heightE; iL > 0; iL-- ) 4477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project { 4487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project bbs_APh_importComplex( dstL++, srcL++ ); 4497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project } 4507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project} 4517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */ 4537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */ 4557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 4567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 457