Research Article

ViPar: High-Level Design Space Exploration for Parallel Video Processing Architectures

Algorithm 1

Pseudocode for multiwindow SAD algorithm.
Algorithm: Multi_Window_SAD
  for every disparity(d) where d = 0 ⟶ DISP_MAX:
   for every element(x, y) where x = 0 ⟶ imgW, y = 0 ⟶ imgH:
    Abs[y][x] = abs(IMG_R[y][x] − IMG_L[y][x + d]);
   for every element(x, y) where x = winH ⟶ imgW‒winH, y = 0 ⟶ imgH:
     row[y][x] = row[y][x − 1] + Abs[y][x] − Abs[y][x − winH];
    rowE[y][x] = rowE[y][x − 1] + Abs[y][x] − Abs[y][x − 2  cwinH];
   for every element(x, y) where x = 0 ⟶ imgW, y = winV ⟶ imgH‒winV:
     scr[y][x] = scr[y − 1][x] + row[y][x] − row[y − winV][x];
    scrE[y][x] = scrE[y − 1][x] + rowE[y][x] − rowE[y − 2  cwinV][x];
   for every element(x, y) where x = winH ⟶ imgW‒winH, y = winV ⟶ imgH‒winV:
    scoreA = scr[y][x];
    scoreB = scr[y][x + winH];
    scoreC = scr[y + winV][x + winH];
    scoreD = scr[y + winV][x];
    scoreE = scrE[y + winV − cwinV][x + winH − cwinH];
    min_score = scoreE + MIN_2_values{scoreA, scoreB, scoreC, scoreD};
    if min_score < bestscoreR[y + winV][x + winH]:
     bestscoreR[y + winV][x + winH] = min_score;
     DISP_IMG_R[y + winV][x + winH] = d;
    if min_score < bestscoreL[y + winV][x + winH + d]:
     bestscoreL[y + winV][x + winH + d] = min_score;
     DISP_IMG_L[y + winV][x + winH + d] = d;
  for every element(x, y) where x = 0 ⟶ imgW, y = 0 ⟶ imgH:
   dispVal = DISP_IMG_R[y][x];
   if abs(DISP_IMG_L[y][x + dispVal] ‒>dispVal) > 1:
    DISP_IMG_R[y][x] = 0;