X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftags%2Fsynfig_0_61_04%2Fsynfig-core%2Fsrc%2Fmodules%2Fmod_yuv420p%2Ftrgt_yuv.cpp;fp=synfig-core%2Ftags%2Fsynfig_0_61_04%2Fsynfig-core%2Fsrc%2Fmodules%2Fmod_yuv420p%2Ftrgt_yuv.cpp;h=0000000000000000000000000000000000000000;hb=6fa8f2f38d4b0b35f8539bf94e27ae27015c7689;hp=e2da345e7b062285bd4ed3e0b7e961938ca56fb4;hpb=47fce282611fbba1044921d22ca887f9b53ad91a;p=synfig.git diff --git a/synfig-core/tags/synfig_0_61_04/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp b/synfig-core/tags/synfig_0_61_04/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp deleted file mode 100644 index e2da345..0000000 --- a/synfig-core/tags/synfig_0_61_04/synfig-core/src/modules/mod_yuv420p/trgt_yuv.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file trgt_yuv.cpp -** \brief Template File -** -** $Id: trgt_yuv.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#define SYNFIG_TARGET - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "trgt_yuv.h" -#include -#include -#include -#include -#endif - -using namespace synfig; -using namespace std; -using namespace etl; - -/* === M A C R O S ========================================================= */ - -#define Y_FLOOR (16) -#define Y_CEIL (235) -#define Y_RANGE (Y_CEIL-Y_FLOOR) - -#define UV_FLOOR (16) -#define UV_CEIL (240) -#define UV_RANGE (UV_CEIL-UV_FLOOR) - -/* === G L O B A L S ======================================================= */ - -SYNFIG_TARGET_INIT(yuv); -SYNFIG_TARGET_SET_NAME(yuv,"yuv420p"); -SYNFIG_TARGET_SET_EXT(yuv,"yuv"); -SYNFIG_TARGET_SET_VERSION(yuv,"0.1"); -SYNFIG_TARGET_SET_CVS_ID(yuv,"$Id: trgt_yuv.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $"); - -/* === M E T H O D S ======================================================= */ - -yuv::yuv(const char *FILENAME): - filename(FILENAME), - file( (filename=="-")?stdout:fopen(filename.c_str(),"wb") ), - dithering(true) -{ - // YUV420P doesn't have an alpha channel - set_remove_alpha(); -} - -yuv::~yuv() -{ -} - -bool -yuv::set_rend_desc(RendDesc *given_desc) -{ - given_desc->clear_flags(); - - // Make sure our width is divisible by two - given_desc->set_w(given_desc->get_w()*2/2); - given_desc->set_h(given_desc->get_h()*2/2); - - desc=*given_desc; - - // Set up our surface - surface.set_wh(desc.get_w(),desc.get_h()); - - return true; -} - -bool -yuv::start_frame(synfig::ProgressCallback *callback) -{ - return static_cast(file); -} - -Color * -yuv::start_scanline(int x) -{ - return surface[x]; -} - -bool -yuv::end_scanline() -{ - return static_cast(file); -} - -void -yuv::end_frame() -{ - const int w=desc.get_w(),h=desc.get_h(); - int x,y; - - assert(file); - - // Output Y' channel, adjusting - // the gamma as we go - for(y=0;yy+1) - { - surface[y+1][x-1]+=error * ((float)3/(float)16); - surface[y+1][x]+=error * ((float)5/(float)16); - if(surface.get_w()>x+1) - surface[y+1][x+1]+=error * ((float)1/(float)16); - } - if(surface.get_w()>x+1) - surface[y][x+1]+=error * ((float)7/(float)16); - } - - fputc(i,file.get()); - } - - - // Create new super-sampled surface - Surface sm_surface(w/2,h/2); - for(y=0;yy+1) - { - sm_surface[y+1][x-1]+=error * ((float)3/(float)16); - sm_surface[y+1][x]+=error * ((float)5/(float)16); - if(sm_surface.get_w()>x+1) - sm_surface[y+1][x+1]+=error * ((float)1/(float)16); - } - if(sm_surface.get_w()>x+1) - sm_surface[y][x+1]+=error * ((float)7/(float)16); - } - fputc(i,file.get()); - } - - // Output V channel - for(y=0;yy+1) - { - sm_surface[y+1][x-1]+=error * ((float)3/(float)16); - sm_surface[y+1][x]+=error * ((float)5/(float)16); - if(sm_surface.get_w()>x+1) - sm_surface[y+1][x+1]+=error * ((float)1/(float)16); - } - if(sm_surface.get_w()>x+1) - sm_surface[y][x+1]+=error * ((float)7/(float)16); - } - fputc(i,file.get()); - } - - // Flush out the frame - fflush(file.get()); -}