ultrasound software library userguide

62
1 Introduction This document is the user guide for the Ultrasound Software Library, here you will find the elements to add the library to your project. This user guide will help you set up your project to use the library, use the ultrasound library for your own purposes, set up the CodeWarrior (CW) environment, and call the main functions for getting the desired results. You need to be familiar with the CodeWarrior IDE and C programming language. The complete process to use the ultrasound library with other CW projects are also described. 2 Product Description Here is an overview description of the product, main features, applications, and the environment requirements for the hardware and software. 2.1 Overview The ultrasound software library produces an ultrasound image from beamforming signal. The beam is stored in the memory and passes through the ultrasound library algorithms to generate an output image with the specified height and width. Freescale Semiconductor Document Number: MEDIMGLIBUG Userguide Rev. 0, 8/2011 Ultrasound Software Library Userguide © 2011 Freescale Semiconductor, Inc. Contents 1 Introduction............................................................1 2 Product Description.................................................1 3 Product execution.................................................10 4 Definitions and Acronyms....................................13 A Module Documentation........................................14 B Directory Documentation.....................................29 C Data Structure Documentation..............................30 D File Documentation..............................................34

Upload: others

Post on 12-Sep-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ultrasound Software Library Userguide

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.

Freescale Semiconductor Document Number: MEDIMGLIBUG

Userguide Rev. 0, 8/2011

Ultrasound Software LibraryUserguide

© 2011 Freescale Semiconductor, Inc.

Contents

1 Introduction............................................................1

2 Product Description.................................................1

3 Product execution.................................................10

4 Definitions and Acronyms....................................13

A Module Documentation........................................14

B Directory Documentation.....................................29

C Data Structure Documentation..............................30

D File Documentation..............................................34

Page 2: Ultrasound Software Library Userguide

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.

Digital Signal Filter

Envelope detection

Histogram Equalization

Noise Filter (speckle)

Scan Convertion

Log Compression Brightness

Beamforming process 2D Image forming

B-Mode Ultrasound

Image enhancement

Figure 1. Ultrasound library flow diagram

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

2 Freescale Semiconductor, Inc.

Page 3: Ultrasound Software Library Userguide

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

Table continues on the next page...

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 3

Page 4: Ultrasound Software Library Userguide

Features Detailed Description

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

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

4 Freescale Semiconductor, Inc.

Page 5: Ultrasound Software Library Userguide

Figure 3. Connections diagram

2.6.2 DIP Switch hardware configurationThis figure shows when switches are activated (ON).

Figure 4. Connections diagram

Figure 5 shows the configuration switches on the MCS8156ADS board.

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 5

Page 6: Ultrasound Software Library Userguide

Figure 5. MCS8156ADS Configuration switches

The following table shows all the configurations needed for the dip switches to use the library.

Switch 1

SW1.1—Boot Patch (BP)• Default—ON

SW1.2—Simple Boot from ETH (SBETH)• Default—ON (disable)

SW1.3—RIO Host (RHE)• Default—ON (disable)

SW1.4—RapidIO Pass-Through Mode 1 (RPT)• Default—ON (disable)

SW1.5—RapidIO Pass-Through Mode 2 (RIO)• Default—ON (disable)

• SW1.6-8—Boot Port (BPRT) Bits 0 - 2• Default—ON (boot from I2C EEPROM)

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

6 Freescale Semiconductor, Inc.

Page 7: Ultrasound Software Library Userguide

Switch 2

SW2.1-35—Device ID (DEVID) Bits 3:5• Default—ON (DEVID[5:3] = 0)

SW2.4—Serial RapidIO interface Port 2 (R2A)• Default: ON (no ID accepted)

SW2.5—Serial RapidIO interface Port 1 (R1A)• Default—ON (no ID accepted)

SW2.6—RGMII Port 2 IO (GE2)• Default—OFF (RGMII2 is active)

SW2.7—RGMII Port 1 IO (GE1)• Default—OFF (RGMII1 is active)

• SW2.8—SMF• Default—ON

Switch 3

SW3.1—SerDes Port 2 (S2P4)• Default: ON (S1P[4:0] = 3)• S2P: Bit 4

SW3.2-3—CLOCK-OUT Control (CLKO0, CLKO1)• Default: ON (CLKOUT = 75 MHz)

SW3.4—Serial RapidIO interface System Mode (CTLS)• Default—OFF• Works in Common Transport Large System mode.

SW3.5—Serial RapidIO interface Access Port (RMU)• Default:—ON• Selects SerDes Port1 RMU local memory access.

SW3.6-8—DEVID Bits 0–2• Default: OFF (RGMII1 is active)

• SW3.6-8—DEVID Bits 0–2• Default—ON (DEFID[2:0] = 0)

Switch 4

SW4.1-4—SerDes Port 1 (S1P) Configuration Bits 0–3• Default—OFF OFF ON ON (S0P = 3)• SerDes Port1 configures as Serial RapidIO interface x4

3.125GHz.

SW4.5-8—SerDes Port 2 (S2P) Configuration Bits 0–3• Default—OFF OFF ON ON (S1P = 3)• SerDes Port2 configures as Serial RapidIO interface x4

3.125GHz.

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 7

Page 8: Ultrasound Software Library Userguide

Switch 5

SW5.1—Debug Request• Default—OFF (MSC815x enters Debug mode after

reset.)

SW5.2—SGMII/Serial RapidIO interface Differential SwitchSelect 1

• Default—ON (MSC815x works in SerDes Port1 SerialRapidIO interface x4 mode.)

SW5.3—SGMII/Serial RapidIO interface Differential SwitchSelect 2

• Default—ON (MSC815x works in SerDes Port2 SerialRapidIO interface x4 mode.)

SW5.4—SHMOO• Default—OFF

SW5.5—SGMII or RGMII Select 1• Default—ON (RGMII mode for GE port 1).

SW5.6—SGMII or RGMII Select 2• Default—ON (RGMII mode for GE port 2).

SW5.7—PLL1EN• Default—ON (Enable to PLL).

SW5.8—Spare• Default—ON

Switch 6

SW6.1—Boot Port (BPRT) Bit 3• Default—ON (BPRT[3:0] = 0 for boot from I2C

EEPROM)

SW6.2—PCI Express Ready (PRDY)• Default—ON (Not ready for PCI Express RC mode).

SW6.3—Watchdog (EWDT)• Default: ON (Watchdog disabled).

SW6.4—PCI Express Root Complex (RC)• Default—ON (PCI Express functions if EP mode-

enabled.); hidden bit

SW6.6-8—Configuration Source (SRC) Bits 0 - 2SW6.5:RCWH30 (EC)

• Default—ON ON ON (RCW loaded from DIP-switches).

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

8 Freescale Semiconductor, Inc.

Page 9: Ultrasound Software Library Userguide

Switch 7

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/

lib_ultrasound.elb}"• "${SMARTDSP_LOC}/lib/msc815x/os_msc8156_debug.elb" • "${workspace_loc:/lib_ultrasound/Library Debug/

lib_ultrasound.elb}"• "${SMARTDSP_LOC}/lib/msc815x/os_msc8156_debug.elb" • "${workspace_loc:/lib_ultrasound/Library Debug/

lib_ultrasound.elb}"• "${SMARTDSP_LOC}/lib/msc815x/os_msc8156_debug.elb" • "${workspace_loc:/lib_ultrasound/Library Debug/

lib_ultrasound.elb}"• "${SMARTDSP_LOC}/lib/msc815x/os_msc8156_debug.elb"• "${workspace_loc:/lib_ultrasound/Library Debug/lib_ultrasound.elb}"• "${SMARTDSP_LOC}/lib/msc815x/os_msc8156_drivers_debug.elb"• "${SMARTDSP_LOC}/demos/starcore/msc815x/ads_support/ads_project/bsp_msc8156ads_debug.elb"

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"

Product Description

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 9

Page 10: Ultrasound Software Library Userguide

• "${SMARTDSP_LOC}/initialization/arch/msc815x"• "${SMARTDSP_LOC}/initialization/arch/msc815x/include"• "${SMARTDSP_LOC}/include/arch/starcore/msc815x"• "${SMARTDSP_LOC}/include/arch/starcore/core_family/sc3X00"• "${SMARTDSP_LOC}/demos/starcore/msc815x/ads_support"• "${SMARTDSP_LOC}/lib/msc815x"• "${SMARTDSP_LOC}/lib/projects/msc815x"• "${ProjDirPath}/Source"

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)

• basic_demo.c• app_config_sa.h• app_config.h• data_buffers.c• filter.dat ofilter11.dat• msc815x_config.c• os_config.h• sa_handle.c• ultrasound_main.c• ultrasound_main.h• Signal (Folder)

• SEnvelope.h• SFilter.h• SHistEQ.h• SImage.h• SNoiseR.h• SScanC.h• usLib_config.h• Utility.h

3 Product executionThis section has the steps needed to use the ultrasound software library.

3.1 Getting startedUnpackage your MSC8156 board and install the CW software version 10.1.5, update it if necessary.

Product execution

Ultrasound Software Library Userguide, Rev. 0, 8/2011

10 Freescale Semiconductor, Inc.

Page 11: Ultrasound Software Library Userguide

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.

5. In the appBackground() function

Product execution

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 11

Page 12: Ultrasound Software Library Userguide

• 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

• "${SMARTDSP_LOC}/lib/net/net_debug_sc3850.elb"• "${SMARTDSP_LOC}/lib/heat/3850_heat_lib_stdio_debug.elb"• "${SMARTDSP_LOC}/lib/heat/3850_heat_lib_debug.elb"

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

Product execution

Ultrasound Software Library Userguide, Rev. 0, 8/2011

12 Freescale Semiconductor, Inc.

Page 13: Ultrasound Software Library Userguide

1. Click Project->Clean2. Select the myHeat project and click OK3. Run the group launch configuration called myHeat

3.3.1 Hardware instructionsDiagram

The same as the previous example.

Set-upThe same as the previous example.

3.3.2 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

• "${SMARTDSP_LOC}/lib/net/net_debug_sc3850.elb"• "${SMARTDSP_LOC}/lib/heat/3850_heat_lib_stdio_debug.elb"• "${SMARTDSP_LOC}/lib/heat/3850_heat_lib_debug.elb"

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

4 Definitions and AcronymsCode Warrior—CW

Interface Development Environment—IDE

Ultrasound Library—UL

Definitions and Acronyms

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 13

Page 14: Ultrasound Software Library Userguide

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()

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).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().

void SEnvelope_doEnvelopeDTime_32 (Word32 * _Rf, const int _signalSize, SFilter_t * _filter, Word32 * _I, Word32* _Q)

SEnvelope_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

14 Freescale Semiconductor, Inc.

Page 15: Ultrasound Software Library Userguide

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()

A.2 SFilter_groupData Structures

• struct _SFilter_t• struct _SFilter16_t

Defines• #define SFILTER_DEBUG 0• #define M_PI 3.14159265

Typedefs• typedef struct _SFilter_t SFilter_t• typedef struct _SFilter16_t SFilter16_t

SFilter_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 15

Page 16: Ultrasound Software Library Userguide

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).

Define Documentation#define M_PI 3.14159265#define SFILTER_DEBUG 0

Typedef Documentation

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().

SFilter_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

16 Freescale Semiconductor, Inc.

Page 17: Ultrasound Software Library Userguide

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

SFilter_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 17

Page 18: Ultrasound Software Library Userguide

See also:SFilter_dpb()

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()

A.3 SHistEQ_groupDefines

• #define SHISTEQ_DEBUG 0• #define SHISTEQ_DEBUG_CH 0

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.

Define Documentation#define SHISTEQ_DEBUG 0#define SHISTEQ_DEBUG_CH 0

Function Documentation

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

SHistEQ_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

18 Freescale Semiconductor, Inc.

Page 19: Ultrasound Software Library Userguide

_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().

A.4 SImage_groupData Structures

• struct _SImage_t

Defines• #define SIMAGE_DEBUG 0• #define SIMAGE_DEFAULT_HISTRANGE 256

SImage_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 19

Page 20: Ultrasound Software Library Userguide

Typedefs• typedef struct _SImage_t SImage_t

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

SImage_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

20 Freescale Semiconductor, Inc.

Page 21: Ultrasound Software Library Userguide

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()

int SImage_setHistogramValue (SImage_t * _image_t, const unsigned char _histogramPosition, const int_histogramValue)

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.

SImage_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 21

Page 22: Ultrasound Software Library Userguide

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.

A.5 SNoiseR_groupData Structures

• struct _SNoiseR_t

Defines• #define SNOISER_DEBUG 0• #define SNOISER_DEBUG_EACHP 0• #define SNOISER_DEFAULT_MASKSIZE 9

Typedefs• typedef struct _SNoiseR_t SNoiseR_t

Functions• void SNoiseR_initialize (SImage_t *_image_t, SNoiseR_t *_noiseInfo) Initialize all the elements needed for applying

the noise reduction algorithms.• void SNoiseR_preNoiseReduction (SImage_t *_oldImage_t, SImage_t *_newImage_t) Performs the speckle's noise

reduction using Kuan's algorithm.• void SNoiseR_doNoiseReductionMedianParallel (SImage_t *_oldImage_t, SImage_t *_newImage_t, SNoiseR_t

*_noiseInfo, const int _row) Performs the speckle's noise reduction using median's algorithm, this is the parallelversion.

• const unsigned char SNoiseR_getMedian9ElementsArray (unsigned char *_array) Quickly computes the median of anarray of 9 elements.

Define Documentation#define SNOISER_DEBUG 0

SNoiseR_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

22 Freescale Semiconductor, Inc.

Page 23: Ultrasound Software Library Userguide

#define SNOISER_DEBUG_EACHP 0#define SNOISER_DEFAULT_MASKSIZE 9

Typedef Documentationtypedef struct _SNoiseR_t SNoiseR_t

SNoise_t Used for allocating the information for the noise reduction algorithm

Function Documentation

void SNoiseR_doNoiseReductionMedianParallel (SImage_t * _oldImage_t, SImage_t * _newImage_t, SNoiseR_t *_noiseInfo, const int _row)

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().

SScanC_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 23

Page 24: Ultrasound Software Library Userguide

A.6 SScanC_groupData Structures

• struct _SScanC_t

Defines• #define SSCANC_DEBUG 0• #define SSCAN_MPI 3.1415926• #define SSCAN_ANGLETOSHOW 16384• #define SSCAN_STARTANGLE (16384 - (SSCAN_ANGLETOSHOW / 2))• #define SSCAN_ENDANGLE (16384 + (SSCAN_ANGLETOSHOW / 2))• #define SSCAN_ORIGENSTARTANGLE (16384 - (SSCAN_STARTANGLE / 2))• #define SSCAN_RADIANS2DEGREES (32768.0 / SSCAN_MPI)• #define SSCAN_DEGREES2RADIANS (SSCAN_MPI / 32768.0)• #define SSCAN_R 10• #define SSCAN_DS 10• #define SSCAN_DE 100• #define OUTHEIGHT 640• #define OUTWIDTH 480

Typedefs• typedef struct _SScanC_t SScanC_t

Functions• void SScanC_initialize (SImage_t *_image_t, SScanC_t *_scanInformation_t) Initialize the scan conversion algorithm.• void SScanC_preScanConvertionSimple (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_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

Function Documentation

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.Precondition:

SScanC_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

24 Freescale Semiconductor, Inc.

Page 25: Ultrasound Software Library Userguide

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().

void SScanC_initialize (SImage_t * _image_t, SScanC_t * _scanInformation_t)Initialize the scan conversion algorithm.

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().

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.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().

void SScanC_preScanConvertionSimple (SImage_t * _inImage_t, SImage_t * _outImage_t, SScanC_t *_scanInformation_t)

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()

SScanC_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 25

Page 26: Ultrasound Software Library Userguide

Referenced by initSignalImageMemory().

A.7 Utility_groupDefines

• #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

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

void sc3850_fir_real_32x32_c (Word32 * x, Word32 * h, Word32 * y, Word32 Nr, Word32 Nh)

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).

Utility_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

26 Freescale Semiconductor, Inc.

Page 27: Ultrasound Software Library Userguide

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

Utility_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 27

Page 28: Ultrasound Software Library Userguide

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:

Utility_group

Ultrasound Software Library Userguide, Rev. 0, 8/2011

28 Freescale Semiconductor, Inc.

Page 29: Ultrasound Software Library Userguide

_dat [in] The value in fixed point representation_res [out] The value in float representation

Appendix B Directory DocumentationThis is the directory hierarchy.

B.1 Directoriesmyheat/ Directory Reference

Directories• directory Source

myheat/Source/signal/ Directory Reference

Files• file SEnvelope.h

Header file for the envelope detection algorithm.

• file SFilter.hHeader file for the filter algorithm. Contains the necesary functions for construct a FIR filter in time's domain.

• file SHistEQ.hHeader file for the Histogram equalization algorithm, we present two options, the one with one processor and theparallel version.

• file SImage.hHeader file for the SImage structure, this structure is used to represent the image.

• file SNoiseR.hHeader file for the Noise Reduction Algorithm.

• file SScanC.hHeader file for the Scan Conversion Algorithm.

• file usLib_config.h• file Utility.h

Header file for the utilities.

myheat/Source/ Directory Reference

Directories• directory signal

Files• file app_config.h• file app_config_sa.h• file basic_demo.c• file data_buffers.c• file msc815x_config.c• file os_config.h• file sa_handle.c

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 29

Page 30: Ultrasound Software Library Userguide

• file ultrasound_main.c• file ultrasound_main.h

Appendix C Data Structure DocumentationHere are the data structures with a brief description.

C.1 _SFilter16_t Struct Reference#include <SFilter.h>

Data Fields• Word16 * filter• int filterSize

Detailed DescriptionSFilter16_t Used for representing an image

Field Documentation

Word16* filterThe filterReferenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

int filterSizeThe filter size. It must be oddReferenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

The documentation for this structure was generated from the following file:• SFilter.h

C.2 _SFilter16_t Struct Reference#include <SFilter.h>

Data Fields• Word16 * filter• int filterSize

Detailed DescriptionSFilter16_t Used for representing an image

Field Documentation

Word16* filterThe filterReferenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

int filterSizeThe filter size. It must be oddReferenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

The documentation for this structure was generated from the following file:

Ultrasound Software Library Userguide, Rev. 0, 8/2011

30 Freescale Semiconductor, Inc.

Page 31: Ultrasound Software Library Userguide

• SFilter.h

C.3 _SImage_t Struct Reference#include <SImage.h>

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

C.4 _SNoiseR_t Struct Reference#include <SNoiseR.h>

Data Fields• unsigned char mask [9]

Detailed DescriptionSNoise_t Used for allocating the information for the noise reduction algorithm

_SImage_t Struct Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 31

Page 32: Ultrasound Software Library Userguide

Field Documentation

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 deltaEAngle of End Scan Line

_SScanC_t Struct Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

32 Freescale Semiconductor, Inc.

Page 33: Ultrasound Software Library Userguide

int deltaSAngle of Start Scan Line

int DsDepth start

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

_SScanC_t Struct Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 33

Page 34: Ultrasound Software Library Userguide

int WxROI X-length

int WyROI Y-length

The documentation for this struct was generated from the following file:• SScanC.h

Appendix D File DocumentationHere is a list of all the files with brief descriptions.

D.1 app_config.h File ReferenceDefines

• #define TEST_NUM_OF_CHANNELS 1• #define TEST_FRAMES_IN_POOL (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))• #define TEST_NUM_OF_BUFS (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))• #define TEST_DATA_SIZE 0x600• #define NUM_OF_SOCKETS_IN_TEST 4• #define APP_LLD_HEAP OS_MEM_LOCAL_NONCACHEABLE• #define BUF_SIZE 0x10000• #define ETH_CACHE_POLICY (L2CACHE_ENABLE ? (DCACHE_ENABLE ? L1_L2_CACHED :

L2_CACHED) : DCACHE_ENABLE)• #define CORES_SHARING_CONSOLE

Define Documentation

#define APP_LLD_HEAP OS_MEM_LOCAL_NONCACHEABLE

#define BUF_SIZE 0x10000

#define CORES_SHARING_CONSOLE

#define ETH_CACHE_POLICY (L2CACHE_ENABLE ? (DCACHE_ENABLE ? L1_L2_CACHED :L2_CACHED) : DCACHE_ENABLE)

#define NUM_OF_SOCKETS_IN_TEST 4Referenced by appInit_sa(), and netInit().

#define TEST_DATA_SIZE 0x600Referenced by appInit_sa(), and netInit().

#define TEST_FRAMES_IN_POOL (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))Referenced by appInit_sa(), and netInit().

#define TEST_NUM_OF_BUFS (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))Referenced by appInit_sa(), and netInit().

#define TEST_NUM_OF_CHANNELS 1Referenced by initChannelMacIpAddress().

Ultrasound Software Library Userguide, Rev. 0, 8/2011

34 Freescale Semiconductor, Inc.

Page 35: Ultrasound Software Library Userguide

D.2 app_config_sa.h File ReferenceDefines

• #define TEST_NUM_OF_CHANNELS 1• #define TEST_FRAMES_IN_POOL (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))• #define TEST_NUM_OF_BUFS (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))• #define TEST_DATA_SIZE 0x600• #define NUM_OF_SOCKETS_IN_TEST 4• #define APP_LLD_HEAP OS_MEM_LOCAL_NONCACHEABLE• #define BUF_SIZE 0x10000• #define DEFAULT_GATEWAY_IP_ADDRESS 0x0A0000FF• #define MY_IP_ADDRESS 0x0A000001• #define SERVER_IP_ADDRESS 0x0A000064• #define MY_MAC_ADDR_HIGH32 0xc2c3c4c5• #define MY_MAC_ADDR_LOW16 0xc6c7

Functions• void sa_ter_handle (unsigned long arg_count)

Define Documentation

#define APP_LLD_HEAP OS_MEM_LOCAL_NONCACHEABLE

#define BUF_SIZE 0x10000

#define DEFAULT_GATEWAY_IP_ADDRESS 0x0A0000FF

#define MY_IP_ADDRESS 0x0A000001Referenced by initChannelMacIpAddress().

#define MY_MAC_ADDR_HIGH32 0xc2c3c4c5

#define MY_MAC_ADDR_LOW16 0xc6c7Referenced by initChannelMacIpAddress().

#define NUM_OF_SOCKETS_IN_TEST 4

#define SERVER_IP_ADDRESS 0x0A000064

#define TEST_DATA_SIZE 0x600

#define TEST_FRAMES_IN_POOL (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))

#define TEST_NUM_OF_BUFS (TEST_NUM_OF_CHANNELS * (32 + 32 + 5))

#define TEST_NUM_OF_CHANNELS 1

Function Documentation

void sa_ter_handle (unsigned long arg_count)References appInit_sa(), current_file_index_0, current_file_index_1, current_file_index_2, current_file_index_3,current_file_index_4, current_file_index_5, SA_HEAT_CHUNK, and test_sockets.

D.3 basic_demo.c File Reference#include "ultrasound_main.h"

#include "smartdsp_os.h"

#include "os_config.h"

basic_demo.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 35

Page 36: Ultrasound Software Library Userguide

#include "os_mmu.h"

#include "os_cache.h"

#include "msc815x_mmu.h"

#include "msc815x_uec.h"

#include "net_if_ethernet.h"

#include "net_udp.h"

#include "net_arp.h"

#include "app_config.h"

#include "msc815x_hwi.h"

#include "net_dhcp.h"

#include "os_heat.h"

#include "os_heat_stdio.h"

Defines• #define MY_IP_ADDRESS 0x0A000001• #define SERVER_IP_ADDRESS 0x0A000064• #define MY_MAC_ADDR_HIGH32 0xc2c3c4c5• #define MY_MAC_ADDR_LOW16 0xc6c7• #define protect_console() osSpinLockSwiftGet(&console_spinlock)• #define unprotect_console() osSpinLockSwiftRelease(&console_spinlock)• #define READ_FROM_FILE ON

Functions• os_spinlock_handle console_spinlock __attribute__ ((section(".os_shared_data")))=0• static void netPoll ()• static os_status udpReceiveCallBack (void *p, os_frame_t *frame)• static void initChannelMacIpAddress ()• static os_status netInit ()• void test_heat (void)• void restore_heat (void)• int INT_little_endian_TO_big_endian (int i)• short int SHORT_little_endian_TO_big_endian (short int i)• void readData (char *in_file, Word32 *signal)• void dummy (Word32 *signal)• void readData_16 (char *in_file, Word16 *signal)• void read_ultrasound_data (void)• void printfStream (char *fname, unsigned char *buf, int scan_lines, int samples)• void write_and_start ()• static os_status appInit ()• static void appBackground (void)• void main ()

Variables

• uint8_t core_channel_offset• uint8_t buffers_space []• os_frame_t * current_frame• bio_dev_handle uec_handle• os_frames_pool_t * sb_frames_pool• os_mem_part_t * buffers_pool• uint8_t mem_manager [MEM_PART_SIZE(TEST_NUM_OF_BUFS)]

basic_demo.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

36 Freescale Semiconductor, Inc.

Page 37: Ultrasound Software Library Userguide

• struct ethercom ifn• os_socket_handler_t test_sockets [NUM_OF_SOCKETS_IN_TEST]• bio_channel_t rx_channel• bio_channel_t tx_channel• uint32_t mac_addr [2]• uint32_t ip_addr• struct heat_connection_t server_connection_global• int frames = 0• char input_file [50]• float total_time = 0

Define Documentation

#define MY_IP_ADDRESS 0x0A000001Referenced by initChannelMacIpAddress().

#define MY_MAC_ADDR_HIGH32 0xc2c3c4c5

#define MY_MAC_ADDR_LOW16 0xc6c7 Referenced by initChannelMacIpAddress().

#define protect_console() osSpinLockSwiftGet(&console_spinlock)Referenced by appBackground(), and write_and_start().

#define READ_FROM_FILE ON #define SERVER_IP_ADDRESS 0x0A000064

#define unprotect_console() osSpinLockSwiftRelease(&console_spinlock)Referenced by appBackground(), and write_and_start().

Function Documentation

os_spinlock_handle console_spinlock __attribute__ ((section(".os_shared_data"))) [pure virtual]

static void appBackground (void) [static]References _globalSignal, algorithm_status, COMPLETE_TASK, CORE0_TO_OTHERS_MESSAGE, end, ini,OTHERS_TO_CORE0_MESSAGE, printfStream(), processSignal(), protect_console, read_ultrasound_data(),readData(), runUltrasoundLibraryOtherCore(), SAMPLES, SCAN_LINES, server_connection_global, test_heat(),unprotect_console, and write_and_start().Referenced by main().

static os_status appInit () [static]References CORE0_TO_OTHERS_MESSAGE, initUltrasoundLibrary(), netInit(),OTHERS_TO_CORE0_MESSAGE, runUltrasoundLibraryMasterCore(), and runUltrasoundLibraryOtherCore().Referenced by main().

void dummy (Word32 * signal)References RFSignal, and SCAN_LINES.

static void initChannelMacIpAddress () [static]References MY_IP_ADDRESS, MY_MAC_ADDR_LOW16, and TEST_NUM_OF_CHANNELS.Referenced by netInit().

int INT_little_endian_TO_big_endian (int i)

void main ()References appBackground(), and appInit().

static os_status netInit () [static]References ifn, initChannelMacIpAddress(), NUM_OF_SOCKETS_IN_TEST, TEST_DATA_SIZE,TEST_FRAMES_IN_POOL, and TEST_NUM_OF_BUFS.Referenced by appInit().

basic_demo.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 37

Page 38: Ultrasound Software Library Userguide

static void netPoll () [static]

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().

void readData_16 (char * in_file, Word16 * signal)References RFSignal, SAMPLES, SCAN_LINES, server_connection_global, andSHORT_little_endian_TO_big_endian().Referenced by read_ultrasound_data().

void restore_heat (void)

short int SHORT_little_endian_TO_big_endian (short int i)Referenced by readData(), and readData_16().

void test_heat (void)References server_connection_global.Referenced by appBackground().

static os_status udpReceiveCallBack (void * p, os_frame_t * frame) [static]

void write_and_start ()References end, _SImage_t::height, image, _SImage_t::image, imageWithoutNoise, ini, OS_TICK_PARAMETER,outImage, printfStream(), protect_console, read_ultrasound_data(), totalT, totDSP, totIE, totSC, unprotect_console, and_SImage_t::width.Referenced by appBackground().

Variable Documentation

os_mem_part_t* buffers_poolReferenced by appInit_sa().

uint8_t buffers_spaceReferenced by appInit_sa().

uint8_t core_channel_offsetReferenced by appInit_sa(), and initChannelMacIpAddress().

os_frame_t* current_frame

int frames = 0

struct ethercom ifnReferenced by appInit_sa(), and netInit().

char input_file[50]

uint32_t ip_addrReferenced by appInit_sa(), and initChannelMacIpAddress().

uint32_t mac_addr[2]

basic_demo.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

38 Freescale Semiconductor, Inc.

Page 39: Ultrasound Software Library Userguide

Referenced by appInit_sa(), and initChannelMacIpAddress().

uint8_t mem_manager[MEM_PART_SIZE(TEST_NUM_OF_BUFS)]Referenced by appInit_sa().

bio_channel_t rx_channelBIO channelReferenced by appInit_sa(), and netPoll().

os_frames_pool_t* sb_frames_poolReferenced by appInit_sa().

struct heat_connection_t server_connection_globalReferenced by appBackground(), printfStream(), readData(), readData_16(), and test_heat().

os_socket_handler_t test_sockets[NUM_OF_SOCKETS_IN_TEST]Referenced by appInit_sa(), and sa_ter_handle().

float total_time = 0

bio_channel_t tx_channelReferenced by appInit_sa().

bio_dev_handle uec_handleReferenced by appInit_sa().

D.4 data_buffers.c File Reference#include "smartdsp_os.h"

#include "app_config_sa.h"

Variables• uint8_t buffers_space [TEST_NUM_OF_BUFS *TEST_DATA_SIZE]

Variable Documentationuint8_t buffers_space[TEST_NUM_OF_BUFS *TEST_DATA_SIZE]Referenced by appInit_sa().

D.5 msc815x_config.c File Reference#include "smartdsp_os_.h"

#include "os_init.h"

#include "app_config_sa.h"

#include "os_config.h"

#include "msc815x_memmap.h"

#include "msc815x_dma.h"

#include "msc815x_init.h"

#include "msc815x_dma_init.h"

data_buffers.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 39

Page 40: Ultrasound Software Library Userguide

#include "msc815x_uec_init.h"

#include "msc815x_hwi.h"

Variables

• platform_init_params_t platform_params• msc815x_uec_init_params_t msc815x_uec_init_params_0

Variable Documentation

msc815x_uec_init_params_t msc815x_uec_init_params_0

Initial value: { UEC_ID0, 0xFEE02000,

UEC_IF_RGMII,

(UEC_DEF_FLAGS | UEC_CFG_ENABLE_STATISTICS | UEC_CFG_ENABLE_ADDITIONAL_STATISTICS),

OS_HWI_PRIORITY0, 32, 16, TEST_DATA_SIZE, OS_NUM_OF_CORES*TEST_NUM_OF_CHANNELS, OS_NUM_OF_CORES*TEST_NUM_OF_CHANNELS, UEC_DEF_NUM_OF_THREADS, UEC_DEF_NUM_OF_THREADS, TRUE, NULL, NULL }

platform_init_params_t platform_params

Initial value: { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE,}

D.6 os_config.h File Reference#include "smartdsp_os_device.h"

#include "app_config.h"

Defines

•#define ON 1

os_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

40 Freescale Semiconductor, Inc.

Page 41: Ultrasound Software Library Userguide

•#define OFF 0

•#define OS_HEAP_M3_SIZE 0x4000

•#define OS_HEAP_SIZE 0x6800

•#define OS_STACK_SIZE 0x1000

•#define OS_HEAP_NONCACHEABLE_SIZE 0x2000

•#define OS_SHARED_MEM_SIZE 0x10000/*1024*/

•#define OS_L2_CACHE_SIZE ((uint32_t)&_L2_cache_size)

•#define MyKByte 1024

•#define MyMByte 1024 * MyKByte

•#define OS_SHARED_MEM_DDR0_SIZE 25 * MyMByte

•#define OS_SHARED_MEM_M3_SIZE 1000

•#define OS_TICK ON

•#define OS_TICK_PRIORITY OS_SWI_PRIORITY0

•#define OS_TICK_PARAMETER MSC815X_TICK_001MS

•#define OS_CLKIN 100.0

•#define OS_SYSTEM_CLOCK OS_CLKIN

•#define OS_HW_TIMERS ON

•#define OS_TOTAL_NUM_OF_MEM_PARTS 8

•#define OS_TOTAL_NUM_OF_FRAME_POOLS 8

•#define OS_TOTAL_NUM_OF_SWI 10

•#define OS_TOTAL_NUM_OF_SW_TIMERS 0

•#define OS_TOTAL_NUM_OF_QUEUES 48+2

•#define OS_TOTAL_NUM_OF_EVENT_SEMAPHORES 15

•#define OS_TOTAL_NUM_OF_MESSAGE_QUEUES 6

•#define OS_MULTICORE_SYNCHRONIZATION ON

•#define OS_TOTAL_NUM_OF_INTERCORE_MESSAGES 1

•#define OS_NUM_OF_CORES 6

•#define OS_MAX_NUM_OF_CORES MSC815X_MAX_NUM_OF_CORES

•#define OS_MASTER_CORE 0 •#define MSC815X_QBUS MSC815X_QBUS_DEFAULT

•#define MSC815X_SYS_REGS MSC815X_SYS_REGS_DEFAULT

•#define MSC815X_QE MSC815X_QE_DEFAULT

•#define MAX_NUM_OF_DATA_CONTEXTS 10

•#define MAX_NUM_OF_PROG_CONTEXTS 10

•#define DCACHE_ENABLE ON

•#define ICACHE_ENABLE ON

•#define L2CACHE_ENABLE ON

•#define OS_PRAM_MEM_BASE (MSC815X_QE + 0x10000) /* For PPC: 0xE0110000 */

os_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 41

Page 42: Ultrasound Software Library Userguide

•#define OS_PRAM_MEM_SIZE 0xC000

•#define MSC815X_DMA OFF

•#define MSC815X_SPI OFF

•#define MSC815X_UART OFF

•#define MSC815X_UEC0 ON

•#define MSC815X_UEC1 OFF

•#define MSC815X_RIONET0 OFF

•#define MSC815X_RIONET1 OFF

•#define MSC815X_ATM OFF

•#define MSC815X_TDM0 OFF

•#define MSC815X_TDM1 OFF

•#define MSC815X_TDM2 OFF

•#define MSC815X_TDM3 OFF

•#define MSC815X_TDM4 OFF

•#define MSC815X_TDM5 OFF

•#define MSC815X_TDM6 OFF

•#define MSC815X_TDM7 OFF

•#define OS_TOTAL_NUM_OF_CIO_DEVICES (MSC815X_SPI + MSC815X_UART)

•#define OS_TOTAL_NUM_OF_BIO_DEVICES (MSC815X_UEC0 + MSC815X_UEC1 + MSC815X_RIONET0 +MSC815X_RIONET1 + MSC815X_ATM)

•#define OS_TOTAL_NUM_OF_SIO_DEVICES (MSC815X_TDM0 + MSC815X_TDM1 + MSC815X_TDM2 +MSC815X_TDM3 + MSC815X_TDM4 + MSC815X_TDM5 + MSC815X_TDM6 + MSC815X_TDM7)

•#define OS_TOTAL_NUM_OF_COP_DEVICES 0

•#define USER_KERNEL_AWARENESS_STACK OFF

•#define KERNEL_AWARENESS_ADDR &KernelAwareness_b

•#define KERNEL_AWARENESS_STACK_SIZE (uint32_t)&KernelAwareness_size

Variables• volatile uint32_t KernelAwareness_b• volatile uint32_t KernelAwareness_size

Define Documentation

#define DCACHE_ENABLE ON

#define ICACHE_ENABLE ON

#define KERNEL_AWARENESS_ADDR &KernelAwareness_b

#define KERNEL_AWARENESS_STACK_SIZE (uint32_t)&KernelAwareness_size

#define L2CACHE_ENABLE ON

#define MAX_NUM_OF_DATA_CONTEXTS 10

#define MAX_NUM_OF_PROG_CONTEXTS 10

#define MSC815X_ATM OFF

os_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

42 Freescale Semiconductor, Inc.

Page 43: Ultrasound Software Library Userguide

#define MSC815X_DMA OFF

#define MSC815X_QBUS MSC815X_QBUS_DEFAULT

#define MSC815X_QE MSC815X_QE_DEFAULT

#define MSC815X_RIONET0 OFF

#define MSC815X_RIONET1 OFF

#define MSC815X_SPI OFF

#define MSC815X_SYS_REGS MSC815X_SYS_REGS_DEFAULT

#define MSC815X_TDM0 OFF

#define MSC815X_TDM1 OFF

#define MSC815X_TDM2 OFF

#define MSC815X_TDM3 OFF

#define MSC815X_TDM4 OFF

#define MSC815X_TDM5 OFF

#define MSC815X_TDM6 OFF

#define MSC815X_TDM7 OFF

#define MSC815X_UART OFF

#define MSC815X_UEC0 ON

#define MSC815X_UEC1 OFF

#define MyKByte 1024

#define MyMByte 1024 * MyKByte

#define OFF 0

#define ON 1

#define OS_CLKIN 100.0

#define OS_HEAP_M3_SIZE 0x4000

#define OS_HEAP_NONCACHEABLE_SIZE 0x2000

#define OS_HEAP_SIZE 0x6800

#define OS_HW_TIMERS ON

#define OS_L2_CACHE_SIZE ((uint32_t)&_L2_cache_size)

#define OS_MASTER_CORE 0

#define OS_MAX_NUM_OF_CORES MSC815X_MAX_NUM_OF_CORES

#define OS_MULTICORE_SYNCHRONIZATION ON

#define OS_NUM_OF_CORES 6

#define OS_PRAM_MEM_BASE (MSC815X_QE + 0x10000) /* For PPC: 0xE0110000 */

#define OS_PRAM_MEM_SIZE 0xC000

#define OS_SHARED_MEM_DDR0_SIZE 25 * MyMByte

#define OS_SHARED_MEM_M3_SIZE 1000

#define OS_SHARED_MEM_SIZE 0x10000/*1024*/

os_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 43

Page 44: Ultrasound Software Library Userguide

#define OS_STACK_SIZE 0x1000

#define OS_SYSTEM_CLOCK OS_CLKIN

#define OS_TICK ON

#define OS_TICK_PARAMETER MSC815X_TICK_001MS Referenced by write_and_start().

#define OS_TICK_PRIORITY OS_SWI_PRIORITY0

#define OS_TOTAL_NUM_OF_BIO_DEVICES (MSC815X_UEC0 + MSC815X_UEC1 + MSC815X_RIONET0 +MSC815X_RIONET1 + MSC815X_ATM)

#define OS_TOTAL_NUM_OF_CIO_DEVICES (MSC815X_SPI + MSC815X_UART)

#define OS_TOTAL_NUM_OF_COP_DEVICES 0

#define OS_TOTAL_NUM_OF_EVENT_SEMAPHORES 15

#define OS_TOTAL_NUM_OF_FRAME_POOLS 8

#define OS_TOTAL_NUM_OF_INTERCORE_MESSAGES 1

#define OS_TOTAL_NUM_OF_MEM_PARTS 8

#define OS_TOTAL_NUM_OF_MESSAGE_QUEUES 6

#define OS_TOTAL_NUM_OF_QUEUES 48+2

#define OS_TOTAL_NUM_OF_SIO_DEVICES (MSC815X_TDM0 + MSC815X_TDM1 + MSC815X_TDM2 +MSC815X_TDM3 + MSC815X_TDM4 + MSC815X_TDM5 + MSC815X_TDM6 + MSC815X_TDM7)

#define OS_TOTAL_NUM_OF_SW_TIMERS 0

#define OS_TOTAL_NUM_OF_SWI 10

#define USER_KERNEL_AWARENESS_STACK OFF

Variable Documentationvolatile uint32_t KernelAwareness_bvolatile uint32_t KernelAwareness_size

D.7 sa_handle.c File Reference#include <cstdlib>

#include "smartdsp_os.h"

#include "os_config.h"

#include "os_mmu.h"

#include "os_cache.h"

#include "msc815x_mmu.h"

#include "msc815x_uec.h"

#include "net_if_ethernet.h"

#include "net_udp.h"

#include "net_arp.h"

#include "msc815x_hwi.h"

#include "net_dhcp.h"

sa_handle.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

44 Freescale Semiconductor, Inc.

Page 45: Ultrasound Software Library Userguide

#include "os_heat.h"

#include "os_heat_stdio.h"

#include "app_config_sa.h"

Defines

• #define FRAME_SINGLE_BUFFER_ONLY• #define VTB_EN 0x1• #define OCE_EN 0x10• #define OCE_DIS 0xFFEF• #define ECNT_DIS 0xFF0F• #define DPU_CNTS_DIS 0xFFF0FFFF• #define SA_HEAT_CHUNK 10240

Functions• static void netPoll ()• static os_status udpReceiveCallBack (void *p, os_frame_t *frame)• static void initChannelMacIpAddress ()• static os_status appInit_sa ()• void sa_ter_handle (unsigned long arg_count)

Variables• uint8_t core_channel_offset• volatile unsigned long current_file_index_0 = 0• volatile unsigned long current_file_index_1 = 0• volatile unsigned long current_file_index_2 = 0• volatile unsigned long current_file_index_3 = 0• volatile unsigned long current_file_index_4 = 0• volatile unsigned long current_file_index_5 = 0• uint8_t buffers_space []• os_frame_t * current_frame• bio_dev_handle uec_handle• os_frames_pool_t * sb_frames_pool• os_mem_part_t * buffers_pool• uint8_t mem_manager [MEM_PART_SIZE(TEST_NUM_OF_BUFS)]• struct ethercom ifn• os_socket_handler_t test_sockets [NUM_OF_SOCKETS_IN_TEST]• bio_channel_t rx_channel• bio_channel_t tx_channel• uint32_t mac_addr [2]• uint32_t ip_addr

Define Documentation

#define DPU_CNTS_DIS 0xFFF0FFFF

#define ECNT_DIS 0xFF0F

#define FRAME_SINGLE_BUFFER_ONLY

#define OCE_DIS 0xFFEF

#define OCE_EN 0x10

#define SA_HEAT_CHUNK 10240Referenced by sa_ter_handle()

#define VTB_EN 0x1

sa_handle.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 45

Page 46: Ultrasound Software Library Userguide

Function Documentation

static os_status appInit_sa () [static]References buffers_pool, buffers_space, core_channel_offset, ifn, initChannelMacIpAddress(), ip_addr, mac_addr,mem_manager, NUM_OF_SOCKETS_IN_TEST, rx_channel, sb_frames_pool, TEST_DATA_SIZE,TEST_FRAMES_IN_POOL, TEST_NUM_OF_BUFS, test_sockets, tx_channel, and uec_handle.Referenced by sa_ter_handle().

static void initChannelMacIpAddress () [static]References core_channel_offset, ip_addr, mac_addr, MY_IP_ADDRESS, MY_MAC_ADDR_LOW16, andTEST_NUM_OF_CHANNELS.Referenced by appInit_sa().

static void netPoll () [static]References rx_channel.

void sa_ter_handle (unsigned long arg_count)References appInit_sa(), current_file_index_0, current_file_index_1, current_file_index_2, current_file_index_3,current_file_index_4, current_file_index_5, SA_HEAT_CHUNK, and test_sockets.

static os_status udpReceiveCallBack (void * p, os_frame_t * frame) [static]

Variable Documentation

os_mem_part_t* buffers_pool

uint8_t buffers_space[]

uint8_t core_channel_offset

volatile unsigned long current_file_index_0 = 0Referenced by sa_ter_handle().

volatile unsigned long current_file_index_1 = 0Referenced by sa_ter_handle().

volatile unsigned long current_file_index_2 = 0Referenced by sa_ter_handle().

volatile unsigned long current_file_index_3 = 0Referenced by sa_ter_handle().

volatile unsigned long current_file_index_4 = 0Referenced by sa_ter_handle().

volatile unsigned long current_file_index_5 = 0Referenced by sa_ter_handle().

os_frame_t* current_frame

struct ethercom ifn

uint32_t ip_addr

uint32_t mac_addr[2]

uint8_t mem_manager[MEM_PART_SIZE(TEST_NUM_OF_BUFS)]

bio_channel_t rx_channelBIO channel

os_frames_pool_t* sb_frames_pool

sa_handle.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

46 Freescale Semiconductor, Inc.

Page 47: Ultrasound Software Library Userguide

os_socket_handler_t test_sockets[NUM_OF_SOCKETS_IN_TEST]

bio_channel_t tx_channel

bio_dev_handle uec_handle

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.

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

SEnvelope.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 47

Page 48: Ultrasound Software Library Userguide

#include <math.h>

#include <prototype.h>

Data Structures• struct _SFilter_t• struct _SFilter16_t

Defines• #define SFILTER_DEBUG 0• #define M_PI 3.14159265

Typedefs• typedef struct _SFilter_t SFilter_t• typedef struct _SFilter16_t SFilter16_t

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.

#include "stdio.h"

#include "stdlib.h"

#include "string.h"

#include "SImage.h"

Defines

SHistEQ.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

48 Freescale Semiconductor, Inc.

Page 49: Ultrasound Software Library Userguide

• #define SHISTEQ_DEBUG 0• #define SHISTEQ_DEBUG_CH 0

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.

#include "stdio.h"

#include "stdlib.h"

#include "string.h"

#include "prototype.h"

Data Structures• struct _SImage_t

Defines• #define SIMAGE_DEBUG 0• #define SIMAGE_DEFAULT_HISTRANGE 256

Typedefs• typedef struct _SImage_t SImage_t

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.

SImage.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 49

Page 50: Ultrasound Software Library Userguide

• void SImage_setColor (SImage_t *_image_t, const unsigned char _color) Sets a color to the complete image, the colormust be in range [0,255].

• int SImage_computeHistogram (SImage_t *_image_t) Compute the image's histogram, you should call this functionwhen the image has changed.

Detailed Description

Header file for the SImage structure, this structure is used to represent the image.

Id:

SImage_1.0.0

D.12 SNoiseR.h File ReferenceHeader file for the Noise Reduction Algorithm.

#include "stdio.h"

#include "stdlib.h"

#include "string.h"

#include "prototype.h"

#include "SImage.h"

Data Structures• struct _SNoiseR_t• #define SNOISER_DEBUG 0• #define SNOISER_DEBUG_EACHP 0• #define SNOISER_DEFAULT_MASKSIZE 9

Typedefs• typedef struct _SNoiseR_t SNoiseR_t

Functions• void SNoiseR_initialize (SImage_t *_image_t, SNoiseR_t *_noiseInfo) Initialize all the elements needed for applying

the noise reduction algorithms.• void SNoiseR_preNoiseReduction (SImage_t *_oldImage_t, SImage_t *_newImage_t) Performs the speckle's noise

reduction using Kuan's algorithm.• void SNoiseR_doNoiseReductionMedianParallel (SImage_t *_oldImage_t, SImage_t *_newImage_t, SNoiseR_t

*_noiseInfo, const int _row) Performs the speckle's noise reduction using median's algorithm, this is the parallelversion.

• const unsigned char SNoiseR_getMedian9ElementsArray (unsigned char *_array) Quickly computes the median of anarray of 9 elements.

Detailed Description

Header file for the Noise Reduction Algorithm.

Id:

SNoiseR_1.0.0

SNoiseR.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

50 Freescale Semiconductor, Inc.

Page 51: Ultrasound Software Library Userguide

D.13 SScanC.h File ReferenceHeader file for the Scan Conversion Algorithm.

#include "stdio.h"

#include "stdlib.h"

#include "string.h"

#include <math.h>

#include "SImage.h"

#include "Utility.h"

Data Structures• struct _SScanC_t

Defines• #define SSCANC_DEBUG 0• #define SSCAN_MPI 3.1415926• #define SSCAN_ANGLETOSHOW 16384• #define SSCAN_STARTANGLE (16384 - (SSCAN_ANGLETOSHOW / 2))• #define SSCAN_ENDANGLE (16384 + (SSCAN_ANGLETOSHOW / 2))• #define SSCAN_ORIGENSTARTANGLE (16384 - (SSCAN_STARTANGLE / 2))• #define SSCAN_RADIANS2DEGREES (32768.0 / SSCAN_MPI)• #define SSCAN_DEGREES2RADIANS (SSCAN_MPI / 32768.0)• #define SSCAN_R 10• #define SSCAN_DS 10• #define SSCAN_DE 100• #define OUTHEIGHT 640• #define OUTWIDTH 480

Typedefs• typedef struct _SScanC_t SScanC_t

Functions• void SScanC_initialize (SImage_t *_image_t, SScanC_t *_scanInformation_t) Initialize the scan conversion algorithm.• void SScanC_preScanConvertionSimple (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_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.

Detailed Description

Id:

SScanC_1.0.0

D.14 ultrasound_main.c File Reference#include "ultrasound_main.h"

Functions• void initSignalImageMemory ()• void initSignalMemoryNotCore0 ()

ultrasound_main.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 51

Page 52: Ultrasound Software Library Userguide

• 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 initUltrasoundLibrary (const int id)

Variables• uint32_t message_enqueue_counter = 0• uint32_t sent_to_queue_counter = 0• uint32_t core0_encodes_by_self_counter = 0

Function Documentation

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 initSignalImageMemory ()References _globalI, _globalQ, _globalSignal, custom_filter, _SFilter16_t::filter, FILTER_SIZE,_SFilter16_t::filterSize, _SImage_t::height, HIGHT_FREQUENCY, HILBERT_FILTER_SIZE, hilbertFilter,_SImage_t::image, image, image_NMemory, imageWithoutNoise, imageWithoutNoise_NMemory,LOW_FREQUENCY, noise, outImage, outImage_NMemory, passBandFilter, _SScanC_t::preTable, RFSignal,SAMPLE_FREQUENCY, SAMPLES, SC_HEIGHT, SC_WIDTH, scan, SEnvelope_hilbertFilter_16(),SFilter_dofilter_16(), SFilter_dofilter_32(), SFilter_initialize_16(), SFilter_initialize_32(), SHistEQ_initialize(),SIMAGE_DEFAULT_HISTRANGE, SImage_initialize(), SImage_initialize_No_Mem(), SNoiseR_initialize(),SScanC_initialize(), SScanC_preScanConvertionSimple(), _SImage_t::width, and WordSize.Referenced by initUltrasoundLibrary().

void initSignalMemoryNotCore0 ()References _globalI, _globalQ, custom_filter, _SFilter16_t::filter, FILTER_SIZE, _SFilter16_t::filterSize,HIGHT_FREQUENCY, HILBERT_FILTER_SIZE, hilbertFilter, image_NMemory, imageWithoutNoise_NMemory,LOW_FREQUENCY, noise, outImage_NMemory, passBandFilter, SAMPLE_FREQUENCY, SAMPLES,SC_HEIGHT, SC_WIDTH, scanNMemory, SEnvelope_hilbertFilter_16(), SFilter_dofilter_16(), SFilter_dofilter_32(),SFilter_initialize_16(), SFilter_initialize_32(), SIMAGE_DEFAULT_HISTRANGE, SImage_initialize_No_Mem(),SNoiseR_initialize(), SScanC_initialize(), SScanC_preScanConvertionParallel(), and WordSize.Referenced by initUltrasoundLibrary().

void initUltrasoundLibrary (const int id)References initSignalImageMemory(), and initSignalMemoryNotCore0().Referenced by appInit().

ultrasound_main.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

52 Freescale Semiconductor, Inc.

Page 53: Ultrasound Software Library Userguide

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

References _globalI, _globalQ, _globalTempSignal, hilbertFilter, passBandFilter, SAMPLES,sc3850_EnvelopeAndLogCompression(), SEnvelope_doEnvelopeDTime_16(), SFilter_filterSignal_16(), andSFilter_filterSignal_32().

Referenced by appBackground(), and do_task().

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().

ultrasound_main.c File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 53

Page 54: Ultrasound Software Library Userguide

void send_signal_processing ()References _globalSignal, ACTIVE_CORES, algorithm_status, CORE0_TO_OTHERS_MESSAGE, finished,_SImage_t::image, image, SAMPLES, and SCAN_LINES.Referenced by runUltrasoundLibraryMasterCore().

Variable Documentation

uint32_t core0_encodes_by_self_counter = 0

uint32_t message_enqueue_counter = 0

uint32_t sent_to_queue_counter = 0

D.15 ultrasound_main.h File Reference#include "smartdsp_os.h"

#include "os_config.h"

#include "signal/usLib_config.h"

Defines• #define CORE0_TO_OTHERS_MESSAGE 1• #define OTHERS_TO_CORE0_MESSAGE 2• #define INTERCORE_QUEUES ON• #define ACTIVE_CORES 5• #define START 1• #define SIGNAL_TASK 2• #define HISTOGRAM_TASK 3• #define IMAGE_TASK 4• #define SCAN_CONVERTION_TASK 5• #define COMPLETE_TASK 6• #define LOG_COMPRESSION_TASK 7• #define PARAREL_HISTOGRAM OFF• #define PARAREL_LOG_COMPRESSION OFF

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.

Variables• uint32_t ini• uint32_t end• uint32_t iniDSP• uint32_t endDSP• uint32_t iniIE• uint32_t endIE• uint32_t iniSC• uint32_t endSC

ultrasound_main.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

54 Freescale Semiconductor, Inc.

Page 55: Ultrasound Software Library Userguide

• uint32_t totDSP = 0• uint32_t totIE = 0• uint32_t totSC = 0• uint32_t totalT = 0• os_queue_handle que_handle• os_queue_handle ctrl_que_handle• int finished = 0• uint32_t CoresWork [6] = {0}• int algorithm_status

Define Documentation

#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.

ultrasound_main.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 55

Page 56: Ultrasound Software Library Userguide

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().

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().

ultrasound_main.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

56 Freescale Semiconductor, Inc.

Page 57: Ultrasound Software Library Userguide

uint32_t totDSP = 0Referenced by runUltrasoundLibraryMasterCore(), and write_and_start().

uint32_t totIE = 0Referenced by runUltrasoundLibraryMasterCore(), and write_and_start().

uint32_t totSC = 0Referenced by runUltrasoundLibraryMasterCore(), and write_and_start().

D.16 usLib_config.h File Reference#include "SEnvelope.h"

#include "SFilter.h"

#include "Utility.h"

#include "SImage.h"

#include "SHistEQ.h"

#include "SNoiseR.h"

#include "SScanC.h"

#include "filter11.dat"

Defines• #define COMPLETE_SIGNAL 1• #define SAMPLES 1556• #define SCAN_LINES 360• #define FILTER_SIZE 12• #define HILBERT_FILTER_SIZE 12• #define CORES 6• #define LOW_FREQUENCY 5• #define HIGHT_FREQUENCY 10• #define SAMPLE_FREQUENCY 20• #define WordSize Word32• #define Word32Size ON• #define SC_WIDTH 640• #define SC_HEIGHT 480• #define BITS_TO_RIGHT 11

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]

Variables• SFilter16_t hilbertFilter• SFilter16_t passBandFilter• Word32 custom_filter [FILTER_SIZE]• WordSize * _globalI• WordSize * _globalQ• WordSize * _globalTempSignal• WordSize * _globalSignal

usLib_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 57

Page 58: Ultrasound Software Library Userguide

• Word32 globalMax• Word32 globalMin• short int * RFSignal• SImage_t image• SImage_t image_NMemory• SImage_t imageWithoutNoise• SImage_t imageWithoutNoise_NMemory• SImage_t outImage• SImage_t outImage_NMemory• SNoiseR_t noise• SScanC_t scan• SScanC_t scanNMemory

Define Documentation

#define BITS_TO_RIGHT 11

#define COMPLETE_SIGNAL 1

************************************************************************************ >> Options forsignal processing

#define CORES 6

#define FILTER_SIZE 12

#define HIGHT_FREQUENCY 10Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

#define HILBERT_FILTER_SIZE 12Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

#define LOW_FREQUENCY 5Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

#define SAMPLE_FREQUENCY 20Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

#define SAMPLES 1556Referenced by appBackground(), do_task(), initSignalImageMemory(), initSignalMemoryNotCore0(), processSignal(),read_ultrasound_data(), readData(), readData_16(), runUltrasoundLibraryMasterCore(), and send_signal_processing().

#define SC_HEIGHT 480Referenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

#define SC_WIDTH 640************************************************************************************ >> Optionsfor image processingReferenced by initSignalImageMemory(), and initSignalMemoryNotCore0().

#define SCAN_LINES 360Referenced by appBackground(), do_task(), dummy(), read_ultrasound_data(), readData(), readData_16(),runUltrasoundLibraryMasterCore(), and send_signal_processing().

#define Word32Size ON

#define WordSize Word3232 bits or 16 bits versionReferenced by do_task(), initSignalImageMemory(), and initSignalMemoryNotCore0().

usLib_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

58 Freescale Semiconductor, Inc.

Page 59: Ultrasound Software Library Userguide

Function Documentation

void initSignalImageMemory ()References _globalI, _globalQ, _globalSignal, custom_filter, _SFilter16_t::filter, FILTER_SIZE,_SFilter16_t::filterSize, _SImage_t::height, HIGHT_FREQUENCY, HILBERT_FILTER_SIZE, hilbertFilter,_SImage_t::image, image, image_NMemory, imageWithoutNoise, imageWithoutNoise_NMemory,LOW_FREQUENCY, noise, outImage, outImage_NMemory, passBandFilter, _SScanC_t::preTable, RFSignal,SAMPLE_FREQUENCY, SAMPLES, SC_HEIGHT, SC_WIDTH, scan, SEnvelope_hilbertFilter_16(),SFilter_dofilter_16(), SFilter_dofilter_32(), SFilter_initialize_16(), SFilter_initialize_32(), SHistEQ_initialize(),SIMAGE_DEFAULT_HISTRANGE, SImage_initialize(), SImage_initialize_No_Mem(), SNoiseR_initialize(),SScanC_initialize(), SScanC_preScanConvertionSimple(), _SImage_t::width, and WordSize.Referenced by initUltrasoundLibrary().

void initSignalMemoryNotCore0 ()References _globalI, _globalQ, custom_filter, _SFilter16_t::filter, FILTER_SIZE, _SFilter16_t::filterSize,HIGHT_FREQUENCY, HILBERT_FILTER_SIZE, hilbertFilter, image_NMemory, imageWithoutNoise_NMemory,LOW_FREQUENCY, noise, outImage_NMemory, passBandFilter, SAMPLE_FREQUENCY, SAMPLES,SC_HEIGHT, SC_WIDTH, scanNMemory, SEnvelope_hilbertFilter_16(), SFilter_dofilter_16(), SFilter_dofilter_32(),SFilter_initialize_16(), SFilter_initialize_32(), SIMAGE_DEFAULT_HISTRANGE, SImage_initialize_No_Mem(),SNoiseR_initialize(), SScanC_initialize(), SScanC_preScanConvertionParallel(), and WordSize.Referenced by initUltrasoundLibrary().

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

References _globalI, _globalQ, _globalTempSignal, hilbertFilter, passBandFilter, SAMPLES,sc3850_EnvelopeAndLogCompression(), SEnvelope_doEnvelopeDTime_16(), SFilter_filterSignal_16(), andSFilter_filterSignal_32().

Referenced by appBackground(), and do_task().

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().

usLib_config.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 59

Page 60: Ultrasound Software Library Userguide

Word32 custom_filter[FILTER_SIZE]

Initial value: { }

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().

Utility.h File Reference

Ultrasound Software Library Userguide, Rev. 0, 8/2011

60 Freescale Semiconductor, Inc.

Page 61: Ultrasound Software Library Userguide

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

scan_lines, Word32 mn, Word32 mx)

Detailed Description

Header file for the utilities.

Id:

Utility_1.0.0

Ultrasound Software Library Userguide, Rev. 0, 8/2011

Freescale Semiconductor, Inc. 61

Page 62: Ultrasound Software Library Userguide

How to Reach Us:

Home Page:www.freescale.com

Web Support:http://www.freescale.com/support

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.

© 2011 Freescale Semiconductor, Inc.