471,089 Members | 1,682 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

#define problem

Hi!

I'm using an IplImage library from camellia.sourceforge.net, and the
testbench calls a file only containing code like the one below. In
cam_morphomaths_code.c the real computation is made, but I don't
understand where cam_morphomaths_code.c is included and how to set
what parameters to use in the testbench.

How does this code execure? I don't understand a bit...

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 5
#include "cam_morphomaths_code.c"

#define CAM_MM_ONE_OP

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 3
#define CAM_MM_DO_EROSION
#define CamMorphoMathsKernel CamErode3x3
#define CamMorphoMathsKernel1U CamErode3x31U
#include "cam_morphomaths_code.c"
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U
#undef CAM_MM_DO_EROSION
#define CAM_MM_DO_DILATION
#define CamMorphoMathsKernel CamDilate3x3
#define CamMorphoMathsKernel1U CamDilate3x31U
#include "cam_morphomaths_code.c"
#undef CAM_MM_DO_DILATION
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 5
#define CAM_MM_DO_EROSION
#define CamMorphoMathsKernel CamErode5x5
#define CamMorphoMathsKernel1U CamErode5x51U
#include "cam_morphomaths_code.c"
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U
#undef CAM_MM_DO_EROSION
#define CAM_MM_DO_DILATION
#define CamMorphoMathsKernel CamDilate5x5
#define CamMorphoMathsKernel1U CamDilate5x51U
#include "cam_morphomaths_code.c"
#undef CAM_MM_DO_DILATION
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U

/Andreas
Nov 13 '05 #1
2 5393
d9****@efd.lth.se (Andreas) wrote in
news:f7**************************@posting.google.c om:
Hi!

I'm using an IplImage library from camellia.sourceforge.net, and the
testbench calls a file only containing code like the one below. In
cam_morphomaths_code.c the real computation is made, but I don't
understand where cam_morphomaths_code.c is included and how to set
what parameters to use in the testbench.

How does this code execure? I don't understand a bit...

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 5
#include "cam_morphomaths_code.c"

#define CAM_MM_ONE_OP

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 3
#define CAM_MM_DO_EROSION
#define CamMorphoMathsKernel CamErode3x3
#define CamMorphoMathsKernel1U CamErode3x31U
#include "cam_morphomaths_code.c"
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U
#undef CAM_MM_DO_EROSION
#define CAM_MM_DO_DILATION
#define CamMorphoMathsKernel CamDilate3x3
#define CamMorphoMathsKernel1U CamDilate3x31U
#include "cam_morphomaths_code.c"
#undef CAM_MM_DO_DILATION
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 5
#define CAM_MM_DO_EROSION
#define CamMorphoMathsKernel CamErode5x5
#define CamMorphoMathsKernel1U CamErode5x51U
#include "cam_morphomaths_code.c"
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U
#undef CAM_MM_DO_EROSION
#define CAM_MM_DO_DILATION
#define CamMorphoMathsKernel CamDilate5x5
#define CamMorphoMathsKernel1U CamDilate5x51U
#include "cam_morphomaths_code.c"
#undef CAM_MM_DO_DILATION
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U


Each time you include the .c source file, this "harness" re-defines
certain manifest constants that proabably change the behavior of the C
module. Each include actually ends up producing a new instantiation of the
source code, modified by the manifest constants. The functions in the .c
file are changed for each inclusion to prevent name-space clashes. What's
not to understand?

--
- Mark ->
--
Nov 13 '05 #2
Thanks!

Now it's kind of obvious.

"Mark A. Odell" <no****@embeddedfw.com> wrote in message news:<Xn********************************@130.133.1 .4>...
d9****@efd.lth.se (Andreas) wrote in
news:f7**************************@posting.google.c om:
Hi!

I'm using an IplImage library from camellia.sourceforge.net, and the
testbench calls a file only containing code like the one below. In
cam_morphomaths_code.c the real computation is made, but I don't
understand where cam_morphomaths_code.c is included and how to set
what parameters to use in the testbench.

How does this code execure? I don't understand a bit...

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 5
#include "cam_morphomaths_code.c"

#define CAM_MM_ONE_OP

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 3
#define CAM_MM_DO_EROSION
#define CamMorphoMathsKernel CamErode3x3
#define CamMorphoMathsKernel1U CamErode3x31U
#include "cam_morphomaths_code.c"
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U
#undef CAM_MM_DO_EROSION
#define CAM_MM_DO_DILATION
#define CamMorphoMathsKernel CamDilate3x3
#define CamMorphoMathsKernel1U CamDilate3x31U
#include "cam_morphomaths_code.c"
#undef CAM_MM_DO_DILATION
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U

#undef CAM_MM_NEIGHB
#define CAM_MM_NEIGHB 5
#define CAM_MM_DO_EROSION
#define CamMorphoMathsKernel CamErode5x5
#define CamMorphoMathsKernel1U CamErode5x51U
#include "cam_morphomaths_code.c"
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U
#undef CAM_MM_DO_EROSION
#define CAM_MM_DO_DILATION
#define CamMorphoMathsKernel CamDilate5x5
#define CamMorphoMathsKernel1U CamDilate5x51U
#include "cam_morphomaths_code.c"
#undef CAM_MM_DO_DILATION
#undef CamMorphoMathsKernel
#undef CamMorphoMathsKernel1U


Each time you include the .c source file, this "harness" re-defines
certain manifest constants that proabably change the behavior of the C
module. Each include actually ends up producing a new instantiation of the
source code, modified by the manifest constants. The functions in the .c
file are changed for each inclusion to prevent name-space clashes. What's
not to understand?

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Bryan Parkoff | last post: by
9 posts views Thread by pozz | last post: by
9 posts views Thread by Harshit | last post: by
29 posts views Thread by Ancient_Hacker | last post: by
71 posts views Thread by David T. Ashley | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.