SPRAA56

if(controlVideoProc.frameRateChanged) { txMsg.cmd = FRAMERATECHANGED; txMsg.arg1 = chanNum;

txMsg.arg2 = controlVideoProc.frameRateTarget; controlVideoProc.frameRateChanged = FALSE; MBX_post( &mbxProcess, &txMsg, 0 );

}

While implementing control via the host PC did not specifically require a separate task in the modified application, adding a discrete control task makes the application more scalable. For example, a user interface or communications link from another processor could send control commands to a DSP-based video system. The control task could then service that user interface or communications link. In the modified example, the control task simply monitors a global structure for commands, and sends appropriate commands to the processing task if necessary.

The priority of the control TSK is set to a lower level than that of the tskVideoProcess, tskInput, and tskOutput TSKs. This prevents the control task from adding latency or CPU overhead when responding to control commands. The control commands are only serviced at times when the three TSKs in the data stream are all in the blocked state and the processor would normally be running its background loop.

Figure 3 shows the task partitioning added to the application flow in Figure 2.

Device Driver

Buffer 3 frames

 

YAfter420

 

414 KB

Y uv

 

422to

 

420

CbAfter420

 

CrAfter420

 

207 KB

scratch1

 

14 KB = 20 lines

tskInput

 

bitBuf

 

y

 

 

 

414 KB

 

 

512 KB

 

 

 

 

 

 

 

 

 

 

Y uv

H .263

 

H .263

Cr

422to

 

420

enc

 

dec

CbArrau

 

 

 

 

Shared

 

 

 

 

Scratch

 

Cb

 

6 KB

92 KB

1.5 KB

207 KB

 

 

scratch2

Instance

 

Instance

 

memory

 

memory

 

14 KB

tskProcess

tskO utput

tskControl

 

 

 

Device

Driver

Buffer

3 frames

Figure 3. Task Partitioning in the Modified Application

3.3Querying the H.263 Encoder for Status

The third change made to the base application was the use of a run-time API call to query the algorithm as to its status after each frame. The eXpressDSP algorithm standard (xDAIS) states that algorithms should provide a control API such as the following.

H263ENC_cellControl(&(chanHandle->cellSet[CELLH263ENC]), IH263ENC_GETSTATUS, (IALG_Status *) &encStatus);

DSP/BIOS Real-Time Analysis (RTA) and Debugging Applied to a Video Application

9

Page 9
Image 9
Texas Instruments SPRAA56 appendix Querying the H.263 Encoder for Status, TskInput, TskO utput