📄 avrcam.lss
字号:
57c: 1b 81 ldd r17, Y+3 ; 0x03
tmpUpperLeftY = *(pTableData + Y_UPPER_LEFT_OFFSET); /* get the upper left Y */
57e: 0c 81 ldd r16, Y+4 ; 0x04
tmpLowerRightX = *(pTableData + X_LOWER_RIGHT_OFFSET); /* get the lower right X */
580: fd 80 ldd r15, Y+5 ; 0x05
tmpLowerRightY = *(pTableData + Y_LOWER_RIGHT_OFFSET); /* get the lower right Y */
582: ee 80 ldd r14, Y+6 ; 0x06
UIMgr_writeTxFifo(k); /* send the color first */
584: d2 d2 rcall .+1444 ; 0xb2a
UIMgr_writeTxFifo(tmpUpperLeftX);
586: 81 2f mov r24, r17
588: d0 d2 rcall .+1440 ; 0xb2a
UIMgr_writeTxFifo(tmpUpperLeftY);
58a: 80 2f mov r24, r16
58c: ce d2 rcall .+1436 ; 0xb2a
UIMgr_writeTxFifo(tmpLowerRightX);
58e: 8f 2d mov r24, r15
590: cc d2 rcall .+1432 ; 0xb2a
UIMgr_writeTxFifo(tmpLowerRightY);
592: 8e 2d mov r24, r14
594: ca d2 rcall .+1428 ; 0xb2a
}
/* move our pointer up to the beginning of the next object */
pTableData += SIZE_OF_TRACKED_OBJECT;
596: 28 96 adiw r28, 0x08 ; 8
598: d3 94 inc r13
59a: 87 e0 ldi r24, 0x07 ; 7
59c: 8d 15 cp r24, r13
59e: 60 f6 brcc .-104 ; 0x538
}
/* all done...send the end of tracking packets char */
UIMgr_writeTxFifo(0xFF);
5a0: 8f ef ldi r24, 0xFF ; 255
5a2: c3 d2 rcall .+1414 ; 0xb2a
}
#endif
/* the tracked object table will be cleared out right before we start
to wait for VSYNC to indicate a new frame...so it doesn't need to be
done now */
/* schedule the next action to acquire a new frame */
PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
5a4: 84 e0 ldi r24, 0x04 ; 4
5a6: 55 de rcall .-854 ; 0x252
}
5a8: df 91 pop r29
5aa: cf 91 pop r28
5ac: 1f 91 pop r17
5ae: 0f 91 pop r16
5b0: ff 90 pop r15
5b2: ef 90 pop r14
5b4: df 90 pop r13
5b6: 08 95 ret
000005b8 <FrameMgr_findConnectedness>:
/***********************************************************
Function Name: FrameMgr_findConnectedness
Function Description: This function is responsible for
finding the connectedness between two particular run-
length encoded lines of pixel data. It updates the
trackingTable as needed.
Inputs: none
Outputs: none
***********************************************************/
static void FrameMgr_findConnectedness(void)
{
5b8: 1f 93 push r17
5ba: cf 93 push r28
trackedColor_t currColor;
unsigned char *pCurrLineColorInfo = currentLineBuffer;
5bc: ac eb ldi r26, 0xBC ; 188
5be: b1 e0 ldi r27, 0x01 ; 1
unsigned char *pTrackedObjectData;
register unsigned char currPixelRunStart=0;
5c0: 60 e0 ldi r22, 0x00 ; 0
register unsigned char currPixelRunFinish=0;
5c2: c6 2f mov r28, r22
register unsigned char lastLineXStart=0;
register unsigned char lastLineXFinish=0;
register unsigned char runLength=1;
5c4: 71 e0 ldi r23, 0x01 ; 1
unsigned char i;
bool_t colorConnected;
do
{
/* grab both the current color and the number of pixels
in the run...remember, pixels start at 1, not 0! */
colorConnected = FALSE;
5c6: 10 e0 ldi r17, 0x00 ; 0
currColor = *pCurrLineColorInfo++;
5c8: 5d 91 ld r21, X+
currPixelRunStart += runLength;
5ca: c7 0f add r28, r23
runLength = *pCurrLineColorInfo++;
5cc: 7d 91 ld r23, X+
currPixelRunFinish += runLength;
5ce: 67 0f add r22, r23
/* make sure that the run-length is at least as wide as
the minimum horizontal tracking width, and we care about the color */
if ( (currColor != notTracked) && (runLength > MIN_OBJECT_TRACKING_WIDTH) )
5d0: 55 23 and r21, r21
5d2: 09 f4 brne .+2 ; 0x5d6
5d4: 5d c0 rjmp .+186 ; 0x690
5d6: 74 30 cpi r23, 0x04 ; 4
5d8: 08 f4 brcc .+2 ; 0x5dc
5da: 5a c0 rjmp .+180 ; 0x690
{
/* this run contains a color we care about, so
either it will begin a new tracked object, or it
is connected to a currently tracked object...
compare it with each object in the tracking
table...we can't just look at the numTrackedObjects because
it is entirely possible that the first couple of objects could
be invalid...
NOTE: Instead of accessing each element in the trackedObjectTable
through the 'i' index, and then accessing the fields in each structure,
a pointer to each entry is established each time through the loop, followed
by accessing the elements through specified offsets. GCC seems to be
able to optimize this code much better than simply accessing the elements
of each structure in the array the more normal way...*/
pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
5dc: e0 91 60 00 lds r30, 0x0060
5e0: f0 91 61 00 lds r31, 0x0061
for (i=0; i<MAX_TRACKED_OBJECTS; i++)
5e4: 41 2f mov r20, r17
{
if ( (currColor == *(pTrackedObjectData + COLOR_OFFSET)) &&
5e6: 80 81 ld r24, Z
5e8: 58 17 cp r21, r24
5ea: 51 f5 brne .+84 ; 0x640
5ec: 87 81 ldd r24, Z+7 ; 0x07
5ee: 81 30 cpi r24, 0x01 ; 1
5f0: 39 f5 brne .+78 ; 0x640
5f2: 86 81 ldd r24, Z+6 ; 0x06
5f4: 28 2f mov r18, r24
5f6: 33 27 eor r19, r19
5f8: 80 91 77 00 lds r24, 0x0077
5fc: 99 27 eor r25, r25
5fe: 01 97 sbiw r24, 0x01 ; 1
600: 28 17 cp r18, r24
602: 39 07 cpc r19, r25
604: e9 f4 brne .+58 ; 0x640
(*(pTrackedObjectData + VALID_OBJECT_OFFSET) == TRUE) &&
(*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) == trackedLineCount - 1) )
{
/* found a color match and the object is valid...check to see if there is
connectedness */
lastLineXStart = *(pTrackedObjectData + LAST_LINE_X_START_OFFSET);
606: 81 81 ldd r24, Z+1 ; 0x01
lastLineXFinish = *(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET);
608: 92 81 ldd r25, Z+2 ; 0x02
/* Check for the 5 following types of line connectedness:
---------------------
| |
---------------------
-------------------------
| |
------------------------- */
if ( ( (currPixelRunStart >= lastLineXStart) &&
60a: c8 17 cp r28, r24
60c: 10 f0 brcs .+4 ; 0x612
60e: 9c 17 cp r25, r28
610: 40 f4 brcc .+16 ; 0x622
612: 68 17 cp r22, r24
614: 10 f0 brcs .+4 ; 0x61a
616: 96 17 cp r25, r22
618: 20 f4 brcc .+8 ; 0x622
61a: 8c 17 cp r24, r28
61c: 88 f0 brcs .+34 ; 0x640
61e: 69 17 cp r22, r25
620: 78 f0 brcs .+30 ; 0x640
(currPixelRunStart <= lastLineXFinish) ) ||
/* ---------------------
| |
---------------------
-------------------
| |
-------------------
OR
------------------------------
| |
------------------------------
---------
| |
--------- */
( (currPixelRunFinish >= lastLineXStart) &&
(currPixelRunFinish <= lastLineXFinish) ) ||
/* -------------------------------
| |
-------------------------------
-------------------------------
| |
-------------------------------
OR
-------------
| |
-------------
-------------------------------
| |
------------------------------- */
( (currPixelRunStart <= lastLineXStart) &&
(currPixelRunFinish >= lastLineXFinish) ) )
{
/* THERE IS CONNECTEDNESS...update the lastLineXStart and lastLineXFinish
data pointed to by pTrackedObjectData */
*(pTrackedObjectData + LAST_LINE_X_START_OFFSET) = currPixelRunStart;
622: c1 83 std Z+1, r28 ; 0x01
*(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish;
624: 62 83 std Z+2, r22 ; 0x02
/* check if the bounding box needs to be updated */
if (*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) > currPixelRunStart)
626: 83 81 ldd r24, Z+3 ; 0x03
628: c8 17 cp r28, r24
62a: 08 f4 brcc .+2 ; 0x62e
{
/* need to update the bounding box for the upper left point to
enclose this new left-most point...we never have to update the
upper left Y point, since each scan line we process moves from
top to bottom */
*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) = currPixelRunStart;
62c: c3 83 std Z+3, r28 ; 0x03
}
if ( *(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) < currPixelRunFinish)
62e: 85 81 ldd r24, Z+5 ; 0x05
630: 86 17 cp r24, r22
632: 08 f4 brcc .+2 ; 0x636
{
/* need to update the bounding box for the lower right X point to
enclose this new right-most point */
*(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) = currPixelRunFinish;
634: 65 83 std Z+5, r22 ; 0x05
}
/* the lower right 'y' point always gets updated when connectedness is found */
*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) = trackedLineCount;
636: 80 91 77 00 lds r24, 0x0077
63a: 86 83 std Z+6, r24 ; 0x06
/* set a flag indicating that that color run is part of another
object and thus doesn't need to be added as a new entry into the
tracking table */
colorConnected = TRUE;
63c: 11 e0 ldi r17, 0x01 ; 1
break;
63e: 04 c0 rjmp .+8 ; 0x648
}
}
/* go to the next object */
pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
640: 38 96 adiw r30, 0x08 ; 8
642: 4f 5f subi r20, 0xFF ; 255
644: 48 30 cpi r20, 0x08 ; 8
646: 78 f2 brcs .-98 ; 0x5e6
}
if (colorConnected == FALSE)
648: 11 23 and r17, r17
64a: 11 f5 brne .+68 ; 0x690
{
/* a new entry needs to be made to the tracking table, since we have
a run-length with a color, and it isn't connected to anything...but we
can only do this if there is space left in the trackedObject table */
if (numCurrTrackedObjects < MAX_TRACKED_OBJECTS)
64c: 80 91 75 00 lds r24, 0x0075
650: 88 30 cpi r24, 0x08 ; 8
652: f0 f4 brcc .+60 ; 0x690
{
/* space is available...add the object...but first we need to find an
invalid object in the object tracking table */
pTrackedObjectData = (unsigned char *)pCurrentTrackedObjectTable;
654: e0 91 60 00 lds r30, 0x0060
658: f0 91 61 00 lds r31, 0x0061
for (i=0; i<MAX_TRACKED_OBJECTS; i++)
65c: 41 2f mov r20, r17
{
if ( *(pTrackedObjectData + VALID_OBJECT_OFFSET) == FALSE) break;
65e: 87 81 ldd r24, Z+7 ; 0x07
660: 88 23 and r24, r24
662: 21 f0 breq .+8 ; 0x66c
/* if we haven't broken above, then the object must have been valid...
go ahead and move the pointer to the next object to check it */
pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
664: 38 96 adiw r30, 0x08 ; 8
666: 4f 5f subi r20, 0xFF ; 255
668: 48 30 cpi r20, 0x08 ; 8
66a: c8 f3 brcs .-14 ; 0x65e
}
/* now that we have a pointer to the tracked object to be updated, update all
the fields */
*(pTrackedObjectData + COLOR_OFFSET) = currColor; /* color */
66c: 50 83 st Z, r21
*(pTrackedObjectData + LAST_LINE_X_START_OFFSET) = currPixelRunStart; /* lastLineXStart */
66e: c1 83 std Z+1, r28 ; 0x01
*(pTrackedObjectData + LAST_LINE_X_FINISH_OFFSET) = currPixelRunFinish; /* lastLineXFinish */
670: 62 83 std Z+2, r22 ; 0x02
*(pTrackedObjectData + X_UPPER_LEFT_OFFSET) = currPixelRunStart; /* x_upperLeft */
672: c3 83 std Z+3, r28 ; 0x03
*(pTrackedObjectData + Y_UPPER_LEFT_OFFSET) = trackedLineCount; /* y_upperLeft */
674: 80 91 77 00 lds r24, 0x0077
678: 84 83 std Z+4, r24 ; 0x04
*(pTrackedObjectData + X_LOWER_RIGHT_OFFSET) = currPixelRunFinish; /* x_lowerRight */
67a: 65 83 std Z+5, r22 ; 0x05
*(pTrackedObjectData + Y_LOWER_RIGHT_OFFSET) = trackedLineCount; /* y_lowerRight */
67c: 80 91 77 00 lds r24, 0x0077
680: 86 83 std Z+6, r24 ; 0x06
*(pTrackedObjectData + VALID_OBJECT_OFFSET) = TRUE; /* objectValid flag */
682: 81 e0 ldi r24, 0x01 ; 1
684: 87 83 std Z+7, r24 ; 0x07
numCurrTrackedObjects++;
686: 80 91 75 00 lds r24, 0x0075
68a: 8f 5f subi r24, 0xFF ; 255
68c: 80 93 75 00 sts 0x0075, r24
}
}
/* move the pointer to the beginning of the next tracked object */
pTrackedObjectData += SIZE_OF_TRACKED_OBJECT;
}
} while(currPixelRunFinish < ACTUAL_NUM_PIXELS_I
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -