/*
 * Copyright 2010 Trident Microsystems (Far East) Ltd. All rights reserved.
 * All prior copyright rights in this work and the accompanying software
 * products transferred to Trident Microsystems (Far East) Ltd. by written
 * agreement.
 */
/*****************************************************************************/
/* Copyright (c) 2010 NXP B.V.  All rights are reserved.                     */
/*                                                                           */
/* Redistribution and use in source and binary forms, with or without        */
/* modification, are permitted provided that the following conditions        */
/* are met:                                                                  */
/*                                                                           */
/* Redistributions of source code must retain the above copyright            */
/* notice, this list of conditions and the following disclaimer.             */
/*                                                                           */
/* Redistributions in binary form must reproduce the above copyright         */
/* notice, this list of conditions and the following disclaimer in the       */
/* documentation and/or other materials provided with the distribution.      */
/*                                                                           */
/* Neither the name of NXP nor the names of its                              */
/* contributors may be used to endorse or promote products derived from      */
/* this software without specific prior written permission.                  */
/*                                                                           */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR     */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT          */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE         */
/* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH          */
/* DAMAGE.                                                                   */
/*                                                                           */
/*****************************************************************************/
/**
    @file   phStbVideoRenderer.h
    @brief  Video Renderer Component

    Top level API for the Video Renderer.

    Set your editor for 4 space indentation.
*//*

Rev Date        Author      Comments
--------------------------------------------------------------------------------
  1 20060613    burningh    Import v24 from STB810 & mod for STB225
  2 20061031    burningh    Continuing implementation
  3 20070618    neill       Layer API modifications
  4 20070719    neill       Added VBI related functions and callbacks
  5 20071016    burningh    Tidy up header file
  6 20071109    burningh    Complete documentation
  7 20071217    burningh    Improve documentation of top-level APIs
  8 20080701    neill       Add component output slave to analog/digital option
  9 20080805    neill       Add VGA support
 10 20090120    batelaan    Update file copyright/license text
 11 20090220    neill       Add phStbVideoRenderer_OsdClearAndReset
 12 20090324    Kulkarni    Add phStbVideoRenderer_ConfigurePictureQuality
 xx 20090915    robv        Add phStbVideoRenderer_SetGlobalTransparency
 xx 20091116    mpage       Add phStbVideoRenderer_SetGlobalAlphaFactor
--------------------------------------------------------------------------------
    For consistency and standardisation retain the Section Separators.
*/

#ifndef PHSTBVIDEORENDERER_H
#define PHSTBVIDEORENDERER_H

/**************************************************************
* INCLUDE FILES                                               *
***************************************************************/

#include <tmNxTypes.h>
#include <phStbVideoRenderer_Layer.h>

#ifdef __cplusplus
extern "C"
{
#endif

/**************************************************************
* EXPORTED MACROS                                             *
***************************************************************/

/** Defines the maximum number of Renderer Instances (2 Compositions in Vmix) */
#define PH_STBVIDEORENDERER_MAX_INSTANCES 2U

/** The default Frame stride for PAL*/
#define PH_STBVIDEORENDERER_DEFAULT_FRAME_STRIDE 768U

/** The default frame width for PAL*/
#define PH_STBVIDEORENDERER_DEFAULT_FRAME_WIDTH 720U

/** The default frame height for PAL*/
#define PH_STBVIDEORENDERER_DEFAULT_FRAME_HEIGHT 576U

/** The default video out format*/
#define PH_STBVIDEORENDERER_DEFAULT_OUTPUT_FORMAT PH_STBVIDEOTYPES_PAL

/** The maximum image size for each buffer*/
#define PH_STBVIDEORENDERER_DEFAULT_MAX_IMAGE_BUF_SIZE (PH_STBVIDEORENDERER_DEFAULT_FRAME_STRIDE * PH_STBVIDEORENDERER_DEFAULT_FRAME_HEIGHT)

/** The maximum length of a layer name as returned by phStbVideoRenderer_GetVideoLayer, including the terminating \\0.*/
#define PH_STBVIDEORENDERER_MAX_NAME_LENGTH 16

/** The maximum length of a video mode name as returned by phStbVideoRenderer_GetOutputFormat, including the terminating \\0.*/
#define PH_STBVIDEORENDERER_MAX_FORMAT_LENGTH 16

/** The function type used for VBI callbacks */
#define phStbVideoRenderer_Callback_t tmCallback_t

/**************************************************************
* EXPORTED TYPEDEFS                                           *
***************************************************************/

/** @brief Structure containing all required data for a renderer object.
    This is effectively a forward definition, the actual details
    of this structure are in the C file.
 */
typedef struct phStbVideoRenderer phStbVideoRenderer_t;

/** @brief The enumeration of available mixer planes.
 * These are the multiplexed mixer inputs, which can have layers selected into them. */
typedef enum phStbVideoRenderer_Planes
{
    phStbVideoRenderer_Planes_First  = 0,
    phStbVideoRenderer_Planes_Second = 1,
    phStbVideoRenderer_Planes_Third  = 2,
    phStbVideoRenderer_Planes_Fourth = 3,
    phStbVideoRenderer_Planes_Bottom = phStbVideoRenderer_Planes_Fourth,
    phStbVideoRenderer_Planes_Top    = phStbVideoRenderer_Planes_First,
    phStbVideoRenderer_Planes_Count  = 4
} phStbVideoRenderer_Planes_t;

/** @brief The enumeration of available layers.
 * These can each be selected into planes on either, neither or both compositions. */
typedef enum phStbVideoRenderer_Layers
{
    phStbVideoRenderer_Layers_Display1  = 0, /**< The 1st display layer, used for moving video */
    phStbVideoRenderer_Layers_Display2  = 1, /**< The 2nd display layer, used for moving video */
    phStbVideoRenderer_Layers_Graphics1 = 2, /**< The 1st graphics layer, used for OSD or frame buffer */
    phStbVideoRenderer_Layers_Graphics2 = 3, /**< The 2nd graphics layer, used for OSD or frame buffer */
    phStbVideoRenderer_Layers_None      = 5  /**< No layer (must be >= 4 to ensure top bit set for HW) */
} phStbVideoRenderer_Layers_t;

/** @brief A structure describing the configuration of a single plane in the mixer.
 * A Plane can be set to contain any Layer, and enabled or disabled as required. */
typedef struct phStbVideoRenderer_Plane
{
    phStbVideoRenderer_Layers_t layer;   /**< The layer to select for this plane. */
    bool                        enabled; /**< Enable or disable mixing of the plane in question. */
} phStbVideoRenderer_Plane_t;

/** @brief The enumeration of output paths from the two compositions.
 * Each of these can be independently controlled to output one or other composition.
 * The final output at the destination is also controlled by the selected Display Chain.
 * For an overall view of the video pipe, see Figure 3, "Detailed block diagram
 * of the video pipe", in the PNX8335 Video Pipe User Manual.
 * @see phStbVideoRenderer_DisplayChain_t */
typedef enum phStbVideoRenderer_OutputPath
{
    phStbVideoRenderer_OutputPath_HdDac = 0, /**< "TV" in mixer docs, YUV 444 parallel path to HD DAC */
    phStbVideoRenderer_OutputPath_SdDac = 1, /**< "DC_DVO" in mixer docs, YC 422 serial path to SD DAC and downscaler chain */
    phStbVideoRenderer_OutputPath_Dvo   = 2, /**< "HDMI" in mixer docs, YC 422 serial path to DVO */
    phStbVideoRenderer_OutputPath_Count = 3  /**< The number of output paths that can be configured */
} phStbVideoRenderer_OutputPath_t;

/** @brief The enumeration of display chains available - main and downscaled.
 * The final output at the destination is also controlled by the selected Output Path.
 * For an overall view of the video pipe, see Figure 3, "Detailed block diagram
 * of the video pipe", in the PNX8335 Video Pipe User Manual.
 * @see phStbVideoRenderer_OutputPath_t
 * @note Values correspond with HD / SD mixer unit numbers */
typedef enum phStbVideoRenderer_DisplayChain
{
    phStbVideoRenderer_DisplayChain_Downscaled = 0,
    phStbVideoRenderer_DisplayChain_Main       = 1,
    phStbVideoRenderer_DisplayChain_Count      = 2
} phStbVideoRenderer_DisplayChain_t;

/** @brief An enumeration of valid frame rates for the renderer. */
typedef enum phStbVideoRenderer_FrameRate
{
    phStbVideoRenderer_FrameRateNone     = 0x00,
    phStbVideoRenderer_FrameRate_23_976  = 0x01,
    phStbVideoRenderer_FrameRate_24      = 0x02,
    phStbVideoRenderer_FrameRate_25      = 0x03,
    phStbVideoRenderer_FrameRate_29_97   = 0x04,
    phStbVideoRenderer_FrameRate_30      = 0x05,
    phStbVideoRenderer_FrameRate_50      = 0x06,
    phStbVideoRenderer_FrameRate_59_94   = 0x07,
    phStbVideoRenderer_FrameRate_60      = 0x08,
    phStbVideoRenderer_FrameRate_75      = 0x09
} phStbVideoRenderer_FrameRate_t;

/** This defines the different types of event that can be subscribed to.
    This is a bit field list and thus can be or'd together for the necessary combinations.
    Events that are returned by the video renderer - see phStbEvent.h.
    Note that the source name is returned by phStbVideoRenderer_GetVideoLayer.
 */
typedef enum phStbVideoRenderer_NotificationTypes
{
    /** This is used to define that no event notifications are required*/
    phStbVideoRenderer_NotificationTypes_None = 0,

    /** This is used to state that EndofStream Notifications are required*/
    phStbVideoRenderer_NotificationTypes_EndOfStream = (1 << 0),

    /** This is used to state that Format Change events are required */
    phStbVideoRenderer_NotificationTypes_FormatChange = (1 << 1),

    /** This is used to state that A field (interlaced output)
        or a frame (progressive output) has been renderered.*/
    phStbVideoRenderer_NotificationTypes_VidOut = (1 << 2),

    /** This is used to state that A field (interlaced output)
        or a frame (progressive output) has been renderered. And that
        the controlling application must decide to either Drop/Play/Hold.
        This is not suitable for MIPS as time for callback is too great.*/
    phStbVideoRenderer_NotificationTypes_Sync = (1 << 3),

    /** This is used to state that A Frame has been repeated to maintain
        output frame rate.*/
    phStbVideoRenderer_NotificationTypes_FrameRepeated = (1 << 4),

    /** This is used to indicate that a frame has been presented to the
        renderer and will un-blank / un-hide the layer.*/
    phStbVideoRenderer_NotificationTypes_FirstFramePresented = (1 << 5),

    /** Terminates the enum values. */
    phStbVideoRenderer_NotificationTypes_Guard = (1 << 6)

} phStbVideoRenderer_NotificationTypes_t;

/** This defines the position within the VBI that a callback function
    will be called from */
typedef enum phStbVideoRenderer_VbiPosition
{
    phStbVideoRenderer_VbiPosition_Start = 0,
    phStbVideoRenderer_VbiPosition_End   = 1

}phStbVideoRenderer_VbiPosition_t;

/** This defines the parity of the current display field */
typedef enum phStbVideoRenderer_Parity
{
    phStbVideoRenderer_Parity_Even = 0,
    phStbVideoRenderer_Parity_Odd  = 1
} phStbVideoRenderer_Parity_t;

/**************************************************************
* EXPORTED DATA                                               *
***************************************************************/

/**************************************************************
* EXPORTED FUNCTION PROTOTYPES                                *
***************************************************************/

/******************************************************************************/
/** Get a valid instance of a renderer object.
    tmUnit0 is composition 1
    tmUnit1 is composition 2

    @param unitNum @b IN The number of the required renderer instance
    @param ppRendInst @b OUT Valid Renderer Instance object

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.
*/
extern tmErrorCode_t phStbVideoRenderer_GetInstance(
    tmUnitSelect_t unitNum,
    phStbVideoRenderer_t **ppRendInst);

/******************************************************************************/
/** Gets a handle to the specified layer object.

    @param layerSelect @b IN The Index of the required Layer
    @param ppLayer     @b OUT Specified Layer Structure
    @param pLayerName  @b OUT The name of the Layer (used by Streaming System)
                              @see PH_STBVIDEORENDERER_MAX_NAME_LENGTH

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @note layerName maximum length is @see PH_STBVIDEORENDERER_MAX_NAME_LENGTH.
*/
extern tmErrorCode_t phStbVideoRenderer_GetVideoLayer(
    phStbVideoRenderer_Layers_t layerSelect,
    phStbVideoRenderer_Layer_t **ppLayer,
    char *pLayerName);

/******************************************************************************/
/** Select a renderer to display on a given output path, and / or whether the
    output of the downscaling chain should be used.
    Note that the renderer selected into the SD DAC path will also be used as
    the input to the downscaling chain. This means that if the downscaled chain
    is used, the value of unitNum is effectively ignored, and the downscaled
    output of the renderer selected into the SD DAC output path will be visible.
    For an overall view of the video pipe, see Figure 3, "Detailed block diagram
    of the video pipe", in the PNX8335 Video Pipe User Manual.

    @param outputPath   @b IN The output path to configure
    @param unitNum      @b IN The number of the renderer instance to display
    @param displayChain @b IN The display chain to use on this output

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @see phStbVideoRenderer_OutputPath_t
    @see phStbVideoRenderer_DisplayChain_t
*/
extern tmErrorCode_t phStbVideoRenderer_SelectOutput(
    phStbVideoRenderer_OutputPath_t outputPath,
    tmUnitSelect_t unitNum,
    phStbVideoRenderer_DisplayChain_t displayChain);

/******************************************************************************/
/** Set the overall output format of the specified display chain.
    Note that some combinations of Main and Downscaler Format are
    incompatible, particularly if different frame rates are requested.
    The Downscaler chain can be disabled by passing an empty string.

    @param displayChain @b IN  The display chain to act upon
    @param pVideoFormat @b IN  The Video Format to use for the output

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @see    phStbVideoRenderer_VideoFormat NAB TODO!
*/
extern tmErrorCode_t phStbVideoRenderer_SetOutputFormat(
    phStbVideoRenderer_DisplayChain_t displayChain,
    const char *pVideoFormat);

/******************************************************************************/
/** Get the current output format of the renderer.

    @param displayChain @b IN  The display chain to act upon
    @param pVideoFormat @b OUT The video output format
                              @see PH_STBVIDEORENDERER_MAX_FORMAT_LENGTH

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @see  phStbVideoRenderer_VideoFormat NAB TODO!
*/
extern tmErrorCode_t phStbVideoRenderer_GetOutputFormat(
    phStbVideoRenderer_DisplayChain_t displayChain,
    char *pVideoFormat);

/******************************************************************************/
/** Set up the analog component output to be slaved to either the digital
    output or the analog output

    @param pSlave @b IN  Component output is slaved to digital output

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.
*/
extern tmErrorCode_t phStbVideoRenderer_SetAnalogSlave(
    const bool *pSlave);

/******************************************************************************/
/** Get the current output resolution of the renderer.

    @param displayChain @b IN  The display chain to act upon
    @param pWidth       @b OUT The video output width.
    @param pHeight      @b OUT The video output height.

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.
*/
extern tmErrorCode_t phStbVideoRenderer_GetOutputResolution(
    phStbVideoRenderer_DisplayChain_t displayChain,
    uint32_t *pWidth,
    uint32_t *pHeight);

/******************************************************************************/
/** Get the current output frame rate for this renderer.

    @param displayChain @b IN  The display chain to act upon
    @param pFrameRate   @b OUT The video output frame rate

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @note This is a frame rate, as as such will return 1/2 the field rate for
    interlaced modes.
*/
extern tmErrorCode_t phStbVideoRenderer_GetOutputFrameRate(
    phStbVideoRenderer_DisplayChain_t displayChain,
    phStbVideoRenderer_FrameRate_t *pFrameRate);

/******************************************************************************/
/** Get the current scan type of the renderer.

    @param displayChain @b IN  The display chain to act upon
    @param pInterlaced  @b OUT Is the mode interlaced or not

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.
*/
extern tmErrorCode_t phStbVideoRenderer_GetOutputScanType(
    phStbVideoRenderer_DisplayChain_t displayChain,
    bool *pInterlaced);

/******************************************************************************/
/** Set up the mapping between video mixer planes and graphics / OSD layers.

    @param pInstance     @b IN The Renderer Instance
    @param pLayers       @b IN Pointer to the first entry in an array of length
                               phStbVideoRenderer_Planes_Count.

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @see phStbVideoRenderer_Plane_t
    @see phStbVideoRenderer_Layers_t
    @see phStbVideoRenderer_Planes_t

    @note The array of planes is ordered as follows:
          Index 0 is the first (or top) layer, 1 is the second, 2 is the third
          and 3 is the fourth (or bottom) layer.
*/
extern tmErrorCode_t phStbVideoRenderer_SetPlaneStack(
    phStbVideoRenderer_t *pInstance,
    const phStbVideoRenderer_Plane_t *pLayers);

/******************************************************************************/
/** Retrieve the current mapping between mixer planes and graphics / OSD layers.

    @param pInstance @b IN The Renderer Instance
    @param pLayers   @b OUT Pointer to the first entry in an array of length
                            phStbVideoRenderer_Planes_Count.

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @see phStbVideoRenderer_Plane_t
    @see phStbVideoRenderer_Layers_t
    @see phStbVideoRenderer_Planes_t

    @note The array of planes is ordered as follows:
          Index 0 is the first (or top) plane, 1 is the second, 2 is the third
          and 3 is the fourth (or bottom) plane.
*/
extern tmErrorCode_t phStbVideoRenderer_GetPlaneStack(
    phStbVideoRenderer_t *pInstance,
    phStbVideoRenderer_Plane_t *pLayers);

/******************************************************************************/
/** Blank or unblank the renderer.  If blanked will show the background colour.

    @param pInstance @b IN The Renderer Instance
    @param blank @b IN  True to blank
                        False to unblank.

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    NAB TODO: Not very useful, can implement by setting all planes to None
*/
extern tmErrorCode_t phStbVideoRenderer_BlankOutput(
    phStbVideoRenderer_t *pInstance,
    bool blank);

/******************************************************************************/
/** Set the global transparency in the mixer.  This value is used for the primary
    video layer.

    @param pInstance @b IN The Renderer Instance
    @param transparency @b IN  Range [0..63]

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.
*/
extern tmErrorCode_t phStbVideoRenderer_SetGlobalTransparency(
    phStbVideoRenderer_t *pInstance,
    uint8_t transparency);

/******************************************************************************/
/** Set the global alpha factor in the mixer.  This value is used for the secondary
    video layer.

    @param pInstance @b IN The Renderer Instance
    @param alphaFactor @b IN  Range [0..15]

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.
*/
extern tmErrorCode_t phStbVideoRenderer_SetGlobalAlphaFactor(
    phStbVideoRenderer_t *pInstance,
    uint8_t alphaFactor);

/******************************************************************************/
/** Set the background colour of the renderer.

    @param pInstance @b IN The Renderer Instance
    @param red   @b IN The Red Value of the background colour.
    @param green @b IN The Green Value of the background colour.
    @param blue  @b IN The Blue Value of the background colour.

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @note This is always in RGB never in YUV.

    NAB TODO: The hardware expects 8 bit values for each of YUV - conversion needed or change API
*/
extern tmErrorCode_t phStbVideoRenderer_SetBackgroundColour(
    phStbVideoRenderer_t *pInstance,
    uint32_t red,
    uint32_t green,
    uint32_t blue);

/******************************************************************************/
/** Get the current background colour for the renderer.

    @param pInstance @b IN The Renderer Instance
    @param pRed   @b OUT The current Red Value of the background colour.
    @param pGreen @b OUT The Green Value of the background colour.
    @param pBlue  @b OUT The Blue Value of the background colour.

    @retval TM_OK           Completed Successfully.
    @retval AnotherValue    An error.

    @note This is always RGB not YUV.

    NAB TODO: The hardware expects 8 bit values for each of YUV
*/
extern tmErrorCode_t phStbVideoRenderer_GetBackgroundColour(
    phStbVideoRenderer_t *pInstance,
    uint32_t *pRed,
    uint32_t *pGreen,
    uint32_t *pBlue);

/******************************************************************************/
/** Add a function to be called during the VBI.
 *
 * @param callback       @b IN     Function to be called
 * @param vbiPosition    @b IN     Start of VBI or end of VBI
 * @param displayChain   @b IN     The display chain to access
 *
 * @retval TM_OK On success
 * @retval Other On error
 */
extern tmErrorCode_t phStbVideoRenderer_RegisterVBICallback(
    phStbVideoRenderer_Callback_t callback,
    phStbVideoRenderer_VbiPosition_t vbiPosition,
    phStbVideoRenderer_DisplayChain_t displayChain);

/******************************************************************************/
/** Enable callbacks during the VBI.
 *
 * @param vbiPosition    @b IN     Start of VBI or end of VBI
 * @param displayChain   @b IN     The display chain to access
 *
 * @retval TM_OK On success
 * @retval Other On error
 */
extern tmErrorCode_t phStbVideoRenderer_EnableVBI(
    phStbVideoRenderer_VbiPosition_t vbiPosition,
    phStbVideoRenderer_DisplayChain_t displayChain);

/******************************************************************************/
/** Disable callbacks during the VBI.
 *
 * @param vbiPosition    @b IN     Start of VBI or end of VBI
 * @param displayChain   @b IN     The display chain to access
 *
 * @retval TM_OK On success
 * @retval Other On error
 */
extern tmErrorCode_t phStbVideoRenderer_DisableVBI(
    phStbVideoRenderer_VbiPosition_t vbiPosition,
    phStbVideoRenderer_DisplayChain_t displayChain);

/******************************************************************************/
/** Report the current field and line being displayed.
 *
 * @param parity         @b OUT    Even field or odd field
 * @param line           @b OUT    display line
 * @param displayChain   @b IN     The display chain to access
 *
 * @retval TM_OK On success
 * @retval Other On error
 */
extern tmErrorCode_t phStbVideoRenderer_GetFieldLine(
    phStbVideoRenderer_Parity_t *parity,
    unsigned int *line,
    phStbVideoRenderer_DisplayChain_t displayChain);

/******************************************************************************/
/** Configure the optimization of the video quality for the SD downscaled path
 *  These options will only be applied on the SD downscaled path
 *
 *  @param OsdAlwaysPresent             @b IN  Tells to always display the OSD
 *  @param OptimizeWhenOsdNotDisplayed  @b IN  Tells to optimize the PQ when OSD is blanked
 *
 *  If (OsdAlwaysPresent)
 *      if (OptimizeWhenOsdNotDisplayed)
 *          if (OSD is blanked)
                The SD Display will render the HD framestore (OSD will never be mixed)
            else
                The SD Display will render the output of the downscaler (= video + OSD mixed)
 *      else
 *         The SD Display will render the output of the downscaler (= video + OSD mixed)
 *  Else
 *      The SD Display will render the HD framestore (OSD will never be mixed)
 *
 *  @retval TM_OK           Completed Successfully.
 *  @retval AnotherValue    An error.
 */
extern tmErrorCode_t phStbVideoRenderer_ConfigurePictureQuality(
    bool OsdAlwaysPresent,
    bool OptimizeWhenOsdNotDisplayed);

/******************************************************************************/
/** Clear and reset the OSD layers.
 *
 * @retval None
 */
extern void phStbVideoRenderer_OsdClearAndReset(void);

#ifdef __cplusplus
}
#endif

#endif /* Do not add any thing below this line */

