#include "tracks.h"
#include "transportque.h"
#include "vtrack.h"
+#include "zoombar.h"
static double my_zoom_table[] =
z_keyframe->set_value(1);
gui->sync_parameters(CHANGE_PARAMS, 1, 1);
+ MWindowGUI *mgui = mwindow->gui;
+ mgui->lock_window("CWindowCanvas::reset_keyframe");
+ gui->mwindow->edl->local_session->reset_view_limits();
+ gui->mwindow->gui->zoombar->update_autozoom();
+ mgui->unlock_window();
}
}
int CWindowCoordRange::update(float scale)
{
+ CWindowCoordSlider *slider = coord->slider;
MWindow *mwindow = coord->gui->mwindow;
LocalSession *local_session = mwindow->edl->local_session;
int group = Automation::autogrouptype(coord->type, 0);
case AUTOGROUPTYPE_Y: min = -100; max = 100; break;
}
}
- float range = max - min;
- min -= range * scale;
- max += range * scale;
switch( group ) {
- case AUTOGROUPTYPE_ZOOM:
+ case AUTOGROUPTYPE_ZOOM: { // exp
+ float lv = log(slider->get_value());
+ float lmin = log(min), lmax = log(max);
+ float lr = (lmax - lmin) * scale;
+ min = exp(lv - 0.5*lr);
+ max = exp(lv + 0.5*lr);
if( min < 0.001 ) min = 0.001;
if( max > 1000. ) max = 1000.;
- break;
+ break; }
case AUTOGROUPTYPE_X:
- case AUTOGROUPTYPE_Y:
- if( min < -32767 ) min = -32767;
- if( max > 32767 ) max = 32767;
- break;
+ case AUTOGROUPTYPE_Y: { // linear
+ float dr = (max - min) * (scale-1);
+ if( (min -= dr) < -32767 ) min = -32767;
+ if( (max += dr) > 32767 ) max = 32767;
+ break; }
}
- CWindowCoordSlider *slider = coord->slider;
- coord->slider->update(slider->get_pointer_motion_range(),
+ slider->update(slider->get_pointer_motion_range(),
slider->get_value(), min, max);
unlock_window();
MWindowGUI *mgui = mwindow->gui;
int CWindowCoordRange::handle_up_event()
{
- return update(0.5);
+ return update(1.25);
}
int CWindowCoordRange::handle_down_event()
{
- return update(-0.25);
+ return update(0.8);
}
CWindowCropApply::CWindowCropApply(MWindow *mwindow, CWindowCropGUI *crop_gui, int x, int y)
x1 += paste->get_w();
}
- if( use_meters ) {
- if( meter_panel ) {
- meters = new MeterShow(mwindow, meter_panel, x1, y1);
- subwindow->add_subwindow(meters);
- x1 += meters->get_w();
- }
- else
- printf("EditPanel::create_objects: meter_panel == 0\n");
- }
-
if( use_labels ) {
labelbutton = new EditLabelbutton(mwindow, this, x1, y1);
subwindow->add_subwindow(labelbutton);
scope_dialog = new EditPanelScopeDialog(mwindow, this);
}
+ if( use_meters ) {
+ if( meter_panel ) {
+ meters = new MeterShow(mwindow, meter_panel, x1, y1);
+ subwindow->add_subwindow(meters);
+ x1 += meters->get_w();
+ }
+ else
+ printf("EditPanel::create_objects: meter_panel == 0\n");
+ }
+
if( use_commercial ) {
commercial = new EditCommercial(mwindow, this, x1, y1);
subwindow->add_subwindow(commercial);
x1 += paste->get_w();
}
- if( use_meters ) {
- meters->reposition_window(x1, y1);
- x1 += meters->get_w();
- }
-
if( use_labels ) {
labelbutton->reposition_window(x1, y1);
x1 += labelbutton->get_w();
scope->reposition_window(x1, y1-yS(1));
x1 += scope->get_w();
}
+
+ if( use_meters ) {
+ meters->reposition_window(x1, y1);
+ x1 += meters->get_w();
+ }
}
void EditPanel::create_objects()
track_start[i] = 0;
}
+ reset_view_limits();
automation_mins[AUTOGROUPTYPE_AUDIO_FADE] = -80;
automation_maxs[AUTOGROUPTYPE_AUDIO_FADE] = 6;
-
automation_mins[AUTOGROUPTYPE_VIDEO_FADE] = 0;
automation_maxs[AUTOGROUPTYPE_VIDEO_FADE] = 100;
-
- automation_mins[AUTOGROUPTYPE_ZOOM] = 0.005;
- automation_maxs[AUTOGROUPTYPE_ZOOM] = 5.000;
-
automation_mins[AUTOGROUPTYPE_SPEED] = 0.005;
automation_maxs[AUTOGROUPTYPE_SPEED] = 5.000;
-
- automation_mins[AUTOGROUPTYPE_X] = -100;
- automation_maxs[AUTOGROUPTYPE_X] = 100;
-
- automation_mins[AUTOGROUPTYPE_Y] = -100;
- automation_maxs[AUTOGROUPTYPE_Y] = 100;
-
automation_mins[AUTOGROUPTYPE_INT255] = 0;
automation_maxs[AUTOGROUPTYPE_INT255] = 255;
return out_point >= 0;
}
+void LocalSession::reset_view_limits()
+{
+ automation_mins[AUTOGROUPTYPE_ZOOM] = 0.005;
+ automation_maxs[AUTOGROUPTYPE_ZOOM] = 5.000;
+ automation_mins[AUTOGROUPTYPE_X] = -100;
+ automation_maxs[AUTOGROUPTYPE_X] = 100;
+ automation_mins[AUTOGROUPTYPE_Y] = -100;
+ automation_maxs[AUTOGROUPTYPE_Y] = 100;
+}
+
void synchronize_params(LocalSession *that);
void boundaries();
+ void reset_view_limits();
EDL *edl;
int buttons_h = get_image("rewind")->get_h() + widget_border;
+ int panel_y = mwindow->session->cwindow_h - buttons_h + yS(4);
ctransport_x = widget_border;
- ctransport_y = mwindow->session->cwindow_h - buttons_h - widget_border;
if( ctransport_x + transport_w + widget_border +
edit_w + widget_border + zoom_w + widget_border +
division_w + status_w > cmeter_x ) {
- buttons_h += EditPanel::calculate_h(mwindow) + widget_border;
- cedit_x = widget_border;
- cedit_y = mwindow->session->cwindow_h - buttons_h;
+ ctransport_y = panel_y;
czoom_x = ctransport_x + transport_w + widget_border;
- czoom_y = ctransport_y + widget_border;
+ czoom_y = panel_y;
cstatus_x = xS(440);
- cstatus_y = cedit_y + yS(20);
+ cstatus_y = panel_y - yS(2);
+ int edit_h = EditPanel::calculate_h(mwindow) + widget_border;
+ buttons_h += edit_h; panel_y -= edit_h;
+ cedit_x = widget_border;
+ cedit_y = panel_y;
}
else {
ctransport_x = widget_border;
- ctransport_y = mwindow->session->cwindow_h - buttons_h;
+ ctransport_y = panel_y;
cedit_x = ctransport_x + transport_w + widget_border;
- cedit_y = ctransport_y;
+ cedit_y = panel_y;
czoom_x = cedit_x + edit_w + widget_border;
- czoom_y = cedit_y + widget_border;
+ czoom_y = panel_y;
cstatus_x = czoom_x + zoom_w + division_w;
- cstatus_y = ctransport_y;
+ cstatus_y = panel_y;
}
buttons_h += ctimebar_h;
vcanvas_w = vmeter_x - vcanvas_x - widget_border;
int buttons_h = get_image("rewind")->get_h() + widget_border;
+ int panel_y = mwindow->session->vwindow_h - buttons_h + yS(4);
vtransport_x = widget_border;
- vtransport_y = mwindow->session->vwindow_h - buttons_h - widget_border;
if( vtransport_x + transport_w + widget_border +
edit_w + widget_border + vtime_w + xS(40) + widget_border > vmeter_x ) {
- buttons_h += EditPanel::calculate_h(mwindow) + widget_border;
- vedit_x = widget_border;
- vedit_y = mwindow->session->vwindow_h - buttons_h;
+ vtransport_y = panel_y;
vzoom_x = vtransport_x + transport_w + widget_border;
- vzoom_y = vtransport_y + widget_border;
- vdivision_x = xS(280);
+ vzoom_y = panel_y;
+ vdivision_x = xS(320);
vtime_x = vdivision_x;
- vtime_y = vtransport_y + widget_border;;
+ vtime_y = panel_y;
+ int edit_h = EditPanel::calculate_h(mwindow) + widget_border;
+ buttons_h += edit_h; panel_y -= edit_h;
+ vedit_x = widget_border;
+ vedit_y = panel_y;
}
else {
vtransport_x = widget_border;
- vtransport_y = mwindow->session->vwindow_h - buttons_h;
+ vtransport_y = panel_y;
vedit_x = vtransport_x + transport_w + widget_border;
- vedit_y = vtransport_y;
+ vedit_y = panel_y;
vdivision_x = vedit_x + edit_w + division_w;
vtime_x = vdivision_x + vtime_border;
- vtime_y = vtransport_y + widget_border;;
+ vtime_y = panel_y;
}
buttons_h += vtimebar_h;
F_deshake
- Desenfoque
Blur
+ BoxBlur
Edge
Linear Blur
Motion Blur
F_deshake
- Blur
Blur
+ BoxBlur
Edge
Linear Blur
Motion Blur
#include <errno.h>
#include <png.h>
+#include <jpeglib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
if (src_color_model == PNG_COLOR_TYPE_GRAY && png_get_bit_depth(png_ptr, info_ptr) < 8)
png_set_expand(png_ptr);
- if (src_color_model == PNG_COLOR_TYPE_GRAY ||
- src_color_model == PNG_COLOR_TYPE_GRAY_ALPHA)
+ if (src_color_model == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
/* expand paletted or RGB images with transparency to full alpha channels
png_set_expand(png_ptr);
}
- switch(src_color_model)
- {
- case PNG_COLOR_TYPE_GRAY:
- case PNG_COLOR_TYPE_RGB:
- new_color_model = BC_RGB888;
- break;
-
- case PNG_COLOR_TYPE_GRAY_ALPHA:
- case PNG_COLOR_TYPE_RGB_ALPHA:
- default:
- new_color_model = BC_RGBA8888;
- break;
-
- case PNG_COLOR_TYPE_PALETTE:
- if(have_alpha)
- new_color_model = BC_RGBA8888;
- else
- new_color_model = BC_RGB888;
+ switch(src_color_model) {
+ case PNG_COLOR_TYPE_GRAY:
+ new_color_model = BC_GREY8;
+ break;
+ case PNG_COLOR_TYPE_RGB:
+ new_color_model = BC_RGB888;
+ break;
+ case PNG_COLOR_TYPE_PALETTE:
+ new_color_model = have_alpha ? BC_RGBA8888 : BC_RGB888;
+ break;
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
+ case PNG_COLOR_TYPE_RGB_ALPHA:
+ default:
+ new_color_model = BC_RGBA8888;
+ break;
}
-
reallocate(NULL, -1, 0, 0, 0, w, h, new_color_model, -1);
//printf("VFrame::read_png %d %d %d %p\n", __LINE__, w, h, get_rows());
}
+// jpeg decompress
+class jpeg_err : public jpeg_error_mgr
+{
+ static void s_error_exit(j_common_ptr cp);
+ static void s_output_message(j_common_ptr cp);
+public:
+ jpeg_err() {
+ jpeg_std_error((jpeg_error_mgr *)this);
+ error_exit = s_error_exit;
+ output_message = s_output_message;
+ }
+ ~jpeg_err() {}
+};
+
+class jpeg_src : public jpeg_source_mgr
+{
+ static void s_init_source(j_decompress_ptr jp);
+ static boolean s_fill_input_buffer(j_decompress_ptr jp);
+ static void s_skip_input_data(j_decompress_ptr jp, long len);
+ static void s_term_source(j_decompress_ptr jp);
+ static boolean s_resync_to_restart(j_decompress_ptr jp, int v);
+public:
+ jpeg_src();
+ ~jpeg_src();
+ int jpeg_file(int fd);
+ int jpeg_mem(const unsigned char *bfr, long len);
+
+ int fd;
+ unsigned char *mbfr;
+ long mlen;
+ enum { buffer_sz=0x10000, file_sz=0x100000, };
+ unsigned char *buffer;
+ boolean fill_buffer();
+ void skip_data(long len);
+};
+
+class JpegVFrame : public jpeg_decompress_struct
+{
+public:
+ JpegVFrame();
+ ~JpegVFrame();
+ int read_jpeg(VFrame *vfrm, double xs, double ys, int jpeg_model);
+
+ jpeg_err jerr;
+ jpeg_src jsrc;
+ int debug, ret;
+};
+
+
+void jpeg_err:: s_error_exit(j_common_ptr cp)
+{
+ JpegVFrame *jpeg = (JpegVFrame *)cp;
+ jpeg->ret = 1;
+ if( !jpeg->debug ) return;
+ printf("s_error_exit()\n");
+}
+
+void jpeg_err::
+s_output_message(j_common_ptr cp)
+{
+ JpegVFrame *jpeg = (JpegVFrame *)cp;
+ if( !jpeg->debug ) return;
+ char msg[JMSG_LENGTH_MAX];
+ (*cp->err->format_message)(cp, msg);
+ printf("s_output_message() = %s\n",&msg[0]);
+}
+
+
+jpeg_src::jpeg_src()
+{
+ init_source = s_init_source;
+ fill_input_buffer = s_fill_input_buffer;
+ skip_input_data = s_skip_input_data;
+ resync_to_restart = s_resync_to_restart;
+ term_source = s_term_source;
+
+ fd = -1;
+ buffer = 0;
+ mbfr = 0;
+ mlen = -1;
+}
+
+jpeg_src::~jpeg_src()
+{
+ if( mbfr ) ::munmap(mbfr, mlen);
+ delete [] buffer;
+}
+
+int jpeg_src::jpeg_file(int fd)
+{
+ this->fd = fd;
+ struct stat st;
+ if( fstat(fd, &st) || !st.st_size ) return 0;
+ if( st.st_size < file_sz ) {
+ mbfr = (unsigned char *)::mmap(0, mlen = st.st_size,
+ PROT_READ, MAP_SHARED, fd, 0);
+ if( mbfr == MAP_FAILED ) return 0;
+ next_input_byte = mbfr;
+ bytes_in_buffer = mlen;
+ }
+ else {
+ buffer = new unsigned char[buffer_sz];
+ next_input_byte = &buffer[0];
+ bytes_in_buffer = 0;
+ }
+ return 1;
+}
+int jpeg_src::jpeg_mem(const unsigned char *bfr, long len)
+{
+ next_input_byte = bfr;
+ bytes_in_buffer = len;
+ return 1;
+}
+
+void jpeg_src::s_init_source(j_decompress_ptr jp) {}
+void jpeg_src::s_term_source(j_decompress_ptr jp) {}
+
+boolean jpeg_src::s_resync_to_restart(j_decompress_ptr jp, int v)
+{
+ return jpeg_resync_to_restart(jp, v);
+}
+
+boolean jpeg_src::s_fill_input_buffer(j_decompress_ptr jp)
+{
+ JpegVFrame *jpeg = (JpegVFrame *)jp;
+ return jpeg->jsrc.fill_buffer();
+}
+
+boolean jpeg_src::fill_buffer()
+{
+ if( mbfr || fd < 0 ) return 0;
+ long n = ::read(fd, buffer, buffer_sz);
+ if( n < 0 ) perror("jpeg read");
+ if( !n ) return 0;
+ next_input_byte = buffer;
+ bytes_in_buffer = n;
+ return 1;
+}
+
+void jpeg_src::s_skip_input_data(j_decompress_ptr jp, long len)
+{
+ JpegVFrame *jpeg = (JpegVFrame *)jp;
+ jpeg->jsrc.skip_data(len);
+}
+
+void jpeg_src::skip_data(long len)
+{
+ while( len > (long) bytes_in_buffer ) {
+ len -= (long) bytes_in_buffer;
+ if( !fill_buffer() ) return;
+ }
+ next_input_byte += len;
+ bytes_in_buffer -= len;
+}
+
+
+JpegVFrame::JpegVFrame()
+{
+ jpeg_create_decompress(this);
+ debug = 1; ret = 0;
+ err = &jerr; src = &jsrc;
+}
+JpegVFrame::~JpegVFrame()
+{
+ jpeg_destroy_decompress(this);
+}
+
+int JpegVFrame::read_jpeg(VFrame *vfrm, double xs, double ys, int jpeg_model)
+{
+ VFrame *xfrm = vfrm;
+ int color_model = xfrm->get_color_model();
+ if( color_model == BC_COMPRESSED ) color_model = jpeg_model;
+ jpeg_abort((jpeg_common_struct *)this);
+ if( jpeg_read_header(this, TRUE) != JPEG_HEADER_OK ) return 0;
+ jpeg_calc_output_dimensions(this);
+ quantize_colors = FALSE;
+ out_color_space =
+ jpeg_model == BC_YUV888 ? JCS_YCbCr :
+ jpeg_model == BC_GREY8 ? JCS_GRAYSCALE : JCS_RGB;
+ jpeg_calc_output_dimensions(this);
+ int w = bmax(image_width*xs, 1.);
+ int h = bmax(image_height*ys, 1.);
+ vfrm->reallocate(0, -1, 0, 0, 0, w, h, color_model, -1);
+ if( w != (int)image_width || h != (int)image_height ||
+ color_model != jpeg_model )
+ xfrm = new VFrame(image_width, image_height, jpeg_model);
+ unsigned char *pic = xfrm->get_data();
+ int linesz = xfrm->get_bytes_per_line();
+ jpeg_start_decompress(this);
+ while( !ret && output_scanline < image_height ) {
+ JSAMPROW rowptr = (JSAMPROW) &pic[output_scanline * linesz];
+ jpeg_read_scanlines(this, &rowptr, (JDIMENSION) 1);
+ }
+ jpeg_finish_decompress(this);
+ if( vfrm != xfrm ) {
+ vfrm->transfer_from(xfrm);
+ delete xfrm;
+ }
+ return 1;
+}
+
+int VFrameJpeg::read_jpeg(const unsigned char *data, long sz,
+ double xscale, double yscale, int jpeg_model)
+{
+ JpegVFrame jpeg;
+ jpeg.jsrc.jpeg_mem(data, sz);
+ return jpeg.read_jpeg(this, xscale, yscale, jpeg_model);
+}
+
+VFrameJpeg::VFrameJpeg(const unsigned char *jpeg_data, double s)
+{
+ long image_size =
+ ((long)jpeg_data[0] << 24) | ((long)jpeg_data[1] << 16) |
+ ((long)jpeg_data[2] << 8) | (long)jpeg_data[3];
+ if( !s ) s = BC_WindowBase::get_resources()->icon_scale;
+ read_jpeg(jpeg_data+4, image_size, s, s, BC_RGB888);
+}
+
+VFrameJpeg::VFrameJpeg(const unsigned char *jpeg_data, long image_size, double xs, double ys)
+{
+ if( !xs ) xs = BC_WindowBase::get_resources()->icon_scale;
+ if( !ys ) ys = BC_WindowBase::get_resources()->icon_scale;
+ read_jpeg(jpeg_data, image_size, xs, ys, BC_RGB888);
+}
+
+VFrameJpeg::~VFrameJpeg()
+{
+}
+
+
+VFrame *VFrameJpeg::vframe_jpeg(int fd, double xs, double ys, int jpeg_model)
+{
+ JpegVFrame jpeg;
+ jpeg.jsrc.jpeg_file(fd);
+ VFrame *vfrm = new VFrame();
+ if( !jpeg.read_jpeg(vfrm, xs, ys, jpeg_model) ) {
+ delete vfrm; vfrm = 0;
+ }
+ return vfrm;
+}
+
+VFrame *VFrameJpeg::vframe_jpeg(const char *jpeg_path, double xs, double ys, int jpeg_model)
+{
+ VFrame *vframe = 0;
+ int fd = ::open(jpeg_path, O_RDONLY);
+ if( fd >= 0 ) {
+ vframe = vframe_jpeg(fd, xs, ys, jpeg_model);
+ ::close(fd);
+ }
+ return vframe;
+}
+
class VFrame
{
friend class VFramePng;
+ friend class VFrameJpeg;
friend class PngReadFunction;
public:
// Create new frame with shared data if *data is nonzero.
static VFrame *vframe_png(const char *png_path, double xs=1, double ys=1);
};
+// Create a frame with the jpeg image
+// jpeg_model must be BC_RGB888, BC_YUV888, or BC_GREY8
+class VFrameJpeg : public VFrame
+{
+// Read a JPEG into the frame (no alpha)
+ int read_jpeg(const unsigned char *data, long sz,
+ double xscale, double yscale, int jpeg_model);
+public:
+ VFrameJpeg(const unsigned char *jpeg_data, double s=0);
+ VFrameJpeg(const unsigned char *jpeg_data, long image_size, double xs=0, double ys=0);
+ virtual ~VFrameJpeg();
+ static VFrame *vframe_jpeg(int fd,
+ double xs=1, double ys=1, int jpeg_model=BC_RGB888);
+ static VFrame *vframe_jpeg(const char *jpeg_path,
+ double xs=1, double ys=1, int jpeg_model=BC_RGB888);
+};
+
#endif
#include <png.h>
#include <math.h>
#include <stdint.h>
+#include <fcntl.h>
#include <string.h>
#define SHAPE_SEARCHPATH "/shapes"
current_filename[0] = '\0';
current_name[0] = 0;
pattern_image = 0;
- min_value = 255;
- max_value = 0;
last_preserve_aspect = 0;
shapes_initialized = 0;
shape_paths.set_array_delete();
{
if( !shapes_initialized ) {
FileSystem fs;
- fs.set_filter("*.png");
+ fs.set_filter("[*.png][*.jpg]");
char shape_path[BCTEXTLEN];
sprintf(shape_path, "%s%s", get_plugin_dir(), SHAPE_SEARCHPATH);
fs.update(shape_path);
}
}
-
int ShapeWipeMain::load_configuration()
{
read_data(get_prev_keyframe(get_source_position()));
}
int ShapeWipeMain::read_pattern_image(char *shape_name,
- int new_frame_width, int new_frame_height)
-{
- png_byte header[8];
- int is_png;
- int row, col;
- int pixel_width;
- unsigned char value;
- png_uint_32 width;
- png_uint_32 height;
- png_byte color_type;
- png_byte bit_depth;
- png_structp png_ptr = 0;
- png_infop info_ptr = 0;
- png_infop end_info = 0;
- png_bytep *image = 0;
- FILE *fp = 0;
- frame_width = new_frame_width;
- frame_height = new_frame_height;
- int ret = 0;
-
+ int frame_width, int frame_height)
+{
+ VFrame *pattern = 0;
+ int ret = 0, fd = -1;
+ int is_png = 0;
+ unsigned char header[10];
// Convert name to filename
- int k = shape_paths.size();
+ int k = shape_paths.size(), hsz = sizeof(header);
while( --k>=0 && strcmp(shape_titles[k], shape_name) );
if( k < 0 ) ret = 1;
if( !ret ) {
strcpy(current_filename, shape_paths[k]);
- fp = fopen(current_filename, "rb");
- if( !fp ) ret = 1;
+ fd = ::open(current_filename, O_RDONLY);
+ if( fd < 0 || read(fd,header,hsz) != hsz ) ret = 1;
}
if( !ret ) {
- fread(header, 1, 8, fp);
- is_png = !png_sig_cmp(header, 0, 8);
- if( !is_png ) ret = 1;
+ is_png = !png_sig_cmp(header, 0, hsz);
+ if( !is_png && strncmp("JFIF", (char*)header+6, 4) ) ret = 1;
}
if( !ret ) {
- png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
- if( !png_ptr ) ret = 1;
+ lseek(fd, 0, SEEK_SET);
+ pattern = is_png ?
+ VFramePng::vframe_png(fd, 1, 1) :
+ VFrameJpeg::vframe_jpeg(fd, 1, 1, BC_GREY8);
+ if( !pattern ) ret = 1;
}
- if( !ret ) {
- /* Tell libpng we already checked the first 8 bytes */
- png_set_sig_bytes(png_ptr, 8);
- info_ptr = png_create_info_struct(png_ptr);
- if( !info_ptr ) ret = 1;
- }
- if( !ret ) {
- end_info = png_create_info_struct(png_ptr);
- if( !end_info ) ret = 1;
+ if( fd >= 0 ) {
+ close(fd); fd = -1;
}
if( !ret ) {
- png_init_io(png_ptr, fp);
- png_read_info(png_ptr, info_ptr);
-
- color_type = png_get_color_type(png_ptr, info_ptr);
- bit_depth = png_get_bit_depth(png_ptr, info_ptr);
- width = png_get_image_width (png_ptr, info_ptr);
- height = png_get_image_height(png_ptr, info_ptr);
-
- /* Skip the alpha channel if present
- * stripping alpha currently doesn't work in conjunction with
- * converting to grayscale in libpng */
- pixel_width = color_type & PNG_COLOR_MASK_ALPHA ? 2 : 1;
- /* Convert 16 bit data to 8 bit */
- if( bit_depth == 16 ) png_set_strip_16(png_ptr);
- /* Expand to 1 pixel per byte if necessary */
- if( bit_depth < 8 ) png_set_packing(png_ptr);
-
- /* Convert to grayscale */
- if( color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_RGB_ALPHA )
- png_set_rgb_to_gray_fixed(png_ptr, 1, -1, -1);
-
- /* Allocate memory to hold the original png image */
- image = (png_bytep*)new png_bytep[height];
- for( row=0; row<(int)height; ++row )
- image[row] = new png_byte[width*pixel_width];
-
- /* Allocate memory for the pattern image that will actually be
- * used for the wipe */
- pattern_image = new unsigned char*[frame_height];
-
- png_read_image(png_ptr, image);
- png_read_end(png_ptr, end_info);
-
+ int width = pattern->get_w(), height = pattern->get_h();
double row_factor, col_factor;
double row_offset = 0.5, col_offset = 0.5; // for rounding
row_factor = (double)(height-1)/(double)(frame_height-1);
col_factor = (double)(width-1)/(double)(frame_width-1);
}
+ int out_w = width * col_factor, out_h = height * row_factor;
+ if( out_w != width || out_h != height ) {
+ VFrame *new_pattern = new VFrame(frame_width, frame_height, BC_GREY8);
+ new_pattern->transfer_from(pattern, 0, col_offset,row_offset,
+ frame_width*col_factor, frame_height*row_factor);
+ delete pattern; pattern = new_pattern;
+ }
+ unsigned char **rows = pattern->get_rows();
+ unsigned char min = 0xff, max = 0x00;
// first, determine range min..max
for( int y=0; y<frame_height; ++y ) {
- row = (int)(row_factor*y + row_offset);
+ unsigned char *row = rows[y];
for( int x=0; x<frame_width; ++x ) {
- col = (int)(col_factor*x + col_offset)*pixel_width;
- value = image[row][col];
- if( value < min_value ) min_value = value;
- if( value > max_value ) max_value = value;
+ unsigned char value = row[x];
+ if( value < min ) min = value;
+ if( value > max ) max = value;
}
}
- int range = max_value - min_value;
+ if( min > max ) min = max;
+ int range = max - min;
if( !range ) range = 1;
+ pattern_image = new unsigned char*[frame_height];
// scale to fade normalized pattern_image
for( int y=0; y<frame_height; ++y ) {
- row = (int)(row_factor*y + row_offset);
+ unsigned char *row = rows[y];
pattern_image[y] = new unsigned char[frame_width];
for( int x=0; x<frame_width; ++x ) {
- col = (int)(col_factor*x + col_offset)*pixel_width;
- value = image[row][col];
- pattern_image[y][x] = 0xff*(value - min_value) / range;
+ unsigned char value = row[x];
+ pattern_image[y][x] = 0xff*(value-min) / range;
}
}
+ this->frame_width = frame_width;
+ this->frame_height = frame_height;
}
- if( png_ptr || info_ptr || end_info )
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- if( fp )
- fclose(fp);
- if( image ) {
- for( row=0; row<(int)height; ++row )
- delete [] image[row];
- delete [] image;
- }
return ret;
}
for( int y=0; y<frame_height; ++y )
delete [] pattern_image[y];
delete [] pattern_image; pattern_image = 0;
- min_value = 255;
- max_value = 0; // updated in read_pattern_image
}
}
char current_filename[BCTEXTLEN];
char current_name[BCTEXTLEN];
unsigned char **pattern_image;
- unsigned char min_value;
- unsigned char max_value;
int frame_width;
int frame_height;
int preserve_aspect;
if( result ) return;
BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
const char *path = gui->get_submitted_path();
- char txt[BCSTRLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
+ char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
window->lock_window("TitlePngPopup::handle_done_event");
window->insert_ibeam(txt);
window->unlock_window();
https://www.dechifro.org/dcraw/dcraw.c
http://download-mirror.savannah.gnu.org/releases//openexr/ilmbase-2.2.1.tar.gz
http://gnu.mirrors.pair.com/savannah/savannah//openexr/openexr-2.2.1.tar.gz
-https://sourceforge.net/projects/opencvlibrary/files/latest/download?source=directory = 3.2.0
+https://sourceforge.net/projects/opencvlibrary/files/
+https://github.com/opencv/opencv_contrib/archive/
#https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.2.0.tar.gz/download
http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz
https://ieee1394.wiki.kernel.org/index.php/Libraries
https://bitbucket.org/multicoreware/x265/downloads/x265_3.2.1.tar.gz
https://ffmpeg.org/releases/ffmpeg-4.2.tar.bz2
https://github.com/webmproject/libvpx/archive/v1.8.1.tar.gz
-https://code.videolan.org/videolan/dav1d/-/archive/0.6.0/dav1d-0.6.0.tar.gz
+https://code.videolan.org/videolan/dav1d/-/archive/0.5.1/dav1d-0.5.1.tar.gz
https://github.com/swh/ladspa/releases/tag/v0.4.17, plugin.org.uk
https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
https://github.com/webmproject/libwebp = libwebp-1.1.0