summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/iDeepCopyRange.c
blob: f3fa6e360fc55a940f2369e9e16dac73473657a6 (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
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include "sdvbs_common.h"

I2D* iDeepCopyRange(I2D* in, int startRow, int numberRows, int startCol, int numberCols)
{
    int i, j, k;
    I2D *out;
    int rows, cols;
    
    rows = numberRows + startRow;
    cols = numberCols + startCol;
    out = iMallocHandle(numberRows, numberCols);
    
    k = 0;
    for(i=startRow; i<rows; i++)
        for(j=startCol; j<cols; j++)
            asubsref(out,k++) = subsref(in,i,j);
    
    return out;
}