This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1 IntroductionThis document is the user guide for the Ultrasound SoftwareLibrary, here you will find the elements to add the library toyour project.
This user guide will help you set up your project to use thelibrary, use the ultrasound library for your own purposes, setup the CodeWarrior (CW) environment, and call the mainfunctions for getting the desired results. You need to befamiliar with the CodeWarrior IDE and C programminglanguage. The complete process to use the ultrasound librarywith other CW projects are also described.
2 Product DescriptionHere is an overview description of the product, main features,applications, and the environment requirements for thehardware and software.
2.1 OverviewThe ultrasound software library produces an ultrasound imagefrom beamforming signal. The beam is stored in the memoryand passes through the ultrasound library algorithms togenerate an output image with the specified height and width.
4 Definitions and Acronyms....................................13
A Module Documentation........................................14
B Directory Documentation.....................................29
C Data Structure Documentation..............................30
D File Documentation..............................................34
The depth in color used in the final image runs from 0 to 255 where 0 represents the brightest point and 255 the darkest. Theoutput image from the MSC8156 board is stored in the DDR0 memory.
The Digital Signal Processing (DSP) MSC8156 board is used throughout the document because the library adapts perfectly toit. This library is suitable to develop embedded software for the MSC8156 board which involves working with abeamforming signal or gray scale output images. Knowledge in CW IDE and C programming language is necessary.
The library uses different algorithms to generate the final output image:• FIR filter• Envelope detection• Log compression• Histogram equalization• Speckle noise reduction• Scan conversion
The ultrasound library is used in two phases. The first one is the initialization phase where most of the parameters for theinvolved algorithms are pre-computed. In the second phase, the main program yields a queue processing scheme that is incharge of splitting the work load to each core on the MSC8156 board. Therefore, there are three main functions which arecalled to communicate with the ultrasound library, one of them is used for the initialization phase and the other two dependwhether the caller is the master core or a slave.
2.2 Key target applicationsThe ultrasound library is focused to generate an ultrasound image from a beamforming signal. This task is achieved with helpfrom the mentioned algorithms in the Overview section. You can also use each module independently, taking intoconsideration certain restrictions.
2.2.1 Application 1—Generate an ultrasound image from abeamforming signal
You can obtain an ultrasound gray scale image from a beam, by calling the main functions in the library. Figure 1 is a flowdiagram.
2.2.2 Application 2—Using independent modules for specific tasksYou can use each ultrasound software library module independently by taking into consideration certain restrictions. In somemodules it is mandatory to have aligned memory to process with the computation. If these requirements are not met you willnot be able to use the modules.
2.3 Product diagram
Figure 2 is the internal structure of the ultrasound software library. The library is composed by three main modules. The firstmodule is in charge of the beamforming process. The second module is related with forming the 2D image; this performs theenvelope detection, log compression algorithm, and ends with a 2D image which is not enhanced. The third module involvesthe histogram equalization, noise reduction, and scan conversion algorithms. You can use these independently through theirinterface; however some restrictions of memory alignment and bit storing must be taken into consideration.
SFilter
SHistEq SNoiseR SScanC
SEnvelope
Beamforming process 2D Image forming
Image enhancement
Figure 2. Ultrasound software library main modules
2.4 FeaturesFeatures Detailed Description
32-bit and 16-bit version Only 32-bit optimized. There are algorithms with bothversions, 32-bit and 16-bit. However, only the 32-bit versionis optimized.
∼10.7 fps This rate is achieved with an input signal of 1556 scan lineswith 360 samples each. The output image size is 640 x 480
Silver Level Optimization Means that intrinsic functions are used in the algorithms andthe compiler optimization level 3
Bilinear Scan Conversion The scan conversion algorithm uses information fromneighbors to generate the new image presentation
FIR filter The filter algorithm uses the FIR filter kernel provided byFreescale
Multicore version The ultrasound library uses all six cores in the MSC8156board. The master core is used to manage and synchronizethe work load whereas the others cores perform the tasks ina parallel way.
Fixed point computations The main computations are performed using fixed pointoperations. Only the pre-computing tasks use floating point,so the overall performance is not affected.
Parameterized version You can set different input signal sizes, this means, adifferent number of scan lines and samples. You can alsoestablish a different output image size.
2.5 SpecificationsThis library has been designed for the DSP MSC8156 board. The software modules use the intrinsic functions of the DSPcores, therefore optimizations are related to these functions. You should be able to compile and run the specific modules withfuture versions of the board, if there are no changes in the intrinsic function.
2.6 Environment requiredIn the following sections you will find the required hardware configuration, MSC8156 board, dip switches, and extra cables.
2.6.1 Hardware configurationThis is the hardware configuration needed to run the software product. Here is a list of the required hardware:
• Freescale DSP MSC8156 board• USB trap cable• Power supply cable
Connect the USB trap cable to the MSC8156 board and to your PC, plug the power supply cable into the MSC8156 board,and turn it on. Finally, configure your MSC8156 board.
The DSP configuration with a PC is executed through the JTAG interface that uses USB protocol. This interface is used todebug the algorithms developed for the DSP MCS8156ADS. The data transfer between the PC and the DSP is executed withTCP/IP protocol. The necessary element to achieve this interface is shown in Figure 3.
• PC with CodeWarrior installed• DSP MCS8156ADS• DSP MCS8156ADS current adapter• USB cable type A to type B for debugging• Crossover Ethernet cable for data transfer
SW7.1-6—MODCK bit 0 to 5.• Default—ON (MODCK[5:0] = 0)
SW7.7: SerDes Port 1 Reference Clock (SCLK1)• Default—OFF (SerDes Port 1 reference clock is
125MHz.)
SW7.8—SerDes Port 2 Reference Clock (SCLK2)• Default—OFF (SerDes Port 2 reference clock is
125MHz.)
2.6.3 Software configurationThis section has the required software configuration to use the ultrasound software library. The libraries include paths for thecorrect configuration and compilation. The required libraries and paths are created after you have installed the CW IDE tool.
2.6.4 Software toolsThe software tools list.
• CW IDE (Version 10.1.5)• Ultrasound software library, the lib_ultrasound.elb file• A project configured with Smart DSP OS is needed.
The list of the libraries to run the demo application is listed. The order below is mandatory.• "${SMARTDSP_LOC}/lib/msc815x/os_msc8156_debug.elb" • "${workspace_loc:/lib_ultrasound/Library Debug/
The required path for the included files is listed. The order below is mandatory.• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_Runtime/(RISC_Common)"• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_Runtime/(Runtime_Common)"• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_Runtime/Runtime_StarCore/msc8156"• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_Runtime/Runtime_StarCore/startup/msc8156"• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_Runtime/Runtime_StarCore/common"• "${SCToolsBaseDir}/StarCore_Support/compiler/src/rtlib/expanded"• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_C/src"• "${SCToolsBaseDir}/StarCore_Support/compiler/ewl/EWL_C++/src"• "${SMARTDSP_LOC}/include/common"• "${SMARTDSP_LOC}/include/arch/starcore/common"• "${SMARTDSP_LOC}/initialization/common"• "${SMARTDSP_LOC}/initialization/common/include"• "${SMARTDSP_LOC}/source/common/include"
2.6.5 Product directory structureIf you want to configure the library from scratch you will need to create a new project for the MSC8156 board. Configure theproject to work with the Smart DSP OS. The working structure directory must look like this:
The working structure directory must look like this:• Source (Folder)
3.2 Add the ultrasound software library to your projectThe following text describes how to add the ultrasound software library to your project.
3.2.1 Hardware instructions• Diagram
A diagram for the hardware configuration and cables connection is shown in Figure 5.
• Set-upYou do not need to change the factory configuration to run this example.
3.2.2 Software instructionsSettings
1. Configure your software project for using the libraries and paths listed in Section 2.6.2. Add the software library to your project. The file is called lib_ultrasound3.elb3. To use the queues scheme set the macros listed in Table 2 in the file os_config.h.
Table 2. Macrovalues
Macro Name Value
MyKByte 1024
MyMByte 1024 * MyKByte
OS_SHARED_MEM_DDR0_SIZE 25 * MyMByte
OS_TOTAL_NUM_OF_QUEUES 48 + 2 (48 comes from heat project configuration)
OS_TOTAL_NUM_OF_MESSAGE_QUEUES 6
OS_TOTAL_NUM_OF_SHARED_QUEUES 6
OS_HEAP_SIZE 0x6800
INTERCORE_QUEUES ON
4. Into the appInit() function• Configure your project for using queues
1. After the “osWaitForAllCores()” function call the library function initUltrasoundLibrary(core num) withthe current core number as (((argument)))
2. Call function osMessageQueueInitialize(4)
• Create the queues1. Call osMessageQueueCreate(). Use the function runUltrasoundLibraryMasterCore () as the
msg_handler argument when other cores send messages to core 0. UserunUltrasoundLibraryOtherCore() when core 0 sends messages to other cores.
2. Set the values for queue_length as 50 and item_size as 7.
• Instructions for Core 01. Set the variable algorithm_status = START;2. Store your input signal in the variable called _globalSignal which is SAMPLES x SCAN_LINES. Set
these variables in the usLib_config.h file. The signal is stored by samples3. Call osMessageQueuePost(OTHERS_TO_CORE0_MESSAGE, data) where data is an array size 5 and of
type uint32_t.
• Instructions for all the cores1. Call osMessageQueueHwiGet(CORE0_TO_OTHERS_MESSAGE , &hwi_num) where hwi_num is of the
type os_hwi_handle.
6. The final image is stored in the outImage structure, (((access to the element image, this means, you need to readform outImage.image))). The out image size is SC_WIDTH x SC_HEIGHT; configure these values in theusLib_config.h file.
7. If you want to set certain values for the library algorithms use the *.h files. Look for the code documentation for this.
Build and Run
1. Make any additional changes to your project2. Create a group launch configuration
a. Go to Run->Debug Configurationsb. Select the Launch Group Itemc. Click on the New Launch configuration buttond. Add the six core launch configurations and apply then OK
3.3 Software instructionsSettings
1. Unpackage the file Ultrasound.rar2. Import the project into your CW workspace3. Verify that the next libraries are added to the project
4. Verify that the next paths are added to the project• "${SCToolsBaseDir}/StarCore_Support/SmartDSP/include/heat"• "${SCToolsBaseDir}/StarCore_Support/SmartDSP/include/net"
5. Configure your IP address as 10.0.0.1006. Turn on your MSC8156 board, if you have not done it yet7. Run the heat server
a. Open a command windowb. Go to the path where you have the heat server filec. Run the server with the run server.bat tool
8. Make sure that in the same folder where you have the runserver.bat file there are two folders. One is called in andanother called out. The in folder must have files named with the prefix RF*.bin and a number instead of “*”. Thesefiles will be read by the software demo. The output images will be written in the “out” folder.
9. You can run the UltrasoundDemo.exe file to see the output images.
4. Verify that the next paths are added to the project• "${SCToolsBaseDir}/StarCore_Support/SmartDSP/include/heat"• "${SCToolsBaseDir}/StarCore_Support/SmartDSP/include/net"
5. Configure your IP address as 10.0.0.1006. Turn on your MSC8156 board, if you have not done it yet7. Run the heat server
a. Open a command windowb. Go to the path where you have the heat server filec. Run the server with the run server.bat tool
8. Make sure that in the same folder where you have the runserver.bat file there are two folders. One is called in andanother called out. The in folder must have files named with the prefix RF*.bin and a number instead of “*”. Thesefiles will be read by the software demo. The output images will be written in the “out” folder.
9. You can run the UltrasoundDemo.exe file to see the output images.
Build and Run
1. Click Project->Clean2. Select the myHeat project and click OK3. Run the group launch configuration called myHeat
Appendix A Module DocumentationHere is a list of all the modules.
A.1 SEnvelope_groupDefines
• #define SENVELOPE_DEBUG 0
Functions• void SEnvelope_hilbertTransformFrequency (float *_I, float *_Q, const int _length) Performs the Hilbert's
transform in frequency domain.• void SEnvelope_hilbertFilter_32 (SFilter_t *_filter) Construct a Hilbert's filter in time domain (32 bits version).• void SEnvelope_hilbertFilter_16 (SFilter16_t *_filter) Construct a Hilbert's filter in time domain (16 bits version).• void SEnvelope_doEnvelopeDFrequency (float *_signalRF, const int _signalSize) Performs the Hilbert's transform in
frequency domain.• void SEnvelope_doEnvelopeDTime_32 (Word32 *_Rf, const int _signalSize, SFilter_t *_filter, Word32 *_I, Word32
*_Q) Performs the Hilbert's transform in time domain (32 bits version).• void SEnvelope_doEnvelopeDTime_16 (Word16 *_Rf, const int _signalSize, SFilter16_t *_filter, Word16 *_I,
Word16 *_Q) Performs the Hilbert's transform in time domain (16 bits version).• void sc3850_EnvelopeAndLogCompression (Word32 *Rf, Word32 *I, Word32 *Q, int size, SFilter_t *_filter, Word32
*mx, Word32 *mn)
Define Documentation#define SENVELOPE_DEBUG 0
Function Documentation
void sc3850_EnvelopeAndLogCompression (Word32 * Rf, Word32 * I, Word32 * Q, int size, SFilter_t * _filter,Word32 * mx, Word32 * mn)
Referenced by processSignal().
void SEnvelope_doEnvelopeDFrequency (float * _signalRF, const int _signalSize)Performs the Hilbert's transform in frequency domain.Parameters:_signalRF [in, out] The signal in frequency domai_signalSize [in] Signal's sizeSee also:SEnvelope_hilbert()
Performs the Hilbert's transform in time domain (16 bits version).Parameters:_Rf [in] The signal in time domain_signalSize [in] The signal's size_filter [in] Hilbert's filter in time domain_I [in] Memory to storing intermitate process_Q [in] Memory to storing intermitate processSee also:SEnvelope_hilbert(), SEnvelope_hilbert_filter Referenced by processSignal().
Performs the Hilbert's transform in time domain (32 bits version).Parameters:_Rf [in] The signal in time domain_signalSize [in] The signal's size_filter [in] Hilbert's filter in time domain_I [in] Memory to storing intermitate process_Q [in] Memory to storing intermitate processSee also:SEnvelope_hilbert(), SEnvelope_hilbert_filter
void SEnvelope_hilbertFilter_16 (SFilter16_t * _filter)Construct a Hilbert's filter in time domain (16 bits version).Precondition:You should store the memory for _outFilter before calling this functionParameters:_filter [out] The filterSee also:SEnvelope_hilbert()
void SEnvelope_hilbertFilter_32 (SFilter_t * _filter)Construct a Hilbert's filter in time domain (32 bits version).Precondition:You should store the memory for _outFilter before calling this functionParameters:_filter [out] The filterSee also:SEnvelope_hilbert()
void SEnvelope_hilbertTransformFrequency (float * _I, float * _Q, const int _length)Performs the Hilbert's transform in frequency domain.Note:The algorithm is based on the implementation of the Hilbert's transform in matlabPrecondition:The imaginary part should have zeros if you do not unknown itParameters:_I [in,out] Contains the real part of the signal_Q [in,out] Contains the imaginary part of the signal_length [in] Signal's lengthSee also:SEnvelopehilbert_filter()
Functions• void SFilter_initialize_32 (SFilter_t *_filter, const int _filterSize) Initialize the data structure for the filter (Single core
and 32 bits version).• void SFilter_initialize_16 (SFilter16_t *_filter, const int _filterSize) Initialize the data structure for the filter (Single
core and 16 bits version).• void SFilter_initializeParallel (SFilter_t *_filter, const int _filterSize) Initialize the data structure for the filter
(Multicore core version).• void SFilter_dpb_32 (SFilter_t *_filter, float _lowFrequency, float _highFrequency) Constructs a Digital Pass Band
(dps) filter (32 bits version).• void SFilter_dpb_16 (SFilter16_t *_filter, float _lowFrequency, float _highFrequency) Constructs a Digital Pass Band
(dps) filter (16 bits version).• void SFilter_hamming (float *_hammingWindow, int _windowSize) It constructs the hamming window which can be
used for SFilter_dpb().• void SFilter_dofilter_32 (SFilter_t *_filter, float _lowFrequency, float _highFrequency, int _sampFreq) Computes the
band pass filter (32 bits version).• void SFilter_dofilter_16 (SFilter16_t *_filter, float _lowFrequency, float _highFrequency, int _sampFreq) Computes
the band pass filter (16 bits version).• void SFilter_filterSignal_32 (Word32 *S, Word32 *S1, int samples, SFilter_t *_filter) It applies the filter to the signal
in TIME DOMAIN (32 bits version).• void SFilter_filterSignal_16 (Word16 *S, Word16 *S1, int samples, SFilter16_t *_filter) It applies the filter to the
typedef struct _SFilter16_t SFilter16_tSFilter16_t Used for representing an image
typedef struct _SFilter_t SFilter_tSFilter_t Used for representing an image
Function Documentation
void SFilter_dofilter_16 (SFilter16_t * _filter, float _lowFrequency, float _highFrequency, int _sampFreq)Computes the band pass filter (16 bits version).Parameters:_filter Used to store the filter_lowFrequency [in] The low frequency cutoff (Mhz)_highFrequency [in] The high frequency cutoff (Mhz)_sampFreq [in] Sample frequency (Mhz)See also:SFilter_dpb(), SFilter_hamming()Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
void SFilter_dofilter_32 (SFilter_t * _filter, float _lowFrequency, float _highFrequency, int _sampFreq)Computes the band pass filter (32 bits version).Parameters:_filter Used to store the filter_lowFrequency [in] The low frequency cutoff (Mhz)_highFrequency [in] The high frequency cutoff (Mhz)_sampFreq [in] Sample frequency (Mhz)See also:SFilter_dpb(), SFilter_hamming()Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
void SFilter_dpb_16 (SFilter16_t * _filter, float _lowFrequency, float _highFrequency)Constructs a Digital Pass Band (dps) filter (16 bits version).
NOTECutoff frequencies in [rads/sample]. Bibliography: Introduction to Signal Processing,Sophocles J. Orfanidis, pag 764
Parameters:_filter [out] Used for storing the resulting filter_lowFrequency [in] Low frequency cutoff [rads/sample]_highFrequency [in] High frequency cutoof [rads/sample]See also:SFilter_hamming()
void SFilter_dpb_32 (SFilter_t * _filter, float _lowFrequency, float _highFrequency)Constructs a Digital Pass Band (dps) filter (32 bits version).
NOTECutoff frequencies in [rads/sample]. Bibliography: Introduction to Signal Processing,Sophocles J. Orfanidis, pag 764
Parameters:_filter [out] Used for storing the resulting filter_lowFrequency [in] Low frequency cutoff [rads/sample]_highFrequency [in] High frequency cutoof [rads/sample]See also:SFilter_hamming()
void SFilter_filterSignal_16 (Word16 * S, Word16 * S1, int samples, SFilter16_t * _filter)It applies the filter to the signal in TIME DOMAIN (16 bits version).Parameters:_signal [in, out] The input signal_cacheSignal [in] Used for intermediate processing_samples [in] Samples in the signal_filter [in] The filterSee also:SFilter_dpb()Referenced by processSignal().
void SFilter_filterSignal_32 (Word32 * S, Word32 * S1, int samples, SFilter_t * _filter)It applies the filter to the signal in TIME DOMAIN (32 bits version).Parameters:_signal [in, out] The input signal_cacheSignal [in] Used for intermediate processing_samples [in] Samples in the signal_filter [in] The filterSee also:SFilter_dpb()Referenced by processSignal().
void SFilter_hamming (float * _hammingWindow, int _windowSize)It constructs the hamming window which can be used for SFilter_dpb().Precondition:You need to allocate memory for variable "_h" before calling this functionParameters:_hammingWindow [out] Used for storing the hamming window_windowSize [in] Window's size. It must be odd
void SFilter_initialize_16 (SFilter16_t * _filter, const int _filterSize)Initialize the data structure for the filter (Single core and 16 bits version).Parameters:_filter [in] The filter structure_filterSize [in] Filter's sizeSee also:SFilter_hamming()Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
void SFilter_initialize_32 (SFilter_t * _filter, const int _filterSize)Initialize the data structure for the filter (Single core and 32 bits version).Parameters:_filter [in] The filter structure_filterSize [in] Filter's sizeSee also:SFilter_hamming()Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
void SFilter_initializeParallel (SFilter_t * _filter, const int _filterSize)Initialize the data structure for the filter (Multicore core version).Parameters:_filter [in] The filter structure_filterSize [in] Filter's sizeSee also:SFilter_hamming()
Functions• void SHistEQ_initialize (SImage_t *_image_t) Initialize the data used for the algorithm.• void SHistEQ_preHEQ (SImage_t *_image_t) Prepares all the data for the histogram equalization algorithm.• void SHistEQ_doHEQ (SImage_t *_image_t) Performs the histogram equalization algorithm.• void SHistEQ_doHEQParallel (SImage_t *_image_t, int _row) Performs the histogram equalization algorithm in
parallel, you must take care with the number of rows, you can give a row to each processor.• void SHistEQ_computeCHist (int *_histogram, int *_cHistogram, int _length) Computes the Cumulative Histogram.
void SHistEQ_computeCHist (int * _histogram, int * _cHistogram, int _length)Computes the Cumulative Histogram.Precondition:Allocate memory for the cumulative histogram array before calling this functionParameters:_histogram [in] The original histogram
_cHistogram [out] The cumulative histogram_lenght [in] The histogram array length, eg. 256, you should use SIMAGE_DEFAULT_HISTRANGE as the defaultvalue
void SHistEQ_doHEQ (SImage_t * _image_t)Performs the histogram equalization algorithm.Precondition:Call SHistEQ_prepareForHEQ() first, with the same "_image_t" elementParameters:_image_t [in,out] The image structure to be applied the equalization algorithmSee also:SHistEQ_preHEQ(), SHistEQ_doHEQParallel()Referenced by runUltrasoundLibraryMasterCore().
void SHistEQ_doHEQParallel (SImage_t * _image_t, int _row)Performs the histogram equalization algorithm in parallel, (((you must take care about))) the number of rows, you cangive a row to each processor.Precondition:Call SHistEQ_prepareForHEQ() first, with the same "_image_t" elementParameters:_image_t [in,out] The image structure to be applied the equalization algorithm_row [in] The image's row which this processor will computeSee also:SHistEQ_preHEQ(), SHistEQ_doHEQ()Referenced by do_task().
void SHistEQ_initialize (SImage_t * _image_t)Initialize the data used for the algorithm.Precondition:Call this function before another in the algorithmParameters:_image_t [in] The image structure to be applied the equalization algorithmSee also:SHistEQ_preHEQ()Referenced by initSignalImageMemory(), and runUltrasoundLibraryMasterCore().
void SHistEQ_preHEQ (SImage_t * _image_t)Prepares all the data for the histogram equalization algorithm.Precondition:A SImage_t structure for calling this function is neededParameters:_image_t [in,out] The image structure to be applied to the equalization algorithmSee also:SHistEQ_initialize(), SHistEQ_doHEQ(), SHistEQ_doHEQParallel()Referenced by runUltrasoundLibraryMasterCore().
Functions• void SImage_initialize (SImage_t *_image_t, const int _width, const int _height, const int _histogramRange) The
SImage structure initializator.• void SImage_initialize_No_Mem (SImage_t *_image_t, const int _width, const int _height, const int _histogramRange)
The SImage structure initializator, this version doesn´t allocate memory for the image.• int SImage_setImage (SImage_t *_image_t, const unsigned char *_image, const int _width, const int _height) Establish
an image to the structure. The image must be stored by rows.• void SImage_getPixel (SImage_t *_image_t, const int _y, const int _x, unsigned char *_pixelValue) Gets the pixel
value of the image at coordinate (_x, _y), if the coordinate is out of the image size, then it returns an error indicator.• void SImage_setPixel (SImage_t *_image_t, const int _y, const int _x, const unsigned char _pixelValue) Sets the pixel
value of the image at coordinate (_x, _y), if the coordinate is out of the image size, then it returns an error indicator.• int SImage_setHistogramValue (SImage_t *_image_t, const unsigned char _histogramPosition, const int
_histogramValue) Set a new value for an histogram value.• int *const SImage_getHistogram (SImage_t *_image_t) Gets the image's histogram.• void SImage_setColor (SImage_t *_image_t, const unsigned char _color) Sets a color to the complete image, the color
must be in range [0,255].• int SImage_computeHistogram (SImage_t *_image_t) Compute the image's histogram, you should call this function
when the image has changed.
Define Documentation#define SIMAGE_DEBUG 0#define SIMAGE_DEFAULT_HISTRANGE 256Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
Typedef Documentationtypedef struct _SImage_t SImage_tSImage_t Used for representing an image
Function Documentation
int SImage_computeHistogram (SImage_t * _image_t)Compute the image's histogram, you should call this function when the image has changed.Parameters:_image_t [in] The image structure to compute the histogramSee also:SImage_getHistogram()
int* const SImage_getHistogram (SImage_t * _image_t)Gets the image's histogram.Parameters:_image_t [in] The image structure with the histogramSee also:SImage_printHistogram()
void SImage_getPixel (SImage_t * _image_t, const int _y, const int _x, unsigned char * _pixelValue) [inline]Gets the pixel value of the image at coordinate (_x, _y), if the coordinate is out of the image size, then it returns anerror indicator.Parameters:_image_t [in] The image structure for getting the pixel value_y [in] The y coordinate_x [in] The x coordinate_pixelValue [out] A pointer to the variable where the pixel value will be savedReturns:1 if success, 0 if (_x, _y) coordinate is out of the image size
See also:SImage_setPixel(), SImage_setImage()References _SImage_t::image, and _SImage_t::width.
void SImage_initialize (SImage_t * _image_t, const int _width, const int _height, const int _histogramRange)The SImage structure initializator.
NOTEOnly one channel images are supported for this structure
Precondition:You need to know the image's width and heightParameters:_image_t [in,out] The image to initialize_width [in] The image's width_height [in] The image's height_histogramRange [in] You should use SIMAGE_DEFAULT_HISTRANGE as default valueReferenced by initSignalImageMemory().
void SImage_initialize_No_Mem (SImage_t * _image_t, const int _width, const int _height, const int_histogramRange)
The SImage structure initializator, this version doesn´t allocate memory for the image.
NOTEOnly one channel images are supported for this structure
Precondition:You need to know the image's width and heightParameters:_image_t [in,out] The image to initialize_width [in] The image's width_height [in] The image's height_histogramRange [in] You should use SIMAGE_DEFAULT_HISTRANGE as default valueReferenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
void SImage_setColor (SImage_t * _image_t, const unsigned char _color)Sets a color to the complete image, the color must be in range [0,255].Parameters:_image_t [in] The image structure with the image_color [in] The color for setSee also:SImage_setImage()
Set a new value for an histogram value.Parameters:_image_t [in] The image structure with the histogram_histogramPosition [in] The histogram position_histogramValue [in] The value to set in the histogram position _pReturns:1 if success, 0 if _histogramPosition is out of the histogram rangeSee also:SImage_getHistogramRange()
int SImage_setImage (SImage_t * _image_t, const unsigned char * _image, const int _width, const int _height)Establish an image to the structure. The image must be stored by rows.
NOTEOnly one channel images are supported for this structure, the image must be stored byrows
Precondition:Call SImage_initilize() before you must know the image's width and heightParameters:_image_t [in] The image structure for storing the image_image [in,out] A pointer to the image we want to establish_width [in] The image's width_height [in] The image's heightSee also:SImage_setPixel()
void SImage_setPixel (SImage_t * _image_t, const int _y, const int _x, const unsigned char _pixelValue) [inline]Sets the pixel value of the image at coordinate (_x, _y), if the coordinate is out of the image size, then it returns an errorindicator.Parameters:_image_t [in] The image structure for setting the pixel value_y [in] The y coordinate_x [in] The x coordinate_pixelValue [in] The pixel value to establish at point (_x, _y)Returns:1 if success, 0 if (_x, _y) coordinate is out of the image sizeSee also:SImage_getPixel(), SImage_setImage()References _SImage_t::image, and _SImage_t::width.
Performs the speckle's noise reduction using median's algorithm, this is the parallel version.Precondition:You need two SImage_t elements previously allocated for calling this functionParameters:_oldImage_t [in] The image to be applied the noise reduction median's algorithm_row [in] The row which is going to be processed, you can give to each processor a row for doing it in parallelSee also:SNoiseR_preNoiseReduction(), SNoiseR_doNoiseReductionKuanParallel()Referenced by do_task().
const unsigned char SNoiseR_getMedian9ElementsArray (unsigned char * _array)Quickly computes the median of an array of 9 elements.Parameters:_array [in] The array with the not sorted valuesReturns:The median value of the array
void SNoiseR_initialize (SImage_t * _image_t, SNoiseR_t * _noiseInfo)Initialize all the elements needed for applying the noise reduction algorithms.
NOTEOnly one channel images are supported for this class
Parameters:_image_t [in] Used to initialize the noise reduction algorithm, it is the source image_noiseInfo [out] A structure for allocating the information of the algorithm, this variable is initialized in hereSee also:SNoiseR_preNoiseReduction()Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
void SNoiseR_preNoiseReduction (SImage_t * _oldImage_t, SImage_t * _newImage_t)Performs the speckle's noise reduction using Kuan's algorithm.Precondition:We need two SImage_t elements previously allocated for calling this functionParameters:_oldImage_t [in] The image to be applied the noise reduction Kuan's algorithm_newImage_t [out] The pre-resulting imageSee also:SNoiseR_initialize()Referenced by runUltrasoundLibraryMasterCore().
*_scanInformation_t) The Scan conversion algorithm, in this case the Nearest Neighbor strategy.• void SScanC_preScanConvertionParallel (SImage_t *_inImage_t, SImage_t *_outImage_t, SScanC_t
*_scanInformation_t) The Scan conversion algorithm, in this case the Nearest Neighbor strategy.• void SScanC_doScanConvertionBilinearIParallel (SImage_t *_inImage_t, SImage_t *_outImage_t, SScanC_t
*_scanInformation_t, const int _row) The Scan conversion algorithm, in this case the Bilinear Interpolation strategy.
Define Documentation#define OUTHEIGHT 640 #define OUTWIDTH 480#define SSCAN_ANGLETOSHOW 16384#define SSCAN_DE 100#define SSCAN_DEGREES2RADIANS (SSCAN_MPI / 32768.0) Factor conversion from degrees to radians#define SSCAN_DS 10 Depth start#define SSCAN_ENDANGLE (16384 + (SSCAN_ANGLETOSHOW / 2)) The end angle for showing the image#define SSCAN_MPI 3.1415926#define SSCAN_ORIGENSTARTANGLE (16384 - (SSCAN_STARTANGLE / 2)) The starting angle taken from theorigin#define SSCAN_R 10 Radius of Curvature at Skin Line#define SSCAN_RADIANS2DEGREES (32768.0 / SSCAN_MPI) Factor conversion from radians to degrees#define SSCAN_STARTANGLE (16384 - (SSCAN_ANGLETOSHOW / 2)) The starting angle for showing the image#define SSCANC_DEBUG 0
Typedef Documentationtypedef struct _SScanC_t SScanC_tSNoise_t Used for allocating the information for the noise reduction algorithm
You need an image with the beamforming information, the scan lines must be accessed via columns and its values viarows, that is, if you want scan line 3 and its 8 value, access it via SImage_getPixel(_inImage_t, 8, 3, &getValue). Also,you need a _outImage_t element where the output image is stored.Parameters:_inImage_t [out] The beamforming image, without conversion_outImage_t [out] The image which will be created, with conversion_scanInformation_t [in] The parameters for the scan conversion algorithm. These were computed inSScanC_preScanConvertion()_row [in] The row that the processor is going to compute, this row is from the output image. 0 <= _row <=_outImage_t->height. You should take care about itSee also:SScanC_preScanConvertion(), SScanC_doScanConvertionNearestN()Referenced by do_task().
NOTEOnly one channel images are supported for this class
Parameters:_image_t [in] The image which is going to be converted_scanInformation_t [out] Structure with the information for the scan conversion algorithm. This is initialized in thisfunctionSee also:SScanC_preScanConvertion()Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
The Scan conversion algorithm, in this case the nearest neighbor strategy.Precondition:You need an image with the beamforming information, the scan lines must be accessed via columns and its values viarows, that is, if you want scan line 3 and its 8 value, access to via SImage_getPixel(_inImage_t, 8, 3, &getValue). Youalso need a _outImage_t element where the output image is still stored.Parameters:_inImage_t [out] The beamforming image, without conversion_outImage_t [out] The image which will be created, with conversion_scanInformation_t [out] The last parameters before scan conversion are computed in this callingSee also:SScanC_initialize()Referenced by initSignalMemoryNotCore0().
The Scan conversion algorithm, in this case the nearest neighbor strategy.Precondition:An image with the beamforming information is needed, the scan lines must be accessed via columns and its values viarows, that is. If you want the scan line 3 and its 8 value, access to a SImage_getPixel(_inImage_t, 8, 3, &getValue) isneeded. You also need a _outImage_t element where the output image is stored.Parameters:_inImage_t [out] The beamforming image, without conversion_outImage_t [out] The image which will be created, with conversion_scanInformation_t [out] The last parameters before scan conversion are computed in this callingSee also:SScanC_initialize()
Functions• uint32_t utility_isqrt32v1_c (const uint32_t n) Computes the INTEGER square root of input parameter "n".• unsigned int utility_isqrt32v2_c (const unsigned int n) Computes the INTEGER square root of input parameter "n".• float utility_fsqrt_c (int _n) Computes the float square root of input parameter "_n".• unsigned short int utility_iatan2_c (int y, int x) Computes the angle between the x axis and line y = m * x line points,
(0, 0) and (x, y). This function takes into account the quadrant in which is the final point line.• Word32 sc3850_sqrt_32_c (const Word32 _x) Computes the square root of the "_x" value (32 bits version).• Word16 sc3850_sqrt_16_c (const Word16 _x) Computes the square root of the "_x" value (16 bits version).• void sc3850_my_fir_real_32x32_c (Word32 x[], Word32 h[], Word32 y[], Word16 Nr, Word16 Nh) FIR with 32 bits
real inputs and coefficients (32 bits version).• void sc3850_my_fir_real_16x16_c (Word16 x[], Word16 h[], Word16 y[], Word16 Nr, Word16 Nh) FIR with 32 bits
real inputs and coefficients (16 bits version).• Word32 sc3850_norm_32_c (const Word32 a, const Word32 b) Computes (a^2 + b^2)^(1/2) (32 bits version).• Word16 sc3850_norm_16_c (const Word16 a, const Word16 b) Computes (a^2 + b^2)^(1/2) (16 bits version).• void float2word32__ (float *_x, Word32 *_res) Converts form float representation to fixed point representation (32 bits
version).• void word32_2_float__ (Word32 *_dat, float *_res) Converts form fixed point representation to float representation
(32 bits version).• void float2word16__ (float *_x, Word16 *_res) Converts form float representation to fixed point representation (16 bits
version).• void word16_2_float__ (Word16 *_dat, float *_res) Converts form fixed point representation to float representation
(16 bits version).• void sc3850_fir_real_32x32_c (Word32 *x, Word32 *h, Word32 *y, Word32 Nr, Word32 Nh)• void sc3850_utility_brightnessRepresentation (Word32 *Signal, SImage_t *_image, const int row, const int n, const int
scan_lines, Word32 mn, Word32 mx)
Define Documentation#define UTILITY_DEBUG 0
Function Documentation
void float2word16__ (float * _x, Word16 * _res)Converts form float representation to fixed point representation (16 bits version).Parameters:_x [in] The value in float representation_res [out] The value in fixed point representation
void float2word32__ (float * _x, Word32 * _res)Converts form float representation to fixed point representation (32 bits version).Parameters:_x [in] The value in float representation_res [out] The value in fixed point representation
Parameters:x [in] 32 bit inputh [in] coefficientsy [out] The filter signalNr [in] number of data samplesNh [in] number of elements in the filter
Returns:The filter signal
void sc3850_my_fir_real_32x32_c (Word32 x[], Word32 h[], Word32 y[], Word16 Nr, Word16 Nh)FIR with 32 bits real inputs and coefficients (32 bits version).Parameters:x [in] 32 bit inputh [in] coefficientsy [out] The filter signalNr [in] number of data samplesNh [in] number of elements in the filterReturns:The filter signal
Word16 sc3850_norm_16_c (const Word16 a, const Word16 b)Computes (a^2 + b^2)^(1/2) (16 bits version).Parameters:a [in] First valueb [in] Second valueReturns:The computed norm
Word32 sc3850_norm_32_c (const Word32 a, const Word32 b)Computes (a^2 + b^2)^(1/2) (32 bits version).Parameters:a [in] First valueb [in] Second valueReturns:The computed norm
Word16 sc3850_sqrt_16_c (const Word16 _x)Computes the square root of the "_x" value (16 bits version).Parameters:_x [in] The value to compute the square rootReturns:The square root of "_x"
Word32 sc3850_sqrt_32_c (const Word32 _x)Computes the square root of the "_x" value (32 bits version).Parameters:_x [in] The value to compute the square rootReturns:The square root of "_x"
void sc3850_utility_brightnessRepresentation (Word32 * Signal, SImage_t * _image, const int row, const int n, constint scan_lines, Word32 mn, Word32 mx)
Parameters:Signal [in] The input signal_image [out] The output image row [in] The row number
n [in] Signal's sizescan_lines [in] Number of scan lines per signalmn [in] Minimum value of signalmx [in] Maximum value of signal
Referenced by do_task(), and runUltrasoundLibraryMasterCore().
float utility_fsqrt_c (int _n)Computes the FLOAT square root of input parameter "_n".
NOTEThe _n value must be positive and integer
Parameters:_n [in] The value to compute the square rootReturns:The computed INTEGER square root
unsigned short int utility_iatan2_c (int y, int x)Computes the angle between the x axis and line y = m * x line points, (0, 0) and (x, y). This function takes into accountthe quadrant which is the final point line.Parameters:y [in] The y coordinatex [in] The x coordinateReturns:The angle formed by the x axis and the line y = m * x
uint32_t utility_isqrt32v1_c (const uint32_t n)Computes the INTEGER square root of input parameter "n".
NOTEThe n value must be positive and integer
Parameters:n [in] The value to compute the square rootReturns:The computed INTEGER square root
unsigned int utility_isqrt32v2_c (const unsigned int n)Computes the INTEGER square root of input parameter "n".
NOTEThe n value must be positive and integer
Parameters:n [in] The value to compute the square rootReturns:The computed INTEGER square root
void word16_2_float__ (Word16 * _dat, float * _res)Converts form fixed point representation to float representation (16 bits version).Parameters:_dat [in] The value in fixed point representation_res [out] The value in float representation
void word32_2_float__ (Word32 * _dat, float * _res)Converts form fixed point representation to float representation (32 bits version).Parameters:
Data Fields• unsigned char * image• int histogram [256]• int width• int height• int histogramRange
Detailed DescriptionSImage_t Used for representing an image
Field Documentation
int heightThe image heightReferenced by initSignalImageMemory(), runUltrasoundLibraryMasterCore(), send_histogram_equalization(),send_image_log_compression(), send_image_noise_reduction(), send_scan_convertion(), and write_and_start().
int histogram[256]The array used to store the compute image's histogramReferenced by do_task(), and send_histogram_equalization().
int histogramRangeThe maximum histogram range's value, this means if the histogram runs from 0 to 255, this value must be equal to 256(SIMAGE_DEFAULT_HISTRANGE)
unsigned char* imageThe array used to store the imageReferenced by do_task(), initSignalImageMemory(), send_histogram_equalization(), send_image_log_compression(),send_image_noise_reduction(), send_scan_convertion(), send_signal_processing(), SImage_getPixel(),SImage_setPixel(), and write_and_start().
int widthThe image widthReferenced by initSignalImageMemory(), SImage_getPixel(), SImage_setPixel(), and write_and_start().
The documentation for this struct was generated from the following file:• SImage.h
unsigned char mask[9]The mask used for filtering purposes
The documentation for this structure was generated from the following file:• SNoiseR.h
C.5 _SScanC_t Struct Reference#include <SScanC.h>
Data Fields• int iLowerLimit• int iUpperLimit• int widthScalarFactor• int heightScalarFactor• int inWidth• int inHeight• int outWidth• int outHeight• int outWidthD2• int cosT• int R• int Ds• int De• int N• int S• int K• int SxROI• int SyROI• int Wx• int Wy• int deltaS• int deltaE• int deltad• int * preTable• int ptrTable [480]
Detailed DescriptionSNoise_t Used for allocating the information for the noise reduction algorithm
Field Documentation
int cosTThe cos of the theta angle minus 90.0d
int DeDepth end
int deltadScan direction from start to end scan line (+1 counter clock-wise, -1 clock-wise
int heightScalarFactorThe height scalar factor form the original image to the output image
int iLowerLimitThe lower limit in the source image
int inHeightThe height of the source image
int inWidthThe width of the source image
int iUpperLimitThe upper limit in the source image
int KMemory stride
int NNumber of samples per scan line
int outHeightThe height of the output image
int outWidthThe width of the output image
int outWidthD2The width of the output image divided by two
int* preTableTable used for pre compute the values for the scan conversion positionsReferenced by do_task(), initSignalImageMemory(), and send_scan_convertion().
int ptrTable[480]Local array for reading, used as cache memory
int RRadius of curvature at Skin Line
int SNumber of scan lines
int SxROIX coordinate for ROI (top left)
int SyROIX coordinate for ROI (top left)
int widthScalarFactorThe width scalar factor form the original image to the output image
void printfStream (char * fname, unsigned char * buf, int scan_lines, int samples)References server_connection_global.Referenced by appBackground(), and write_and_start().
void read_ultrasound_data (void)References _globalSignal, produceFalseSignal(), readData(), readData_16(), SAMPLES, and SCAN_LINES.Referenced by appBackground(), and write_and_start().
void readData (char * in_file, Word32 * signal)References RFSignal, SAMPLES, SCAN_LINES, server_connection_global, andSHORT_little_endian_TO_big_endian().Referenced by appBackground(), and read_ultrasound_data().
D.8 SEnvelope.h File ReferenceHeader file for the envelope detection algorithm.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "SFilter.h"
#include "Utility.h"
#include <prototype.h>
Defines• #define SENVELOPE_DEBUG 0
Functions• void SEnvelope_hilbertTransformFrequency (float *_I, float *_Q, const int _length) Performs the Hilbert's transform in
frequency domain.• void SEnvelope_hilbertFilter_32 (SFilter_t *_filter) Construct a Hilbert's filter in time domain (32 bits version).• void SEnvelope_hilbertFilter_16 (SFilter16_t *_filter) Construct a Hilbert's filter in time domain (16 bits version).• void SEnvelope_doEnvelopeDFrequency (float *_signalRF, const int _signalSize) Performs the Hilbert's transform in
frequency domain.• void SEnvelope_doEnvelopeDTime_32 (Word32 *_Rf, const int _signalSize, SFilter_t *_filter, Word32 *_I, Word32
*_Q) Performs the Hilbert's transform in time domain (32 bits version).• void SEnvelope_doEnvelopeDTime_16 (Word16 *_Rf, const int _signalSize, SFilter16_t *_filter, Word16 *_I,
Word16 *_Q) Performs the Hilbert's transform in time domain (16 bits version).• void sc3850_EnvelopeAndLogCompression (Word32 *Rf, Word32 *I, Word32 *Q, int size, SFilter_t *_filter, Word32
*mx, Word32 *mn)
Detailed Description
Header file for the envelope detection algorithm.
Id:
SEnvelope_1.0.0
D.9 SFilter.h File ReferenceHeader file for the filter algorithm. Contains the necessary functions to construct a FIR filter in time's domain.
Functions• void SFilter_initialize_32 (SFilter_t *_filter, const int _filterSize) Initialize the data structure for the filter (Single core
and 32 bits version).• void SFilter_initialize_16 (SFilter16_t *_filter, const int _filterSize) Initialize the data structure for the filter (Single
core and 16 bits version).• void SFilter_initializeParallel (SFilter_t *_filter, const int _filterSize) Initialize the data structure for the filter
(Multicore core version).• void SFilter_dpb_32 (SFilter_t *_filter, float _lowFrequency, float _highFrequency) Constructs a Digital Pass Band
(dps) filter (32 bits version).• void SFilter_dpb_16 (SFilter16_t *_filter, float _lowFrequency, float _highFrequency) Constructs a Digital Pass Band
(dps) filter (16 bits version).• void SFilter_hamming (float *_hammingWindow, int _windowSize) It constructs the hamming window which can be
used for SFilter_dpb().• void SFilter_dofilter_32 (SFilter_t *_filter, float _lowFrequency, float _highFrequency, int _sampFreq) Computes the
band pass filter (32 bits version).• void SFilter_dofilter_16 (SFilter16_t *_filter, float _lowFrequency, float _highFrequency, int _sampFreq) Computes
the band pass filter (16 bits version).• void SFilter_filterSignal_32 (Word32 *S, Word32 *S1, int samples, SFilter_t *_filter) It applies the filter to the signal
in TIME DOMAIN (32 bits version).• void SFilter_filterSignal_16 (Word16 *S, Word16 *S1, int samples, SFilter16_t *_filter) It applies the filter to the
signal in TIME DOMAIN (16 bits version).
Detailed DescriptionHeader file for the filter algorithm. Contains the necesary functions for construct a FIR filter in time's domain.Id:SFilter_1..0.0
D.10 SHistEQ.h File ReferenceHeader file for the Histogram equalization algorithm, we present two options, the one with one processor and the parallelversion.
Functions• void SHistEQ_initialize (SImage_t *_image_t) Initialize the data used for the algorithm.• void SHistEQ_preHEQ (SImage_t *_image_t) Prepares all the data for the histogram equalization algorithm.• void SHistEQ_doHEQ (SImage_t *_image_t) Performs the histogram equalization algorithm.• void SHistEQ_doHEQParallel (SImage_t *_image_t, int _row) Performs the histogram equalization algorithm in
parallel, you MUST take care about the number of rows, you can give a row to each processor.• void SHistEQ_computeCHist (int *_histogram, int *_cHistogram, int _length) Computes the Cumulative Histogram.
Detailed Description
Header file for the Histogram equalization algorithm, we present two options, the one with one processor and the parallelversion.
Id:
SHistEQ_1.0.0
D.11 SImage.h File ReferenceHeader file for the SImage structure, this structure is used to represent the image.
Functions• void SImage_initialize (SImage_t *_image_t, const int _width, const int _height, const int _histogramRange) The
SImage structure initializator.• void SImage_initialize_No_Mem (SImage_t *_image_t, const int _width, const int _height, const int _histogramRange)
The SImage structure initializator, this version doesn´t allocate memory for the image.• int SImage_setImage (SImage_t *_image_t, const unsigned char *_image, const int _width, const int _height) Establish
an image to the structure. The image must be stored by rows.• void SImage_getPixel (SImage_t *_image_t, const int _y, const int _x, unsigned char *_pixelValue) Gets the pixel
value of the image at coordinate (_x, _y), if the coordinate is out of the image size, then it returns an error indicator.• void SImage_setPixel (SImage_t *_image_t, const int _y, const int _x, const unsigned char _pixelValue) Sets the pixel
value of the image at coordinate (_x, _y), if the coordinate is out of the image size, then it returns an error indicator.• int SImage_setHistogramValue (SImage_t *_image_t, const unsigned char _histogramPosition, const int
_histogramValue) Set a new value for an histogram value.• int *const SImage_getHistogram (SImage_t *_image_t) Gets the image's histogram.
*_scanInformation_t) The Scan conversion algorithm, in this case the Nearest Neighbor strategy.• void SScanC_preScanConvertionParallel (SImage_t *_inImage_t, SImage_t *_outImage_t, SScanC_t
*_scanInformation_t) The Scan conversion algorithm, in this case the Nearest Neighbor strategy.• void SScanC_doScanConvertionBilinearIParallel (SImage_t *_inImage_t, SImage_t *_outImage_t, SScanC_t
*_scanInformation_t, const int _row) The Scan conversion algorithm, in this case the Bilinear Interpolation strategy.
• void processSignal (WordSize *signal, int samples, int times, int ini, Word32 *mx, Word32 *mn) Process the signal.• void produceFalseSignal (float *fs, int samples, int scan_lines) fs [in] samples [in] scan_lines [in]• void send_signal_processing ()• void send_image_log_compression ()• void send_histogram_equalization ()• void send_image_noise_reduction ()• void send_scan_convertion ()• void runUltrasoundLibraryMasterCore (os_hwi_arg message_id) This function is in charge of manage and synchronize
the work load to perform the task. This function is called from an interruption which is generated automatically by theboot sequence of the SMARTDSP OS.
• void do_task (uint32_t *tx_rx_msg_data) Choose the adequate function depending on the current algorithm status.• void runUltrasoundLibraryOtherCore (os_hwi_arg message_id) This function performs the work controlled by core 0;
interprets the messages and call the suitable function. This function is called from an interruption which is generated inresponse of a message sent by core 0.
void do_task (uint32_t * tx_rx_msg_data)Choose the adequate function depending on the current algorithm status.References _SImage_t::histogram, HISTOGRAM_TASK, image, _SImage_t::image, image_NMemory,IMAGE_TASK, imageWithoutNoise_NMemory, ini, LOG_COMPRESSION_TASK, noise,OTHERS_TO_CORE0_MESSAGE, outImage_NMemory, _SScanC_t::preTable, processSignal(), SAMPLES,sc3850_utility_brightnessRepresentation(), SCAN_CONVERTION_TASK, SCAN_LINES, scanNMemory,SHistEQ_doHEQParallel(), SIGNAL_TASK, SNoiseR_doNoiseReductionMedianParallel(),SScanC_doScanConvertionBilinearIParallel(), and WordSize.Referenced by runUltrasoundLibraryOtherCore().
void processSignal (WordSize * signal, int samples, int times, int ini, Word32 * mx, Word32 * mn)
Process the signal.Parameters:signal [in] The current scan linesamples [in] Number of samples per scan linetimes [in] Number of scan lines to processini [in] The current scan line (only for reference)mx [in] Pointer to the maximum of the set of processed scan linesmn [in] Pointer to the minimum of the set of processed scan lines
void produceFalseSignal (float * fs, int samples, int scan_lines)fs [in] samples [in] scan_lines [in]Referenced by read_ultrasound_data().
void runUltrasoundLibraryMasterCore (os_hwi_arg message_id)This function is in charge of manage and synchronize the work load to perform the task. This function is called from aninterruption which is generated automatically by the boot sequence of the SMARTDSP OS.References _globalSignal, algorithm_status, endDSP, endIE, endSC, finished, globalMax, globalMin,_SImage_t::height, HISTOGRAM_TASK, image, IMAGE_TASK, imageWithoutNoise, iniDSP, iniIE, iniSC,LOG_COMPRESSION_TASK, OTHERS_TO_CORE0_MESSAGE, outImage, SAMPLES,sc3850_utility_brightnessRepresentation(), SCAN_CONVERTION_TASK, SCAN_LINES,send_histogram_equalization(), send_image_log_compression(), send_image_noise_reduction(),send_scan_convertion(), send_signal_processing(), SHistEQ_doHEQ(), SHistEQ_initialize(), SHistEQ_preHEQ(),SIGNAL_TASK, SNoiseR_preNoiseReduction(), START, totDSP, totIE, and totSC.Referenced by appInit().
void runUltrasoundLibraryOtherCore (os_hwi_arg message_id)This function performs the work controlled by core 0; interprets the messages and call the suitable function. Thisfunction is called from an interruption which is generated in response of a message sent by core 0.References do_task().Referenced by appBackground(), and appInit().
void send_histogram_equalization ()References algorithm_status, CORE0_TO_OTHERS_MESSAGE, finished, _SImage_t::height, _SImage_t::histogram,_SImage_t::image, and image.Referenced by runUltrasoundLibraryMasterCore().
void send_image_log_compression ()References _globalSignal, ACTIVE_CORES, algorithm_status, CORE0_TO_OTHERS_MESSAGE, finished,_SImage_t::height, _SImage_t::image, and image.Referenced by runUltrasoundLibraryMasterCore().
void send_image_noise_reduction ()References ACTIVE_CORES, algorithm_status, CORE0_TO_OTHERS_MESSAGE, finished, _SImage_t::height,_SImage_t::image, image, and imageWithoutNoise.Referenced by runUltrasoundLibraryMasterCore().
void send_scan_convertion ()References algorithm_status, CORE0_TO_OTHERS_MESSAGE, finished, _SImage_t::height, _SImage_t::image,imageWithoutNoise, outImage, _SScanC_t::preTable, and scan.Referenced by runUltrasoundLibraryMasterCore().
Functions• void initUltrasoundLibrary (const int id)• void runUltrasoundLibraryOtherCore (os_hwi_arg message_id)
This function performs the work controlled by core 0; interprets the messages and call the suitable function. Thisfunction is called from an interruption which is generated in response of a message sent by core 0.
• void runUltrasoundLibraryMasterCore (os_hwi_arg message_id)This function is in charge of manage and synchronize the work load to perform the task. This function is calledfrom an interruption which is generated automatically by the boot sequence of the SMARTDSP OS.
#define ACTIVE_CORES 5Referenced by send_image_log_compression(), send_image_noise_reduction(), and send_signal_processing().
#define COMPLETE_TASK 6Referenced by appBackground().
#define CORE0_TO_OTHERS_MESSAGE 1Referenced by appBackground(), appInit(), send_histogram_equalization(), send_image_log_compression(),send_image_noise_reduction(), send_scan_convertion(), and send_signal_processing().
#define HISTOGRAM_TASK 3Referenced by do_task(), and runUltrasoundLibraryMasterCore().
#define IMAGE_TASK 4Referenced by do_task(), and runUltrasoundLibraryMasterCore().
#define INTERCORE_QUEUES ON
#define LOG_COMPRESSION_TASK 7Referenced by do_task(), and runUltrasoundLibraryMasterCore().
#define OTHERS_TO_CORE0_MESSAGE 2Referenced by appBackground(), appInit(), do_task(), and runUltrasoundLibraryMasterCore().
#define PARAREL_HISTOGRAM OFF
#define PARAREL_LOG_COMPRESSION OFF
#define SCAN_CONVERTION_TASK 5Referenced by do_task(), and runUltrasoundLibraryMasterCore().
#define SIGNAL_TASK 2Referenced by do_task(), and runUltrasoundLibraryMasterCore().
#define START 1Referenced by runUltrasoundLibraryMasterCore().
Function Documentation
void initUltrasoundLibrary (const int id)References initSignalImageMemory(), and initSignalMemoryNotCore0().Referenced by appInit().
void runUltrasoundLibraryMasterCore (os_hwi_arg message_id)This function is in charge of manage and synchronize the work load to perform the task. This function is called from aninterruption which is generated automatically by the boot sequence of the SMARTDSP OS.
void runUltrasoundLibraryOtherCore (os_hwi_arg message_id)This function performs the work controlled by core 0; interprets the messages and call the suitable function. Thisfunction is called from an interruption which is generated in response of a message sent by core 0.References do_task().Referenced by appBackground(), and appInit().
Variable Documentation
int algorithm_statusReferenced by appBackground(), runUltrasoundLibraryMasterCore(), send_histogram_equalization(),send_image_log_compression(), send_image_noise_reduction(), send_scan_convertion(), andsend_signal_processing().
uint32_t CoresWork[6] = {0}
os_queue_handle ctrl_que_handle
uint32_t endReferenced by appBackground(), and write_and_start().
uint32_t endDSPReferenced by runUltrasoundLibraryMasterCore().
uint32_t endIEReferenced by runUltrasoundLibraryMasterCore().
uint32_t endSCReferenced by runUltrasoundLibraryMasterCore().
int finished = 0Referenced by runUltrasoundLibraryMasterCore(), send_histogram_equalization(), send_image_log_compression(),send_image_noise_reduction(), send_scan_convertion(), and send_signal_processing().
uint32_t ini
Referenced by appBackground(), do_task(), and write_and_start().
uint32_t iniDSPReferenced by runUltrasoundLibraryMasterCore().
uint32_t iniIEReferenced by runUltrasoundLibraryMasterCore().
uint32_t iniSCReferenced by runUltrasoundLibraryMasterCore().
os_queue_handle que_handle
uint32_t totalT = 0Referenced by write_and_start().
Functions• void initSignalImageMemory ()• void initSignalMemoryNotCore0 ()• void processSignal (WordSize *signal, int samples, int times, int ini, Word32 *mx, Word32 *mn) Process the signal.• void produceFalseSignal (float *fs, int samples, int scan_lines) fs [in] samples [in] scan_lines [in]
void processSignal (WordSize * signal, int samples, int times, int ini, Word32 * mx, Word32 * mn)
Process the signal.Parameters:
signal [in] The current scan linesamples [in] Number of samples per scan linetimes [in] Number of scan lines to processini [in] The current scan line (only for reference)mx [in] Pointer to the maximum of the set of processed scan linesmn [in] Pointer to the minimum of the set of processed scan lines
void produceFalseSignal (float * fs, int samples, int scan_lines)fs [in] samples [in] scan_lines [in]Referenced by read_ultrasound_data().
Variable Documentation
WordSize* _globalIReferenced by initSignalImageMemory(), initSignalMemoryNotCore0(), and processSignal().
WordSize * _globalQReferenced by initSignalImageMemory(), initSignalMemoryNotCore0(), and processSignal().
WordSize * _globalSignalReferenced by appBackground(), initSignalImageMemory(), read_ultrasound_data(),runUltrasoundLibraryMasterCore(), send_image_log_compression(), and send_signal_processing().
WordSize * _globalTempSignalReferenced by processSignal().
Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().
Word32 globalMaxReferenced by runUltrasoundLibraryMasterCore().
Word32 globalMinReferenced by runUltrasoundLibraryMasterCore().
SFilter16_t hilbertFilterReferenced by initSignalImageMemory(), initSignalMemoryNotCore0(), and processSignal().
SImage_t imageReferenced by do_task(), initSignalImageMemory(), runUltrasoundLibraryMasterCore(),send_histogram_equalization(), send_image_log_compression(), send_image_noise_reduction(),send_signal_processing(), and write_and_start().
SImage_t image_NMemoryReferenced by do_task(), initSignalImageMemory(), and initSignalMemoryNotCore0().
SImage_t imageWithoutNoiseReferenced by initSignalImageMemory(), runUltrasoundLibraryMasterCore(), send_image_noise_reduction(),send_scan_convertion(), and write_and_start().
SImage_t imageWithoutNoise_NMemoryReferenced by do_task(), initSignalImageMemory(), and initSignalMemoryNotCore0().
SNoiseR_t noiseReferenced by do_task(), initSignalImageMemory(), and initSignalMemoryNotCore0().
SImage_t outImageReferenced by initSignalImageMemory(), runUltrasoundLibraryMasterCore(), send_scan_convertion(), andwrite_and_start().
SImage_t outImage_NMemoryReferenced by do_task(), initSignalImageMemory(), and initSignalMemoryNotCore0().
SFilter16_t passBandFilterReferenced by initSignalImageMemory(), initSignalMemoryNotCore0(), and processSignal().
short int* RFSignalReferenced by dummy(), initSignalImageMemory(), readData(), and readData_16().
SScanC_t scanReferenced by initSignalImageMemory(), and send_scan_convertion().
SScanC_t scanNMemoryReferenced by do_task(), and initSignalMemoryNotCore0().
D.17 Utility.h File ReferenceHeader file for the utilities.
#include <math.h>
#include "SFilter.h"
#include "SImage.h"
Defines• #define UTILITY_DEBUG 0
Functions• uint32_t utility_isqrt32v1_c (const uint32_t n) Computes the INTEGER square root of input parameter "n".• unsigned int utility_isqrt32v2_c (const unsigned int n) Computes the INTEGER square root of input parameter "n".• float utility_fsqrt_c (int _n) Computes the FLOAT square root of input parameter "_n".• unsigned short int utility_iatan2_c (int y, int x) Computes the angle between the x axis and line y = m * x line points,
(0, 0) and (x, y). This function takes into account the quadrant in which is the final point line.• Word32 sc3850_sqrt_32_c (const Word32 _x) Computes the square root of the "_x" value (32 bits version).• Word16 sc3850_sqrt_16_c (const Word16 _x) Computes the square root of the "_x" value (16 bits version).• void sc3850_my_fir_real_32x32_c (Word32 x[], Word32 h[], Word32 y[], Word16 Nr, Word16 Nh) FIR with 32 bits
real inputs and coefficients (32 bits version).• void sc3850_my_fir_real_16x16_c (Word16 x[], Word16 h[], Word16 y[], Word16 Nr, Word16 Nh) FIR with 32 bits
real inputs and coefficients (16 bits version).• Word32 sc3850_norm_32_c (const Word32 a, const Word32 b) Computes (a^2 + b^2)^(1/2) (32 bits version).• Word16 sc3850_norm_16_c (const Word16 a, const Word16 b) Computes (a^2 + b^2)^(1/2) (16 bits version).• void float2word32__ (float *_x, Word32 *_res) Converts form float representation to fixed point representation (32 bits
version).• void word32_2_float__ (Word32 *_dat, float *_res) Converts form fixed point representation to float representation
(32 bits version).• void float2word16__ (float *_x, Word16 *_res) Converts form float representation to fixed point representation (16 bits
version).• void word16_2_float__ (Word16 *_dat, float *_res) Converts form fixed point representation to float representation
(16 bits version).• void sc3850_fir_real_32x32_c (Word32 *x, Word32 *h, Word32 *y, Word32 Nr, Word32 Nh)• void sc3850_utility_brightnessRepresentation (Word32 *Signal, SImage_t *_image, const int row, const int n, const int
USA/Europe or Locations Not Listed:Freescale SemiconductorTechnical Information Center, EL5162100 East Elliot RoadTempe, Arizona 85284+1-800-521-6274 or +1-480-768-2130www.freescale.com/support
Europe, Middle East, and Africa:Freescale Halbleiter Deutschland GmbHTechnical Information CenterSchatzbogen 781829 Muenchen, Germany+44 1296 380 456 (English)+46 8 52200080 (English)+49 89 92103 559 (German)+33 1 69 35 48 48 (French)www.freescale.com/support
Japan:Freescale Semiconductor Japan Ltd.HeadquartersARCO Tower 15F1-8-1, Shimo-Meguro, Meguro-ku,Tokyo 153-0064Japan0120 191014 or +81 3 5437 [email protected]
Asia/Pacific:Freescale Semiconductor China Ltd.Exchange Building 23FNo. 118 Jianguo RoadChaoyang DistrictBeijing 100022China+86 10 5879 [email protected]
For Literature Requests Only:Freescale Semiconductor Literature Distribution Center1-800-441-2447 or +1-303-675-2140Fax: [email protected]
Document Number: MEDIMGLIBUGRev. 0, 8/2011
Information in this document is provided solely to enable system and softwareimplementers to use Freescale Semiconductors products. There are no express or impliedcopyright licenses granted hereunder to design or fabricate any integrated circuits orintegrated circuits based on the information in this document.
Freescale Semiconductor reserves the right to make changes without further notice to anyproducts herein. Freescale Semiconductor makes no warranty, representation, orguarantee regarding the suitability of its products for any particular purpose, nor doesFreescale Semiconductor assume any liability arising out of the application or use of anyproduct or circuit, and specifically disclaims any liability, including without limitationconsequential or incidental damages. "Typical" parameters that may be provided inFreescale Semiconductor data sheets and/or specifications can and do vary in differentapplications and actual performance may vary over time. All operating parameters,including "Typicals", must be validated for each customer application by customer'stechnical experts. Freescale Semiconductor does not convey any license under its patentrights nor the rights of others. Freescale Semiconductor products are not designed,intended, or authorized for use as components in systems intended for surgical implantinto the body, or other applications intended to support or sustain life, or for any otherapplication in which failure of the Freescale Semiconductor product could create asituation where personal injury or death may occur. Should Buyer purchase or useFreescale Semiconductor products for any such unintended or unauthorized application,Buyer shall indemnify Freescale Semiconductor and its officers, employees, subsidiaries,affiliates, and distributors harmless against all claims, costs, damages, and expenses, andreasonable attorney fees arising out of, directly or indirectly, any claim of personal injuryor death associated with such unintended or unauthorized use, even if such claims allegesthat Freescale Semiconductor was negligent regarding the design or manufacture ofthe part.
RoHS-compliant and/or Pb-free versions of Freescale products have the functionality andelectrical characteristics as their non-RoHS-complaint and/or non-Pb-free counterparts.For further information, see http://www.freescale.com or contact your Freescalesales representative.
For information on Freescale's Environmental Products program, go tohttp://www.freescale.com/epp.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.All other product or service names are the property of their respective owners.