CoerceVideoFormatOfilt.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef TRANSPORT_COERCEVIDEOFORMATOFILT_C_DEFINED
00039 #define TRANSPORT_COERCEVIDEOFORMATOFILT_C_DEFINED
00040
00041 #include "Transport/CoerceVideoFormatOfilt.H"
00042
00043 #include "Raster/GenericFrame.H"
00044 #include "Transport/FrameOstream.H"
00045 #include "Util/sformat.H"
00046 #include "Video/VideoFormatCoercion.H"
00047 #include "Video/VideoFrame.H"
00048
00049
00050 CoerceVideoFormatOfilt::CoerceVideoFormatOfilt(OptionManager& mgr,
00051 VideoFormat mode)
00052 :
00053 FrameOfilt(mgr,
00054 sformat("%s-coercion output filter",
00055 convertToString(mode).c_str()),
00056 sformat("CoerceVideoFormatOfilt(%s)",
00057 convertToString(mode).c_str())),
00058 itsDestFormat(mode)
00059 {}
00060
00061
00062 CoerceVideoFormatOfilt::~CoerceVideoFormatOfilt()
00063 {}
00064
00065
00066 void CoerceVideoFormatOfilt::start1()
00067 {
00068 printCoercionTable();
00069 }
00070
00071
00072 void CoerceVideoFormatOfilt::filterFrame(FrameOstream& dest,
00073 const GenericFrame& frame,
00074 const std::string& shortname,
00075 const FrameInfo& auxinfo)
00076 {
00077 const VideoFrame src = frame.asVideo();
00078
00079 if (src.getMode() == itsDestFormat)
00080 dest.writeFrame(GenericFrame(src), shortname, auxinfo);
00081 else
00082 {
00083 const VideoFormatCoercion& c =
00084 findConverter(src.getMode(), itsDestFormat);
00085
00086 LINFO("converting %s with %s",
00087 shortname.c_str(), c.describe().c_str());
00088
00089 const VideoFrame conv = c.apply(src);
00090
00091 dest.writeFrame(GenericFrame(conv), shortname, auxinfo);
00092 }
00093 }
00094
00095
00096 template <VideoFormat VF>
00097 TCoerceVideoFormatOfilt<VF>::TCoerceVideoFormatOfilt(OptionManager& mgr)
00098 :
00099 CoerceVideoFormatOfilt(mgr, VF)
00100 {}
00101
00102
00103 template <VideoFormat VF>
00104 TCoerceVideoFormatOfilt<VF>::~TCoerceVideoFormatOfilt()
00105 {}
00106
00107 template class TCoerceVideoFormatOfilt<VIDFMT_GREY>;
00108 template class TCoerceVideoFormatOfilt<VIDFMT_RGB555>;
00109 template class TCoerceVideoFormatOfilt<VIDFMT_RGB565>;
00110 template class TCoerceVideoFormatOfilt<VIDFMT_RGB24>;
00111 template class TCoerceVideoFormatOfilt<VIDFMT_RGB32>;
00112 template class TCoerceVideoFormatOfilt<VIDFMT_YUV24>;
00113 template class TCoerceVideoFormatOfilt<VIDFMT_YUYV>;
00114 template class TCoerceVideoFormatOfilt<VIDFMT_UYVY>;
00115 template class TCoerceVideoFormatOfilt<VIDFMT_YUV444>;
00116 template class TCoerceVideoFormatOfilt<VIDFMT_YUV422>;
00117 template class TCoerceVideoFormatOfilt<VIDFMT_YUV411>;
00118 template class TCoerceVideoFormatOfilt<VIDFMT_YUV444P>;
00119 template class TCoerceVideoFormatOfilt<VIDFMT_YUV422P>;
00120 template class TCoerceVideoFormatOfilt<VIDFMT_YUV411P>;
00121 template class TCoerceVideoFormatOfilt<VIDFMT_YUV420P>;
00122 template class TCoerceVideoFormatOfilt<VIDFMT_YUV410P>;
00123
00124
00125
00126
00127
00128
00129
00130
00131 #endif // TRANSPORT_COERCEVIDEOFORMATOFILT_C_DEFINED