summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/disparity/src/c/padarray4.c
blob: 321cad97c49d29def6074b5a0335f4417d00696c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "disparity.h"

void padarray4(I2D* inMat, I2D* borderMat, int dir, I2D* paddedArray)
{
    int rows, cols, bRows, bCols, newRows, newCols;
    int i, j;
    int adir;
   
    adir = abs(dir); 
    rows = inMat->height;
    cols = inMat->width;
    
    bRows = borderMat->data[0];
    bCols = borderMat->data[1];
    
    newRows = rows + bRows;
    newCols = cols + bCols;
    
    if(dir ==1)
    {
        for(i=0; i<rows; i++)
            for(j=0; j<cols; j++)
                subsref(paddedArray, i, j) = subsref(inMat,i,j);
    }
    else
    {
        for(i=0; i<rows-bRows; i++)
            for(j=0; j<cols-bCols; j++)
                subsref(paddedArray, (bRows+i), (bCols+j)) = subsref(inMat,i,j);
    }
    
    return;
}