# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

# overlay.h

Go to the documentation of this file.

    00001 /* ***** BEGIN LICENSE BLOCK *****
    00002 *
    00003 * $Id: overlay.h,v 1.5 2004/11/22 13:42:33 asuraparaju Exp $ $Name: Dirac_0_7_0 $
    00004 *
    00005 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
    00006 *
    00007 * The contents of this file are subject to the Mozilla Public License
    00008 * Version 1.1 (the "License"); you may not use this file except in compliance
    00009 * with the License. You may obtain a copy of the License at
    00010 * http://www.mozilla.org/MPL/
    00011 *
    00012 * Software distributed under the License is distributed on an "AS IS" basis,
    00013 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
    00014 * the specific language governing rights and limitations under the License.
    00015 *
    00016 * The Original Code is BBC Research and Development code.
    00017 *
    00018 * The Initial Developer of the Original Code is the British Broadcasting
    00019 * Corporation.
    00020 * Portions created by the Initial Developer are Copyright (C) 2004.
    00021 * All Rights Reserved.
    00022 *
    00023 * Contributor(s): Chris Bowley (Original Author)
    00024 *
    00025 * Alternatively, the contents of this file may be used under the terms of
    00026 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
    00027 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
    00028 * the GPL or the LGPL are applicable instead of those above. If you wish to
    00029 * allow use of your version of this file only under the terms of the either
    00030 * the GPL or LGPL and not to allow others to use your version of this file
    00031 * under the MPL, indicate your decision by deleting the provisions above
    00032 * and replace them with the notice and other provisions required by the GPL
    00033 * or LGPL. If you do not delete the provisions above, a recipient may use
    00034 * your version of this file under the terms of any one of the MPL, the GPL
    00035 * or the LGPL.
    00036 * ***** END LICENSE BLOCK ***** */
    00037
    00038 #ifndef __OVERLAY_H__
    00039 #define __OVERLAY_H__
    00040
    00041
    00042 #include <libdirac_common/common.h>
    00043 #include <libdirac_common/motion.h>
    00044 #include <libdirac_common/frame.h>
    00045 #include <util/instrumentation/libdirac_instrument/motion_colour.h>
    00046 #include <util/instrumentation/libdirac_instrument/motion_colour_arrows.h>
    00047 #include <util/instrumentation/libdirac_instrument/sad.h>
    00048 #include <util/instrumentation/libdirac_instrument/split_mode.h>
    00049 #include <util/instrumentation/libdirac_instrument/pred_mode.h>
    00050 #include <util/instrumentation/libdirac_instrument/overlay_symbols.h>
    00051 #include <util/instrumentation/libdirac_instrument/gm_inliers.h>
    00052
    00053 using dirac::MEData;
    00054 using dirac::OLBParams;
    00055
    00056 namespace dirac_instr
    00057 {
    00058 #define NO_REF -1
    00059
    00061     enum OverlayOption
    00062     {
    00063         motion_arrows, motion_colour, motion_colour_arrows,
    00064         gm_arrows, gm_colour, gm_colour_arrows,
    00065         gm_diff_arrows, gm_diff_colour, gm_diff_colour_arrows,
    00066         gm_inliers, split_mode, SAD, pred_mode
    00067     };
    00068
    00070     class OverlayParams
    00071     {
    00072     public:
    00073
    00075         //                                                        //
    00076         //    Assumes default constructor, copy constructor       //
    00077         //    and assignment =                                    //
    00078         //                                                        //
    00080
    00083         const OverlayOption Option() const {return m_option;}
    00084
    00086         const int Reference() const {return m_ref;}
    00087
    00089         const int Background() const {return m_bg;}
    00090
    00092         const int Legend() const {return m_legend;}
    00093
    00095         const int MvClip() const {return m_mv_clip;}
    00096
    00098         const int SADClip() const {return m_sad_clip;}
    00099
    00102         void SetOption(OverlayOption o) {m_option=o;}
    00103
    00105         void SetReference(int r) {m_ref=r;}
    00106
    00108         void SetBackground(bool b) {m_bg=b;}
    00109
    00111         void SetLegend(bool l) {m_legend=l;}
    00112
    00114         void SetMvClip(int c) {m_mv_clip=c;}
    00115
    00117         void SetSADClip(int c) {m_sad_clip=c;}
    00118
    00119     private:
    00121         OverlayOption m_option;
    00122
    00124         int m_ref;
    00125
    00127         bool m_bg;
    00128
    00130         bool m_legend;
    00131
    00133         int m_mv_clip;
    00134
    00136         int m_sad_clip;
    00137     };
    00138
    00140     class Overlay
    00141     {
    00142     public:
    00144         Overlay(const OverlayParams &, Frame &);
    00145
    00147         ~Overlay();
    00148
    00150         //                                                        //
    00151         //    Assumes default copy constructor and assignment =   //
    00152         //                                                        //
    00154
    00155         void ProcessFrame(const MEData &, const OLBParams &);
    00156
    00157         void ProcessFrame();
    00158
    00159     private:
    00160
    00162         /*
    00163             Main overlay is carried out on a motion vector block by block basis
    00164         */
    00165         void DoOverlay(const MEData &);
    00166
    00168         /*
    00169             Difference picture formats use different chroma resolutions with
    00170             respect to luma
    00171         */
    00172         void CalculateFactors(const ChromaFormat &);
    00173
    00175         /*
    00176             Frames must have an integer number of macroblocks, more
    00177             macroblocks may have been used during encoding and hence the frame
    00178             must be padded now in order for the correct macroblock (and motion
    00179             vector block) size to be calculated
    00180         */
    00181         void PadFrame(const MEData &);
    00182
    00184         void GlobalMotionDifference(const MEData &, MvArray &);
    00185
    00187         int m_mv_scale;
    00188
    00190         int m_ref;
    00191
    00193         const OverlayParams m_oparams;
    00194
    00196         Frame & m_frame;
    00197
    00199         DrawFrameMotionParams m_draw_params;
    00200     };
    00201
    00202 } // namespace dirac_instr
    00203
    00204 #endif
    00205

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.