Home | History | Annotate | Download | only in b_BitFeatureEm

Lines Matching full:ptra

35 							 struct bbf_LocalScanner* ptrA, 
43 uint32 proL = ptrA->maxRadiusE;
47 uint32 woL = ptrA->maxImageWidthE;
48 uint32 hoL = ptrA->maxImageHeightE;
50 if( ptrA->minScaleExpE > 0 )
53 bbs_UInt8Arr_create( cpA, &ptrA->workImageBufferE, ( woL >> 1 ) * ( hoL >> 1 ), espL );
54 bbs_UInt8Arr_fill( cpA, &ptrA->workImageBufferE, 0 );
58 bim_UInt32Image_create( cpA, &ptrA->bitImageE, woL, ( hoL >> 5 ) + ( ( ( hoL & 0x1F ) != 0 ) ? 1 : 0 ), espL );
59 bim_UInt32Image_setAllPixels( cpA, &ptrA->bitImageE, 0, 0 );
62 bbs_UInt32Arr_create( cpA, &ptrA->patchBufferE, ptrA->bitImageE.widthE, espL );
63 bbs_UInt32Arr_fill( cpA, &ptrA->patchBufferE, 0 );
66 bim_UInt32Image_create( cpA, &ptrA->satE, woL + pwoL, pwoL + 1, sspL );
72 void bbf_LocalScanner_downscale0( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
74 int32 w0L = ptrA->origWidthE;
75 int32 h0L = ptrA->origHeightE;
77 int32 w1L = ( w0L - ptrA->xOffE ) >> 1;
78 int32 h1L = ( h0L - ptrA->yOffE ) >> 1;
80 const uint8* iArrL = ptrA->origImagePtrE + ptrA->xOffE + ptrA->yOffE * w0L;
81 uint8* oArrL = ptrA->workImageBufferE.arrPtrE;
86 bbs_UInt8Arr_size( cpA, &ptrA->workImageBufferE, w1L * h1L );
87 ptrA->workImagePtrE = ptrA->workImageBufferE.arrPtrE;
88 ptrA->workWidthE = w1L;
89 ptrA->workHeightE = h1L;
107 void bbf_LocalScanner_downscale1( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
109 int32 w0L = ptrA->workWidthE;
110 int32 h0L = ptrA->workHeightE;
114 uint8* arrL = ptrA->workImageBufferE.arrPtrE;
131 ptrA->workWidthE = w1L;
132 ptrA->workHeightE = h1L;
138 void bbf_LocalScanner_downscale( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
141 if( ptrA->scaleExpE > 0 ) bbf_LocalScanner_downscale0( cpA, ptrA );
142 for( iL = 1; iL < ptrA->scaleExpE; iL++ ) bbf_LocalScanner_downscale1( cpA, ptrA );
148 void bbf_LocalScanner_createBitImage( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
150 bbs_DEF_fNameL( "void bbf_LocalScanner_createBitImage( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )" )
154 uint32 proL = ptrA->bitParamE.outerRadiusE;
155 uint32 priL = ptrA->bitParamE.innerRadiusE;
184 wL = ptrA->workWidthE;
185 hL = ptrA->workHeightE;
193 ptrA->currentWidthE = wL;
194 ptrA->currentHeightE = hL;
197 ptrA->workScanRegionE = bts_Int16Rect_create( 0, 0, ptrA->currentWidthE, ptrA->currentHeightE );
200 bim_UInt32Image_size( cpA, &ptrA->bitImageE, wL, ( hL >> 5 ) + ( ( ( hL & 0x1F ) != 0 ) ? 1 : 0 ) );
201 bim_UInt32Image_setAllPixels( cpA, &ptrA->bitImageE, 0, 0 );
204 bitRowL = ( uint32* )ptrA->bitImageE.arrE.arrPtrE;
212 bim_UInt32Image_size( cpA, &ptrA->satE, wsL, hsL );
214 satL = ( uint32* )ptrA->satE.arrE.arrPtrE;
215 satSizeL = ptrA->satE.arrE.sizeE;
225 const uint8* arr0L = &ptrA->workImagePtrE[ jL * wL ];
281 void bbf_LocalScanner_initPatchBuffer( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
283 int32 ybL = ptrA->workScanRegionE.y1E >> 5;
284 int32 yoL = ptrA->workScanRegionE.y1E & 0x1F;
285 int32 xbL = ptrA->workScanRegionE.x1E;
286 uint32 wsrWidthL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E;
288 bbs_UInt32Arr_size( cpA, &ptrA->patchBufferE, ptrA->bitImageE.widthE );
292 bbs_memcpy32( ptrA->patchBufferE.arrPtrE + xbL,
293 ptrA->bitImageE.arrE.arrPtrE + ybL * ptrA->bitImageE.widthE + xbL,
296 else if( ybL == ( int32 )ptrA->bitImageE.heightE - 1 )
298 uint32* dstL = ptrA->patchBufferE.arrPtrE + xbL;
299 const uint32* srcL = ptrA->bitImageE.arrE.arrPtrE + ybL * ptrA->bitImageE.widthE + xbL;
305 uint32* dstL = ptrA->patchBufferE.arrPtrE + xbL;
306 const uint32* src0L = ptrA->bitImageE.arrE.arrPtrE + ybL * ptrA->bitImageE.widthE + xbL;
307 const uint32* src1L = src0L + ptrA->bitImageE.widthE;
317 void bbf_LocalScanner_setWorkScanRegion( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
319 int32 xMinL = ptrA->origScanRegionE.x1E >> ptrA->scaleExpE;
320 int32 yMinL = ptrA->origScanRegionE.y1E >> ptrA->scaleExpE;
321 int32 xMaxL = ptrA->origScanRegionE.x2E >> ptrA->scaleExpE;
322 int32 yMaxL = ptrA->origScanRegionE.y2E >> ptrA->scaleExpE;
323 ptrA->workScanRegionE.x1E = ( xMinL < 0 ) ? 0 : xMinL;
324 ptrA->workScanRegionE.y1E = ( yMinL < 0 ) ? 0 : yMinL;
325 ptrA->workScanRegionE.x2E = ( xMaxL > ( int32 )ptrA->currentWidthE ) ? ptrA->currentWidthE : xMaxL;
326 ptrA->workScanRegionE.y2E = ( yMaxL > ( int32 )ptrA->currentHeightE ) ? ptrA->currentHeightE : yMaxL;
340 struct bbf_LocalScanner* ptrA )
342 ptrA->xE = 0;
343 ptrA->yE = 0;
344 ptrA->xOffE = 0;
345 ptrA->yOffE = 0;
346 ptrA->currentWidthE = 0;
347 ptrA->currentHeightE = 0;
348 ptrA->workWidthE = 0;
349 ptrA->workHeightE = 0;
350 ptrA->workImagePtrE = NULL;
351 ptrA->origWidthE = 0;
352 ptrA->origHeightE = 0;
353 ptrA->origImagePtrE = NULL;
354 bbf_BitParam_init( cpA, &ptrA->bitParamE );
355 bbs_UInt8Arr_init( cpA, &ptrA->workImageBufferE );
356 bim_UInt32Image_init( cpA, &ptrA->satE );
357 bim_UInt32Image_init( cpA, &ptrA->bitImageE );
358 bbs_UInt32Arr_init( cpA, &ptrA->patchBufferE );
359 bts_Int16Rect_init( cpA, &ptrA->origScanRegionE );
360 bts_Int16Rect_init( cpA, &ptrA->workScanRegionE );
362 ptrA->patchWidthE = 0;
363 ptrA->patchHeightE = 0;
364 ptrA->scaleExpE = 0;
365 ptrA->maxImageWidthE = 0;
366 ptrA->maxImageHeightE = 0;
367 ptrA->minScaleExpE = 0;
368 ptrA->maxRadiusE = 0;
374 struct bbf_LocalScanner* ptrA )
376 ptrA->xE = 0;
377 ptrA->yE = 0;
378 ptrA->xOffE = 0;
379 ptrA->yOffE = 0;
380 ptrA->currentWidthE = 0;
381 ptrA->currentHeightE = 0;
382 ptrA->workWidthE = 0;
383 ptrA->workHeightE = 0;
384 ptrA->workImagePtrE = NULL;
385 ptrA->origWidthE = 0;
386 ptrA->origHeightE = 0;
387 ptrA->origImagePtrE = NULL;
388 bbf_BitParam_exit( cpA, &ptrA->bitParamE );
389 bbs_UInt8Arr_exit( cpA, &ptrA->workImageBufferE );
390 bim_UInt32Image_exit( cpA, &ptrA->satE );
391 bim_UInt32Image_exit( cpA, &ptrA->bitImageE );
392 bbs_UInt32Arr_exit( cpA, &ptrA->patchBufferE );
393 bts_Int16Rect_exit( cpA, &ptrA->origScanRegionE );
394 bts_Int16Rect_exit( cpA, &ptrA->workScanRegionE );
396 ptrA->patchWidthE = 0;
397 ptrA->patchHeightE = 0;
398 ptrA->scaleExpE = 0;
399 ptrA->maxImageWidthE = 0;
400 ptrA->maxImageHeightE = 0;
401 ptrA->minScaleExpE = 0;
402 ptrA->maxRadiusE = 0;
416 struct bbf_LocalScanner* ptrA,
425 const struct bbf_LocalScanner* ptrA,
442 uint32 bbf_LocalScanner_positions( const struct bbf_LocalScanner* ptrA )
444 int32 wL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E - ptrA->patchWidthE;
445 int32 hL = ptrA->workScanRegionE.y2E - ptrA->workScanRegionE.y1E - ptrA->patchHeightE;
451 uint32 bbf_LocalScanner_scanIndex( const struct bbf_LocalScanner* ptrA )
453 int32 wL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E - ptrA->patchWidthE;
454 return ( ptrA->yE - ptrA->workScanRegionE.y1E ) * wL + ( ptrA->xE - ptrA->workScanRegionE.x1E );
459 void bbf_LocalScanner_pos( const struct bbf_LocalScanner* ptrA, int32* xPtrA, int32* yPtrA )
461 *xPtrA = ( ( ptrA->xE << ptrA->scaleExpE ) + ptrA->xOffE ) << 16;
462 *yPtrA = ( ( ptrA->yE << ptrA->scaleExpE ) + ptrA->yOffE ) << 16;
467 void bbf_LocalScanner_idxPos( const struct bbf_LocalScanner* ptrA, uint32 scanIndexA, int32* xPtrA, int32* yPtrA )
469 uint32 wL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E - ptrA->patchWidthE;
470 int32 xL = ( scanIndexA % wL ) + ptrA->workScanRegionE.x1E;
471 int32 yL = ( scanIndexA / wL ) + ptrA->workScanRegionE.y1E;
472 *xPtrA = ( ( xL << ptrA->scaleExpE ) + ptrA->xOffE ) << 16;
473 *yPtrA = ( ( yL << ptrA->scaleExpE ) + ptrA->yOffE ) << 16;
487 struct bbf_LocalScanner* ptrA,
497 ptrA->patchWidthE = patchWidthA;
498 ptrA->patchHeightE = patchHeightA;
499 ptrA->scaleExpE = scaleExpA;
500 ptrA->maxImageWidthE = maxImageWidthA;
501 ptrA->maxImageHeightE = maxImageHeightA;
502 ptrA->minScaleExpE = minScaleExpA;
503 ptrA->maxRadiusE = maxRadiusA;
504 bbf_LocalScanner_alloc( cpA, ptrA, mtpA );
510 struct bbf_LocalScanner* ptrA,
513 if( !bbf_BitParam_equal( cpA, &ptrA->bitParamE, bitParamPtrA ) )
515 bbf_BitParam_copy( cpA, &ptrA->bitParamE, bitParamPtrA );
516 bbf_LocalScanner_createBitImage( cpA, ptrA );
519 bbf_LocalScanner_resetScan( cpA, ptrA );
525 struct bbf_LocalScanner* ptrA,
528 ptrA->origScanRegionE = *scanRegionPtrA;
529 bbf_LocalScanner_setWorkScanRegion( cpA, ptrA );
530 bbf_LocalScanner_resetScan( cpA, ptrA );
544 const struct bbf_LocalScanner* ptrA )
549 memSizeL += bbs_SIZEOF16( ptrA->patchWidthE );
550 memSizeL += bbs_SIZEOF16( ptrA->patchHeightE );
551 memSizeL += bbs_SIZEOF16( ptrA->scaleExpE );
552 memSizeL += bbs_SIZEOF16( ptrA->maxImageWidthE );
553 memSizeL += bbs_SIZEOF16( ptrA->maxImageHeightE );
554 memSizeL += bbs_SIZEOF16( ptrA->minScaleExpE );
555 memSizeL += bbs_SIZEOF16( ptrA->maxRadiusE );
563 const struct bbf_LocalScanner* ptrA,
566 uint32 memSizeL = bbf_LocalScanner_memSize( cpA, ptrA );
570 memPtrA += bbs_memWrite32( &ptrA->patchWidthE, memPtrA );
571 memPtrA += bbs_memWrite32( &ptrA->patchHeightE, memPtrA );
572 memPtrA += bbs_memWrite32( &ptrA->scaleExpE, memPtrA );
573 memPtrA += bbs_memWrite32( &ptrA->maxImageWidthE, memPtrA );
574 memPtrA += bbs_memWrite32( &ptrA->maxImageHeightE, memPtrA );
575 memPtrA += bbs_memWrite32( &ptrA->minScaleExpE, memPtrA );
576 memPtrA += bbs_memWrite32( &ptrA->maxRadiusE, memPtrA );
583 struct bbf_LocalScanner* ptrA,
593 memPtrA += bbs_memRead32( &ptrA->patchWidthE, memPtrA );
594 memPtrA += bbs_memRead32( &ptrA->patchHeightE, memPtrA );
595 memPtrA += bbs_memRead32( &ptrA->scaleExpE, memPtrA );
596 memPtrA += bbs_memRead32( &ptrA->maxImageWidthE, memPtrA );
597 memPtrA += bbs_memRead32( &ptrA->maxImageHeightE, memPtrA );
598 memPtrA += bbs_memRead32( &ptrA->minScaleExpE, memPtrA );
599 memPtrA += bbs_memRead32( &ptrA->maxRadiusE, memPtrA );
601 if( memSizeL != bbf_LocalScanner_memSize( cpA, ptrA ) )
603 bbs_ERR0( bbs_ERR_CORRUPT_DATA, "uint32 bbf_LocalScanner_memRead( struct bem_ScanGradientMove* ptrA, const uint16* memPtrA ):\n"
611 bbf_LocalScanner_alloc( cpA, ptrA, mtpA );
629 struct bbf_LocalScanner* ptrA )
631 ptrA->xE = ptrA->workScanRegionE.x1E;
632 ptrA->yE = ptrA->workScanRegionE.y1E;
633 bbf_LocalScanner_initPatchBuffer( cpA, ptrA );
639 struct bbf_LocalScanner* ptrA,
645 if( ptrA->scaleExpE == 0 )
647 ptrA->workImagePtrE = imagePtrA;
648 ptrA->workWidthE = imageWidthA;
649 ptrA->workHeightE = imageHeightA;
653 ptrA->origImagePtrE = imagePtrA;
654 ptrA->origWidthE = imageWidthA;
655 ptrA->origHeightE = imageHeightA;
658 ptrA->bitParamE = *paramPtrA;
659 ptrA->xOffE = 0;
660 ptrA->yOffE = 0;
661 ptrA->origScanRegionE = bts_Int16Rect_create( 0, 0, imageWidthA, imageHeightA );
662 bbf_LocalScanner_downscale( cpA, ptrA );
663 bbf_LocalScanner_createBitImage( cpA, ptrA );
664 bbf_LocalScanner_resetScan( cpA, ptrA );
669 const uint32* bbf_LocalScanner_getPatch( const struct bbf_LocalScanner* ptrA )
671 return ptrA->patchBufferE.arrPtrE + ptrA->xE;
676 flag bbf_LocalScanner_next( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
678 if( ( ptrA->xE + 1 ) < ptrA->workScanRegionE.x2E - ( int32 )ptrA->patchWidthE )
680 ptrA->xE++;
684 if( ( ptrA->yE + 1 ) >= ptrA->workScanRegionE.y2E - ( int32 )ptrA->patchHeightE ) return FALSE;
686 ptrA->xE = ptrA->workScanRegionE.x1E;
687 ptrA->yE++;
690 uint32 offL = ( ptrA->yE & 0x1F );
691 uint32 rowL = ( ptrA->yE >> 5 ) + ( offL > 0 ? 1 : 0 );
693 uint32 widthL = ptrA->bitImageE.widthE;
694 uint32 sizeL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E;
695 uint32* dstL = ( uint32* )ptrA->patchBufferE.arrPtrE + ptrA->xE;
698 if( rowL < ptrA->bitImageE.heightE )
700 uint32* srcL = ptrA->bitImageE.arrE.arrPtrE + rowL * widthL + ptrA->xE;
722 void bbf_LocalScanner_goToXY( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA, int32 xA, int32 yA )
724 bbs_DEF_fNameL( "void bbf_LocalScanner_goToXY( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA, int32 xA, int32 yA )" )
725 if( xA < ptrA->workScanRegionE.x1E || xA >= ptrA->workScanRegionE.x2E - ( int32 )ptrA->patchWidthE )
730 ptrA->xE = xA;
731 if( ptrA->yE == yA ) return;
732 if( yA < ptrA->workScanRegionE.y1E || yA >= ptrA->workScanRegionE.y2E - ( int32 )ptrA->patchHeightE )
737 ptrA->yE = yA;
740 uint32 offL = ( ptrA->yE & 0x1F );
741 uint32 rowL = ( ptrA->yE >> 5 ) + ( offL > 0 ? 1 : 0 );
743 uint32 sizeL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E;
744 uint32 imgWidthL = ptrA->bitImageE.widthE;
745 uint32 imgOffsL = ptrA->workScanRegionE.x1E;
746 uint32* dstL = ptrA->patchBufferE.arrPtrE + imgOffsL;
749 if( rowL < ptrA->bitImageE.heightE )
753 uint32* src1L = ptrA->bitImageE.arrE.arrPtrE + rowL * imgWidthL + imgOffsL;
760 bbs_memcpy32( dstL, ptrA->bitImageE.arrE.arrPtrE + rowL * imgWidthL + imgOffsL, sizeL );
765 uint32* srcL = ptrA->bitImageE.arrE.arrPtrE + ( rowL - 1 ) * imgWidthL + imgOffsL;
773 void bbf_LocalScanner_goToIndex( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA, uint32 scanIndexA )
775 uint32 wL = ptrA->workScanRegionE.x2E - ptrA->workScanRegionE.x1E - ptrA->patchWidthE;
776 bbf_LocalScanner_goToXY( cpA, ptrA,
777 ( scanIndexA % wL ) + ptrA->workScanRegionE.x1E,
778 ( scanIndexA / wL ) + ptrA->workScanRegionE.y1E );
783 flag bbf_LocalScanner_nextOffset( struct bbs_Context* cpA, struct bbf_LocalScanner* ptrA )
785 int32 maxL = ( 1 << ptrA->scaleExpE );
786 if( ptrA->yOffE == maxL ) return FALSE;
788 ptrA->xOffE++;
790 if( ptrA->xOffE == maxL )
792 ptrA->xOffE = 0;
793 ptrA->yOffE++;
794 if( ptrA->yOffE == maxL ) return FALSE;
797 bbf_LocalScanner_downscale( cpA, ptrA );
798 bbf_LocalScanner_createBitImage( cpA, ptrA );
799 bbf_LocalScanner_setWorkScanRegion( cpA, ptrA );
800 bbf_LocalScanner_resetScan( cpA, ptrA );