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/Functions.h"
227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_ImageEm/UInt16BytePyrImage.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_UInt16BytePyrImage_init( struct bbs_Context* cpA,
437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  struct bim_UInt16BytePyrImage* ptrA )
447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_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	ptrA->depthE = 0;
497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->typeE = bim_UINT16_PYRAMIDAL_IMG;
507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_UInt16BytePyrImage_exit( struct bbs_Context* cpA,
557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  struct bim_UInt16BytePyrImage* ptrA )
567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_exit( cpA, &ptrA->arrE );
587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->widthE = 0;
597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->heightE = 0;
607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->depthE = 0;
617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ operators } -------------------------------------------------- */
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_UInt16BytePyrImage_copy( struct bbs_Context* cpA,
747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  struct bim_UInt16BytePyrImage* ptrA,
757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  const struct bim_UInt16BytePyrImage* srcPtrA )
767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG1
787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( ptrA->arrE.allocatedSizeE < srcPtrA->arrE.allocatedSizeE )
797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bbs_ERROR0( "void bim_UInt16BytePyrImage_copy( ... ):\n"
817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				   "Unsufficient allocated memory in destination image" );
827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return;
837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif
857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->widthE = srcPtrA->widthE;
867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->heightE = srcPtrA->heightE;
877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->depthE = srcPtrA->depthE;
887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_copy( cpA, &ptrA->arrE, &srcPtrA->arrE );
897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bim_UInt16BytePyrImage_equal( struct bbs_Context* cpA,
947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								   const struct bim_UInt16BytePyrImage* ptrA,
957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								   const struct bim_UInt16BytePyrImage* srcPtrA )
967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( ptrA->widthE != srcPtrA->widthE ) return FALSE;
987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( ptrA->heightE != srcPtrA->heightE ) return FALSE;
997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( ptrA->depthE != srcPtrA->depthE ) return FALSE;
1007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	return bbs_UInt16Arr_equal( cpA, &ptrA->arrE, &srcPtrA->arrE );
1017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
1027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
1047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
1067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
1077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ query functions } -------------------------------------------- */
1087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
1097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
1107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
1127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint16* bim_UInt16BytePyrImage_arrPtr( struct bbs_Context* cpA,
1147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									   const struct bim_UInt16BytePyrImage* ptrA,
1157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project										 uint32 levelA )
1167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
1177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 iL;
1187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 offsL = 0;
1197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 baseSizeL = ( ptrA->widthE * ptrA->heightE ) >> 1;
1207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG2
1227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( levelA >= ptrA->depthE )
1237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
1247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bbs_ERROR2( "uint16* bim_UInt16BytePyrImage_arrPtr( struct bim_UInt16BytePyrImage*, uint32 levelA ):\n"
1257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			       "levelA = %i out of range [0,%i]", levelA, ptrA->depthE - 1 );
1267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return NULL;
1277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
1287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif
1297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	for( iL = 0; iL < levelA; iL++ )
1317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
1327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		offsL += ( baseSizeL >> ( iL * 2 ) );
1337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
1347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	return ptrA->arrE.arrPtrE + offsL;
1357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
1367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
1387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_UInt16BytePyrImage_heapSize( struct bbs_Context* cpA,
1407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									    const struct bim_UInt16BytePyrImage* ptrA,
1417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project										  uint32 widthA, uint32 heightA,
1427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project										  uint32 depthA )
1437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
1447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 baseSizeL = ( widthA * heightA ) >> 1;
1457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 sizeL = 0;
1467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 iL;
1477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	for( iL = 0; iL < depthA; iL++ )
1487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
1497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		sizeL += ( baseSizeL >> ( iL * 2 ) );
1507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
1517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	return 	bbs_UInt16Arr_heapSize( cpA, &ptrA->arrE, sizeL );
1527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
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/* ---- \ghd{ modify functions } ------------------------------------------- */
1597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
1607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
1617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
1637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_UInt16BytePyrImage_create( struct bbs_Context* cpA,
1657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								    struct bim_UInt16BytePyrImage* ptrA,
1667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									 uint32 widthA, uint32 heightA,
1677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									 uint32 depthA,
1687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								     struct bbs_MemSeg* mspA )
1697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
1707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 baseSizeL = ( widthA * heightA ) >> 1;
1717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 sizeL = 0;
1727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 iL;
1737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( bbs_Context_error( cpA ) ) return;
1757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( ptrA->arrE.arrPtrE != 0 )
1767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
1777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bim_UInt16BytePyrImage_size( cpA, ptrA, widthA, heightA, depthA );
1787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return;
1797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
1807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG1
1827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
1837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		uint32 depthMaskL = ( ( int32 )1 << ( depthA - 1 ) ) - 1;
1847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		if( depthA == 0 )
1857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		{
1867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			bbs_ERROR0( "void bim_UInt16BytePyrImage_create( struct bim_UInt16BytePyrImage* ptrA, uint32 widthA, uint32 heightA, uint32 depthA ):\n"
1877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					   "depthA must be > 0" );
1887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			return;
1897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		}
1907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		if( ( ( widthA & depthMaskL ) > 0 ) || ( ( heightA & depthMaskL ) > 0 ) )
1917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		{
1927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			bbs_ERROR1( "void bim_UInt16BytePyrImage_create( struct bim_UInt16BytePyrImage* ptrA, uint32 widthA, uint32 heightA, uint32 depthA ):\n"
1937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					   "widthA and heightA must be divisible by %i", depthMaskL + 1 );
1947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			return;
1957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		}
1967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
1977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif
1987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->widthE  = widthA;
2007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->heightE = heightA;
2017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->depthE  = depthA;
2027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	for( iL = 0; iL < depthA; iL++ )
2047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
2057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		sizeL += ( baseSizeL >> ( iL * 2 ) );
2067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
2077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_create( cpA, &ptrA->arrE, sizeL, mspA );
2087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
2097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
2117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_UInt16BytePyrImage_size( struct bbs_Context* cpA,
2137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  struct bim_UInt16BytePyrImage* ptrA,
2147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  uint32 widthA,
2157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  uint32 heightA,
2167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								  uint32 depthA )
2177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
2187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 baseSizeL = ( widthA * heightA ) >> 1;
2197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 sizeL = 0;
2207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 iL;
2217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG1
2237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 depthMaskL = ( 1 << ( depthA - 1 ) ) - 1;
2247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( depthA == 0 )
2257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
2267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bbs_ERROR0( "void bim_UInt16BytePyrImage_size( struct bim_UInt16BytePyrImage* ptrA, uint32 widthA, uint32 heightA, uint32 depthA ):\n"
2277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			       "depthA must be > 0" );
2287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return;
2297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
2307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( ( ( widthA & depthMaskL ) > 0 ) || ( ( heightA & depthMaskL ) > 0 ) )
2327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
2337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bbs_ERROR1( "void bim_UInt16BytePyrImage_size( struct bim_UInt16BytePyrImage* ptrA, uint32 widthA, uint32 heightA, uint32 depthA ):\n"
2347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			       "widthA and heightA must be divisible by %i", depthMaskL + 1 );
2357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return;
2367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
2377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif
2387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->widthE  = widthA;
2407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->heightE = heightA;
2417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->depthE  = depthA;
2427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	for( iL = 0; iL < depthA; iL++ )
2447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
2457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		sizeL += ( baseSizeL >> ( iL * 2 ) );
2467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
2477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifdef DEBUG1
2487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( sizeL > ptrA->arrE.allocatedSizeE )
2497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
2507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bbs_ERROR0( "void bim_UInt16BytePyrImage_size( struct bim_UInt16BytePyrImage* ptrA, uint32 widthA, uint32 heightA, uint32 depthA ):\n"
2517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			       "Insufficient allocated memory." );
2527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return;
2537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
2547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif
2557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_size( cpA, &ptrA->arrE, sizeL );
2567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
2577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
2597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
2617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
2627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ I/O } -------------------------------------------------------- */
2637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
2647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
2657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
2677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_UInt16BytePyrImage_memSize( struct bbs_Context* cpA,
2697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									   const struct bim_UInt16BytePyrImage* ptrA )
2707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
2717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	return  bbs_SIZEOF16( uint32 )
2727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		  + bbs_SIZEOF16( uint32 ) /* version */
2737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		  + bbs_SIZEOF16( ptrA->widthE )
2747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		  + bbs_SIZEOF16( ptrA->heightE )
2757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		  + bbs_SIZEOF16( ptrA->depthE )
2767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		  + bbs_UInt16Arr_memSize( cpA, &ptrA->arrE );
2777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
2787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
2807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_UInt16BytePyrImage_memWrite( struct bbs_Context* cpA,
2827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									    const struct bim_UInt16BytePyrImage* ptrA,
2837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project										uint16* memPtrA )
2847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
2857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 memSizeL = bim_UInt16BytePyrImage_memSize( cpA, ptrA );
2867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memWrite32( &memSizeL, memPtrA );
2877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memWriteUInt32( bim_UINT16_PYRAMIDAL_IMAGE_VERSION, memPtrA );
2887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memWrite32( &ptrA->widthE, memPtrA );
2897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memWrite32( &ptrA->heightE, memPtrA );
2907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memWrite32( &ptrA->depthE, memPtrA );
2917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_memWrite( cpA, &ptrA->arrE, memPtrA );
2927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	return memSizeL;
2937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
2947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
2967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
2977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bim_UInt16BytePyrImage_memRead( struct bbs_Context* cpA,
2987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									   struct bim_UInt16BytePyrImage* ptrA,
2997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									    const uint16* memPtrA,
3007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 									    struct bbs_MemSeg* mspA )
3017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
3027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 memSizeL, versionL, widthL, heightL, depthL;
3037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( bbs_Context_error( cpA ) ) return 0;
3047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memRead32( &memSizeL, memPtrA );
3057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memReadVersion32( cpA, &versionL, bim_UINT16_PYRAMIDAL_IMAGE_VERSION, memPtrA );
3067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memRead32( &widthL, memPtrA );
3077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memRead32( &heightL, memPtrA );
3087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	memPtrA += bbs_memRead32( &depthL, memPtrA );
3097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->widthE  = widthL;
3117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->heightE = heightL;
3127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	ptrA->depthE  = depthL;
3137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_UInt16Arr_memRead( cpA, &ptrA->arrE, memPtrA, mspA );
3147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	if( memSizeL != bim_UInt16BytePyrImage_memSize( cpA, ptrA ) )
3167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
3177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		bbs_ERR0( bbs_ERR_CORRUPT_DATA, "uint32 bim_UInt16BytePyrImage_memRead( const struct bim_UInt16BytePyrImage* ptrA, const void* memPtrA ):\n"
3187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project                   "size mismatch" );
3197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		return 0;
3207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
3217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	return memSizeL;
3237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
3247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
3267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
3287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
3297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ exec functions } --------------------------------------------- */
3307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*                                                                           */
3317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
3327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_UInt16BytePyrImage_overlayUInt16( struct bbs_Context* cpA,
3347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project										   const struct bim_UInt16BytePyrImage* ptrA,
3357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project											 struct bim_UInt16ByteImage* uint16ImageA )
3367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
3377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16ImageA->widthE = ptrA->widthE;
3387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16ImageA->heightE = ptrA->heightE;
3397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16ImageA->arrE.sizeE = ptrA->widthE * ptrA->heightE;
3407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16ImageA->arrE.allocatedSizeE = ptrA->widthE * ptrA->heightE;
3417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16ImageA->arrE.arrPtrE = ptrA->arrE.arrPtrE;
3427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16ImageA->arrE.mspE = 0;
3437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
3447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
3467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** process remaining layers */
3487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_UInt16BytePyrImage_recompute( struct bbs_Context* cpA,
3497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project									   struct bim_UInt16BytePyrImage* dstPtrA )
3507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
3517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	count_t iL, jL, layerL;
3527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16 tmpL;
3537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 widthL = dstPtrA->widthE;
3557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 halfWidthL = widthL >> 1;
3567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 heightL = dstPtrA->heightE;
3577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16* srcL = dstPtrA->arrE.arrPtrE;
3597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint16* dstL = srcL + ( heightL * halfWidthL );
3607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	for( layerL = 1; layerL < dstPtrA->depthE; layerL++ )
3617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	{
3627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		for( jL = ( heightL >> 1 ); jL > 0; jL-- )
3637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		{
3647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			for( iL = ( halfWidthL >> 1 ); iL > 0; iL-- )
3657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			{
3667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				/* averaging with rounding */
3677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					tmpL = ( ( *srcL & 0x0FF ) + ( *srcL >> 8 ) + ( *( srcL + halfWidthL ) & 0x0FF ) +
3687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							 ( *( srcL + halfWidthL ) >> 8 ) + 2 ) >> 2;
3697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				#ifdef HW_BIG_ENDIAN
3707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					*dstL = tmpL << 8;
3717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				#else
3727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					*dstL = tmpL;
3737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				#endif
3747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				srcL++;
3757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					tmpL = ( ( *srcL & 0x0FF ) + ( *srcL >> 8 ) + ( *( srcL + halfWidthL ) & 0x0FF ) +
3777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							 ( *( srcL + halfWidthL ) >> 8 ) + 2 ) >> 2;
3787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				#ifdef HW_BIG_ENDIAN
3797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					*dstL |= tmpL;
3807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				#else
3817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					*dstL |= tmpL << 8;
3827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				#endif
3837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				srcL++;
3847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project				dstL++;
3857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			}
3867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project			srcL += halfWidthL;
3877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		}
3887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		halfWidthL >>= 1;
3897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project		heightL >>= 1;
3907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	}
3917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
3927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
3957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
3977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bim_UInt16BytePyrImage_importUInt16( struct bbs_Context* cpA,
3987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project										  struct bim_UInt16BytePyrImage* dstPtrA,
3997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project											const struct bim_UInt16ByteImage* srcPtrA,
4007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project											uint32 depthA )
4017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
4027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bim_UInt16BytePyrImage_size( cpA, dstPtrA, srcPtrA->widthE, srcPtrA->heightE, depthA );
4047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* copy first layer */
4067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_memcpy16( dstPtrA->arrE.arrPtrE, srcPtrA->arrE.arrPtrE, srcPtrA->arrE.sizeE );
4077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bim_UInt16BytePyrImage_recompute( cpA, dstPtrA );
4097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}
4107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ------------------------------------------------------------------------- */
4137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ========================================================================= */
4157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
4167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
417