function PixelStreamingDesignHDLTestBench
    % VISIONHDLGAMMA_TB  Provide test bench for HDL code generation
    %   Copyright 2014 The MathWorks, Inc.
    % frm2pix converts an input frame to a stream of pixels and control structures
    frm2pix = visionhdl.FrameToPixels( 'VideoFormat', 'custom', 'ActivePixelsPerLine', 40, 'ActiveVideoLines', 20, 'TotalPixelsPerLine', 50, 'TotalVideoLines', 30, 'StartingActiveLine', 2, 'FrontPorch', 5 );
    [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix( frm2pix );
    % pix2frm converts a pixel stream and control structures to a full frame
    pix2frm = visionhdl.PixelsToFrame( 'VideoFormat', 'Custom', 'ActivePixelsPerLine', actPixPerLine, 'ActiveVideoLines', actLine );
    % videoIn reads a rhinos video
    videoIn = vision.VideoFileReader( 'Filename', 'rhinos.avi', 'ImageColorSpace', 'Intensity', 'VideoOutputDataType', 'uint8' );
    viewer = vision.DeployableVideoPlayer( 'Size', 'Custom', 'CustomSize', [ 2*actPixPerLine, actLine ]*5 );
    
    pixOutVec = zeros( numPixPerFrm, 1, 'uint8' );
    ctrlOutVec = repmat( pixelcontrolstruct, numPixPerFrm, 1 );
    numFrm = 10;
    tic;
% ------------- added for frame-FIL ------------------
    fil = class_PixelStreamingDesignHDLDesign_sysobj;
    % Optional: use when comparing FIL output against function output
    ref_pixOutVec = zeros( numPixPerFrm, 1, 'uint8' );
    ref_ctrlOutVec = repmat( pixelcontrolstruct, numPixPerFrm, 1 );
% ------------- end added for frame-FIL ---------------------

    for f = 1:numFrm
        frmFull = step( videoIn );  % Get a new frame  
        frmIn = imresize( frmFull, [ actLine, actPixPerLine ] );  % Reduce the frame size
        [pixInVec,ctrlInVec] = step( frm2pix, frmIn );
% ------------------- removed for frame-FIL -----------------        
%         for p = 1:numPixPerFrm
%             [pixOutVec( p ),ctrlOutVec( p )] = PixelStreamingDesignHDLDesign_fil( pixInVec( p ), ctrlInVec( p ) );
%         end
% ------------------- end removed for frame-FIL ------------------
% ------------------- added for frame-FIL --------------------
         [pixOutVec,hStartOut,hEndOut,vStartOut,vEndOut,validOut] = ...
            step(fil,pixInVec,[ctrlInVec.hStart]',[ctrlInVec.hEnd]',[ctrlInVec.vStart]',[ctrlInVec.vEnd]',[ctrlInVec.valid]');
         ctrlOutVec = arrayfun(@(hStart,hEnd,vStart,vEnd,valid) ...
             struct('hStart',hStart,'hEnd',hEnd,'vStart',vStart,'vEnd',vEnd,'valid',valid),...
             hStartOut,hEndOut,vStartOut,vEndOut,validOut);     
% ------------------- end added for frame-FIL --------------------
        frmOut = step( pix2frm, pixOutVec, ctrlOutVec );
        step( viewer, [ frmIn,frmOut ] );

% ------------------- added for frame-FIL --------------------
% Optional: Compare FIL results against original function
        for p = 1:numPixPerFrm
            [ref_pixOutVec(p),ref_ctrlOutVec(p)] = PixelStreamingDesignHDLDesign(pixInVec(p),ctrlInVec(p));
        end
        hdlverifier.assert(pixOutVec',ref_pixOutVec,'pixOut')
        hdlverifier.assert([ctrlOutVec.hStart],[ref_ctrlOutVec.hStart],'hStart')
        hdlverifier.assert([ctrlOutVec.hEnd],[ref_ctrlOutVec.hEnd],'hEnd')
        hdlverifier.assert([ctrlOutVec.vStart],[ref_ctrlOutVec.vStart],'vStart')
        hdlverifier.assert([ctrlOutVec.vEnd],[ref_ctrlOutVec.vEnd],'vEnc')
        hdlverifier.assert([ctrlOutVec.valid],[ref_ctrlOutVec.valid],'valid')
% ------------------- end added for frame-FIL --------------------
    end
    t = toc;
    fprintf( '\n%d frames have been processed in %.2f seconds.\n', numFrm, t );
    fprintf( 'Average frame rate is %.2f frames/second.\n', numFrm/t );
end
