JPEGCodec::JPEGCodec(const Header &header, const ChannelList &channels) : VideoCodec(header, channels), _descriptor(header.frameRate(), header.width(), header.height(), MoxMxf::VideoDescriptor::VideoCodecJPEG) { setWindows(_descriptor, header); assert(channels.size() == 3); const Channel *r_channel = channels.findChannel("R"); if(r_channel) { assert(r_channel->type == UINT8); } else assert(false); MoxMxf::RGBADescriptor::RGBALayout layout; layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('R', 8)); layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('G', 8)); layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('B', 8)); _descriptor.setPixelLayout(layout); _quality = (isLossless(header) ? 100 : getQuality(header)); }
DPXCodec::DPXCodec(const Header &header, const ChannelList &channels) : VideoCodec(header, channels), _descriptor(header.frameRate(), header.width(), header.height(), MoxMxf::VideoDescriptor::VideoCodecDPX), _pixelAspectRatio(header.pixelAspectRatio()), _frameRate(header.frameRate()) { setWindows(_descriptor, header); const Channel *r_channel = channels.findChannel("R"); const Channel *a_channel = channels.findChannel("A"); if(r_channel == NULL) throw MoxMxf::ArgExc("Expected RGB(A) channels"); _channels = (a_channel != NULL ? DPX_RGBA : DPX_RGB); const unsigned int bit_depth = PixelBits(r_channel->type); _depth = (bit_depth == 8 ? DPX_8 : bit_depth == 10 ? DPX_10 : bit_depth == 12 ? DPX_12 : bit_depth == 16 ? DPX_16 : DPX_10); MoxMxf::RGBADescriptor::RGBALayout layout; layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('R', bit_depth)); layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('G', bit_depth)); layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('B', bit_depth)); if(_channels == DPX_RGBA) layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('A', bit_depth)); _descriptor.setPixelLayout(layout); }