Advertisement
lamiastella

calcSobel_dX gcov

Jun 22nd, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.20 KB | None | 0 0
  1.         -:    0:Source:common/calcSobel_dX.c
  2.         -:    0:Graph:calcSobel_dX.gcno
  3.         -:    0:Data:calcSobel_dX.gcda
  4.         -:    0:Runs:1
  5.         -:    0:Programs:1
  6.         -:    1:/********************************
  7.         -:    2:Author: Sravanthi Kota Venkata
  8.         -:    3:********************************/
  9.         -:    4:
  10.         -:    5:#include <stdio.h>
  11.         -:    6:#include <stdlib.h>
  12.         -:    7:#include "sdvbs_common.h"
  13.         -:    8:
  14.         9:    9:F2D* calcSobel_dX(F2D* imageIn)
  15.         -:   10:{
  16.         -:   11:    int rows, cols;
  17.         -:   12:    F2D *kernel_1, *kernel_2;
  18.         -:   13:    float temp;
  19.         -:   14:    int kernelSize, startCol, endCol, halfKernel, startRow, endRow, i, j, kernelSum;
  20.         -:   15:    int k, kernelSum_1, kernelSum_2;
  21.         -:   16:    F2D *imageOut, *tempOut;
  22.         -:   17:
  23.         9:   18:    rows = imageIn->height;
  24.         9:   19:    cols = imageIn->width;
  25.         -:   20:    
  26.         9:   21:    imageOut = fSetArray(rows, cols, 0);
  27.         9:   22:    tempOut = fSetArray(rows, cols, 0);
  28.         9:   23:    kernel_1 = fMallocHandle(1, 3);
  29.         9:   24:    kernel_2 = fMallocHandle(1, 3);
  30.         -:   25:
  31.         9:   26:    asubsref(kernel_1,0) = 1;
  32.         9:   27:    asubsref(kernel_1,1) = 2;
  33.         9:   28:    asubsref(kernel_1,2) = 1;
  34.         -:   29:
  35.         -:   30:    kernelSize = 3;
  36.         -:   31:    kernelSum_1 = 4;
  37.         -:   32:    
  38.         9:   33:    asubsref(kernel_2,0) = 1;
  39.         9:   34:    asubsref(kernel_2,1) = 0;
  40.         9:   35:    asubsref(kernel_2,2) = -1;
  41.         -:   36:
  42.         -:   37:    kernelSum_2 = 2;
  43.         -:   38:
  44.         -:   39:    startCol = 1;
  45.         9:   40:    endCol = cols - 1;
  46.         -:   41:    halfKernel = 1;
  47.         -:   42:
  48.         -:   43:    startRow = 1;
  49.         9:   44:    endRow = rows - 1;
  50.         -:   45:
  51.      7551:   46:    for(i=startRow; i<endRow; i++)
  52.         -:   47:    {
  53.  12399636:   48:        for(j=startCol; j<endCol; j++)
  54.         -:   49:        {
  55.         -:   50:            temp = 0;
  56.  37198908:   51:            for(k=-halfKernel; k<=halfKernel; k++)
  57.         -:   52:            {
  58.  37198908:   53:                temp += subsref(imageIn,i,j+k) * asubsref(kernel_2,k+halfKernel);
  59.         -:   54:            }
  60.  12399636:   55:            subsref(tempOut,i,j) = temp/kernelSum_2;
  61.         -:   56:        }
  62.         -:   57:    }
  63.         -:   58:    
  64.      7542:   59:    for(i=startRow; i<endRow; i++)
  65.         -:   60:    {
  66.  12399636:   61:        for(j=startCol; j<endCol; j++)
  67.         -:   62:        {
  68.         -:   63:            temp = 0;
  69.  37198908:   64:            for(k=-halfKernel; k<=halfKernel; k++)
  70.         -:   65:            {
  71.  37198908:   66:                temp += subsref(tempOut,(i+k),j) * asubsref(kernel_1,k+halfKernel);
  72.         -:   67:            }
  73.  12399636:   68:            subsref(imageOut,i,j) = temp/(float)kernelSum_1;
  74.         -:   69:        }
  75.         -:   70:    }
  76.         -:   71:
  77.         9:   72:    fFreeHandle(tempOut);
  78.         9:   73:    fFreeHandle(kernel_1);
  79.         9:   74:    fFreeHandle(kernel_2);
  80.         9:   75:    return imageOut;
  81.         -:   76:    
  82.         -:   77:}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement