X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Faffine.C;h=ff9c470907ba353b61680ae638e7c04a106f9110;hb=af44bff549c39ac8bb6e42a791e7a211e1013526;hp=f5f90a7c8228c7ee8680a8576e61e2fd31b02953;hpb=680d2000be2db33da1e2733461854158067f5862;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/affine.C b/cinelerra-5.1/cinelerra/affine.C index f5f90a7c..ff9c4709 100644 --- a/cinelerra-5.1/cinelerra/affine.C +++ b/cinelerra-5.1/cinelerra/affine.C @@ -25,6 +25,7 @@ #endif #include "affine.h" +#include "interp.h" #include "clip.h" #include "vframe.h" @@ -429,7 +430,6 @@ void AffineUnit::process_package(LoadPackage *package) float xinc, yinc, winc; AffineMatrix m, im; float ttx = 0, tty = 0; - int itx = 0, ity = 0; int tx1 = 0, ty1 = 0, tx2 = 0, ty2 = 0; if(reverse) { @@ -491,9 +491,7 @@ void AffineUnit::process_package(LoadPackage *package) server->output->to_texture(); server->output->enable_opengl(); - unsigned int frag_shader = VFrame::make_shader(0, - affine_frag, - 0); + unsigned int frag_shader = VFrame::make_shader(0, affine_frag, 0); if( frag_shader > 0 ) { glUseProgram(frag_shader); glUniform1i(glGetUniformLocation(frag_shader, "tex"), 0); @@ -555,172 +553,15 @@ void AffineUnit::process_package(LoadPackage *package) //printf("AffineUnit::process_package %d %d %d %d %d\n", // __LINE__, min_in_x, max_in_x, min_in_y, max_in_y); -#define CUBIC_ROW(in_row, chroma_offset) ( !in_row ? 0 : transform_cubic(dx, \ - cp>=min_in_x && cp=min_in_x && c0=min_in_x && c1=min_in_x && c2input->get_rows(); \ type **out_rows = (type**)server->output->get_rows(); \ float round_factor = sizeof(type) < 4 ? 0.5 : 0; \ - int comps = components; \ - for( int y=ty1; y max_out_x ) x2 = max_out_x; \ - tx = xinc * x1 + m.values[0][1] * (y + pivot_offset_y) + m.values[0][2] \ - + pivot_offset_x * xinc; \ - ty = yinc * x1 + m.values[1][1] * (y + pivot_offset_y) + m.values[1][2] \ - + pivot_offset_x * yinc; \ - tw = winc * x1 + m.values[2][1] * (y + pivot_offset_y) + m.values[2][2] \ - + pivot_offset_x * winc; \ - type *out = out_row + x1 * comps; \ - for( int x=x1; x=min_in_y && rp=min_in_y && r0=min_in_y && r1=min_in_y && r2=min_in_x && c0=min_in_x && c1input->get_rows(); \ - type **out_rows = (type**)server->output->get_rows(); \ - int comps = components; \ - float round_factor = sizeof(type) < 4 ? 0.5 : 0; \ for( int y=ty1; y max_out_x ) x2 = max_out_x; \ - tx = xinc * x1 + m.values[0][1] * (y + pivot_offset_y) + m.values[0][2] \ - + pivot_offset_x * xinc; \ - ty = yinc * x1 + m.values[1][1] * (y + pivot_offset_y) + m.values[1][2] \ - + pivot_offset_x * yinc; \ - tw = winc * x1 + m.values[2][1] * (y + pivot_offset_y) + m.values[2][2] \ - + pivot_offset_x * winc; \ - type *out = out_row + x1 * comps; \ - for( int x=x1; x=min_in_y && r0=min_in_y && r1input->get_rows(); \ - type **out_rows = (type**)server->output->get_rows(); \ - for( int y=ty1; y max_out_x ) x2 = max_out_x; \ @@ -731,25 +572,21 @@ case tag: { \ tw = winc * x1 + m.values[2][1] * (y + pivot_offset_y) + m.values[2][2] \ + pivot_offset_x * winc; \ type *out = out_row + x1 * components; \ + \ for( int x=x1; x=min_in_y && ity=min_in_x && itx=min_in_x && itx=min_in_x && itx=min_in_x && itxinterpolation ) { case AffineEngine::AF_NEAREST: switch( server->input->get_color_model() ) { - DO_NEAREST( BC_RGB_FLOAT, 3, float, float, 0x0, 1.0); - DO_NEAREST( BC_RGB888, 3, unsigned char, int, 0x0, 0xff); - DO_NEAREST( BC_RGBA_FLOAT, 4, float, float, 0x0, 1.0); - DO_NEAREST( BC_RGBA8888, 4, unsigned char, int, 0x0, 0xff); - DO_NEAREST( BC_YUV888, 3, unsigned char, int, 0x80, 0xff); - DO_NEAREST( BC_YUVA8888, 4, unsigned char, int, 0x80, 0xff); - DO_NEAREST( BC_RGB161616, 3, uint16_t, int, 0x0, 0xffff); - DO_NEAREST( BC_RGBA16161616, 4, uint16_t, int, 0x0, 0xffff); - DO_NEAREST( BC_YUV161616, 3, uint16_t, int, 0x8000, 0xffff); - DO_NEAREST( BC_YUVA16161616, 4, uint16_t, int, 0x8000, 0xffff); + DO_INTERP( BC_RGB_FLOAT, nearest, 3, float, float, 0x0, 1.0); + DO_INTERP( BC_RGB888, nearest, 3, unsigned char, int, 0x0, 0xff); + DO_INTERP( BC_RGBA_FLOAT, nearest, 4, float, float, 0x0, 1.0); + DO_INTERP( BC_RGBA8888, nearest, 4, unsigned char, int, 0x0, 0xff); + DO_INTERP( BC_YUV888, nearest, 3, unsigned char, int, 0x80, 0xff); + DO_INTERP( BC_YUVA8888, nearest, 4, unsigned char, int, 0x80, 0xff); + DO_INTERP( BC_RGB161616, nearest, 3, uint16_t, int, 0x0, 0xffff); + DO_INTERP( BC_RGBA16161616, nearest, 4, uint16_t, int, 0x0, 0xffff); + DO_INTERP( BC_YUV161616, nearest, 3, uint16_t, int, 0x8000, 0xffff); + DO_INTERP( BC_YUVA16161616, nearest, 4, uint16_t, int, 0x8000, 0xffff); } break; case AffineEngine::AF_LINEAR: switch( server->input->get_color_model() ) { - DO_LINEAR( BC_RGB_FLOAT, 3, float, float, 0x0, 1.0); - DO_LINEAR( BC_RGB888, 3, unsigned char, int, 0x0, 0xff); - DO_LINEAR( BC_RGBA_FLOAT, 4, float, float, 0x0, 1.0); - DO_LINEAR( BC_RGBA8888, 4, unsigned char, int, 0x0, 0xff); - DO_LINEAR( BC_YUV888, 3, unsigned char, int, 0x80, 0xff); - DO_LINEAR( BC_YUVA8888, 4, unsigned char, int, 0x80, 0xff); - DO_LINEAR( BC_RGB161616, 3, uint16_t, int, 0x0, 0xffff); - DO_LINEAR( BC_RGBA16161616, 4, uint16_t, int, 0x0, 0xffff); - DO_LINEAR( BC_YUV161616, 3, uint16_t, int, 0x8000, 0xffff); - DO_LINEAR( BC_YUVA16161616, 4, uint16_t, int, 0x8000, 0xffff); + DO_INTERP( BC_RGB_FLOAT, bi_linear, 3, float, float, 0x0, 1.0); + DO_INTERP( BC_RGB888, bi_linear, 3, unsigned char, int, 0x0, 0xff); + DO_INTERP( BC_RGBA_FLOAT, bi_linear, 4, float, float, 0x0, 1.0); + DO_INTERP( BC_RGBA8888, bi_linear, 4, unsigned char, int, 0x0, 0xff); + DO_INTERP( BC_YUV888, bi_linear, 3, unsigned char, int, 0x80, 0xff); + DO_INTERP( BC_YUVA8888, bi_linear, 4, unsigned char, int, 0x80, 0xff); + DO_INTERP( BC_RGB161616, bi_linear, 3, uint16_t, int, 0x0, 0xffff); + DO_INTERP( BC_RGBA16161616, bi_linear, 4, uint16_t, int, 0x0, 0xffff); + DO_INTERP( BC_YUV161616, bi_linear, 3, uint16_t, int, 0x8000, 0xffff); + DO_INTERP( BC_YUVA16161616, bi_linear, 4, uint16_t, int, 0x8000, 0xffff); } break; default: case AffineEngine::AF_CUBIC: switch( server->input->get_color_model() ) { - DO_CUBIC( BC_RGB_FLOAT, 3, float, float, 0x0, 1.0); - DO_CUBIC( BC_RGB888, 3, unsigned char, int, 0x0, 0xff); - DO_CUBIC( BC_RGBA_FLOAT, 4, float, float, 0x0, 1.0); - DO_CUBIC( BC_RGBA8888, 4, unsigned char, int, 0x0, 0xff); - DO_CUBIC( BC_YUV888, 3, unsigned char, int, 0x80, 0xff); - DO_CUBIC( BC_YUVA8888, 4, unsigned char, int, 0x80, 0xff); - DO_CUBIC( BC_RGB161616, 3, uint16_t, int, 0x0, 0xffff); - DO_CUBIC( BC_RGBA16161616, 4, uint16_t, int, 0x0, 0xffff); - DO_CUBIC( BC_YUV161616, 3, uint16_t, int, 0x8000, 0xffff); - DO_CUBIC( BC_YUVA16161616, 4, uint16_t, int, 0x8000, 0xffff); + DO_INTERP( BC_RGB_FLOAT, bi_cubic, 3, float, float, 0x0, 1.0); + DO_INTERP( BC_RGB888, bi_cubic, 3, unsigned char, int, 0x0, 0xff); + DO_INTERP( BC_RGBA_FLOAT, bi_cubic, 4, float, float, 0x0, 1.0); + DO_INTERP( BC_RGBA8888, bi_cubic, 4, unsigned char, int, 0x0, 0xff); + DO_INTERP( BC_YUV888, bi_cubic, 3, unsigned char, int, 0x80, 0xff); + DO_INTERP( BC_YUVA8888, bi_cubic, 4, unsigned char, int, 0x80, 0xff); + DO_INTERP( BC_RGB161616, bi_cubic, 3, uint16_t, int, 0x0, 0xffff); + DO_INTERP( BC_RGBA16161616, bi_cubic, 4, uint16_t, int, 0x0, 0xffff); + DO_INTERP( BC_YUV161616, bi_cubic, 3, uint16_t, int, 0x8000, 0xffff); + DO_INTERP( BC_YUVA16161616, bi_cubic, 4, uint16_t, int, 0x8000, 0xffff); } break; }