static void schro_motion_vector_scan (SchroMotionVector *mv, SchroFrame *frame, SchroFrame *ref, int x, int y, int dist) { int i,j; int xmin; int xmax; int ymin; int ymax; int metric; int dx, dy; uint32_t metric_array[100]; dx = mv->dx[0]; dy = mv->dy[0]; xmin = MAX(0, x + dx - dist); ymin = MAX(0, y + dy - dist); xmax = MIN(frame->width - 8, x + dx + dist); ymax = MIN(frame->height - 8, y + dy + dist); mv->metric = 256*8*8; if (xmin > xmax || ymin > ymax) return; if (ymax - ymin + 1 <= 100) { for(i=xmin;i<xmax;i++){ oil_sad8x8_8xn_u8 (metric_array, #ifdef __CW32__ (uint8_t*)frame->components[0].data + x + y*frame->components[0].stride, frame->components[0].stride, (uint8_t*)ref->components[0].data + i + ymin*ref->components[0].stride, ref->components[0].stride, ymax - ymin + 1); #else frame->components[0].data + x + y*frame->components[0].stride, frame->components[0].stride, ref->components[0].data + i + ymin*ref->components[0].stride, ref->components[0].stride, ymax - ymin + 1); #endif for(j=ymin;j<=ymax;j++){ metric = metric_array[j-ymin] + abs(i - x) + abs(j - y); if (metric < mv->metric) { mv->dx[0] = i - x; mv->dy[0] = j - y; mv->metric = metric; } } } } else {
void test_sad8xn_8x8_u8() { int i; uint8_t sad1[MAX_SIZE2],sad2[MAX_SIZE2]; uint32_t res[MAX_SIZE2],check[MAX_SIZE2]={896,834,774,716,662,612,566,526,492,462,438,420,406,398,396,398,406,420,438,462,492,526,566,612,662,716,774,834,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048,2112,2176,2240,2324,2413,2492,2546,2560,2519,2408,2212,1972,1703,1420,1138,872,637}; for(i=0;i<MAX_SIZE2;i++) { sad1[i]=(i+1)*2; sad2[i]=(i+2)*1; res[i]=0; } oil_sad8x8_8xn_u8(res,sad1,2,sad2,1,MAX_SIZE2); for(i=0;i<MAX_SIZE2;i++) if(check[i]== res[i]) { std_log(LOG_FILENAME_LINE,"oil_sad8x8_8xn_u8 successful, res[%d] = %d", i,res[i]); } else { assert_failed=1; std_log(LOG_FILENAME_LINE,"oil_sad8x8_8xn_u8 unsuccessful,Expected =%d,Obtained =%d",check[i],res[i]); } }