%% $RCSfile: sdspzpad.tlc,v $ %% $Revision: 1.10 $ %% $Date: 1999/03/24 14:58:01 $ %% %% J. Faneuff, M. Yeddanapudi, D. Orofino %% April 28, 1998 %% Copyright (c) 1995-1999 The MathWorks, Inc. All Rights Reserved. %% %% Abstract: zero pad %implements sdspzpad "C" %% Function: Outputs ========================================================== %% %function Outputs(block, system) Output /* DSP Blockset Zero Pad (%) - % */ %% %if !IsInputPortContiguous(block, 0) % %endif %% %assign INPORT = 0 %assign OUTPORT = 0 %assign need_copy = (LibBlockInputSignalBufferDstPort(INPORT) != OUTPORT) %% %% Only generate code if output buffer does not share the input buffer space. %% %if need_copy %% %% Not sharing data - perform zero padding: %% %assign c0 = LibBlockOutputSignalIsComplex(OUTPORT) %assign padVal = % %assign NumChans = % %assign N = LibDataInputPortWidth(INPORT) / NumChans %assign minPad = MIN(N, padVal) %% %if !c0 %% REAL { real_T *y = %; real_T *u = %; %% %if NumChans>1 int_T c; for (c=0; c++ < %; ) { /* frame loop */ %endif %% int i; /* Copy input data: */ for(i = %; i-- > 0; ) { *y++ = *u++; } %% Pad with zeros, if there are any to add: %% Use loop roller loop unrolling when needed %if padVal>N /* Pad with zeros: */ %assign rollRegions1 = [0:%] %assign rollVars = [] %roll sigIdx = rollRegions1, lcv = RollThreshold, block, ... "Roller", rollVars *y++ = (real_T)0.0; %endroll %endif %% %% Only execute if multiple channels, AND if truncation occurring, %% so that uptr points to start of next channel of data: %% %if ((NumChans > 1) && (N > padVal)) u += %; %endif %% %if NumChans>1 } %endif } %% %else %% COMPLEX { creal_T *y = %; creal_T *u = %; %% %if NumChans>1 int_T c; for (c=0; c++ < %; ) { /* frame loop */ %endif %% /* Copy input data: */ int i; /* Copy input data: */ for(i = %; i-- > 0; ) { *y++ = *u++; } %% %% Pad with zeros, if there is any to add: %if padVal>N /* Pad with zeros: */ %assign rollRegions1 = [0:%] %assign rollVars = [] %roll sigIdx = rollRegions1, lcv = RollThreshold, block, ... "Roller", rollVars y->re = (real_T)0.0; (y++)->im = (real_T)0.0; %endroll %endif %% %% Only execute if multiple channels, AND if truncation occurring, %% so that uptr points to start of next channel of data: %% %if ((NumChans > 1) && (N > padVal)) u += %; %endif %if NumChans>1 } %endif } %endif %%IsComplex %else /* * Zero-pad output width is identical to input width, and * the output buffer shares space with the input buffer. * Therefore, there's no code required to perform zero-pad. */ %endif %endfunction %% [EOF] sdspzpad.tlc