LiVES
3.2.0
|
Go to the source code of this file.
Data Structures | |
struct | _resaudw |
resample audio window More... | |
Macros | |
#define | RESIZE_ALL_NEEDS_CONVERT 0 |
#define | LETTERBOX_NEEDS_COMPOSITE 1 |
#define | LETTERBOX_NEEDS_CONVERT 1 |
#define | SKJUMP_THRESH_RATIO 1.025 |
#define | SKJUMP_THRESH_SECS 0.25 |
Functions | |
ticks_t | q_gint64 (ticks_t in, double fps) |
ticks_t | q_gint64_floor (ticks_t in, double fps) |
ticks_t | q_dbl (double in, double fps) |
void | reorder_leave_back_set (boolean val) |
size_t | quant_asamps (double seek, int arate) |
convert seek time to an integer number of samples More... | |
double | quant_aseek (double seek, int arate) |
convert seek time (secs) to an (almost) integer number of samples More... | |
off_t | quant_abytes (double seek, int arate, int achans, int asampsize) |
weed_plant_t * | quantise_events (weed_plant_t *in_list, double new_fps, boolean allow_gap) WARN_UNUSED |
quantise frame events for a single clip More... | |
int | count_resampled_frames (int in_frames, double orig_fps, double resampled_fps) |
_resaudw * | create_resaudw (short type, render_details *, LiVESWidget *top_vbox) |
resample audio window More... | |
void | on_change_speed_activate (LiVESMenuItem *, livespointer) |
void | on_change_speed_ok_clicked (LiVESButton *, livespointer) |
boolean | auto_resample_resize (int width, int height, double fps, int fps_num, int fps_denom, int arate, int asigned, boolean swap_endian) |
int | reorder_frames (int rwidth, int rheight) |
int | deorder_frames (int old_framecount, boolean leave_bak) |
leave_bak is a special mode for the clipboard More... | |
boolean | resample_clipboard (double new_fps) |
call this to resample clipboard video More... | |
Variables | |
_resaudw * | resaudw |
#define LETTERBOX_NEEDS_COMPOSITE 1 |
Definition at line 14 of file resample.h.
#define LETTERBOX_NEEDS_CONVERT 1 |
Definition at line 15 of file resample.h.
#define RESIZE_ALL_NEEDS_CONVERT 0 |
Definition at line 13 of file resample.h.
#define SKJUMP_THRESH_RATIO 1.025 |
Definition at line 50 of file resample.h.
#define SKJUMP_THRESH_SECS 0.25 |
Definition at line 51 of file resample.h.
boolean auto_resample_resize | ( | int | width, |
int | height, | ||
double | fps, | ||
int | fps_num, | ||
int | fps_denom, | ||
int | arate, | ||
int | asigned, | ||
boolean | swap_endian | ||
) |
Definition at line 80 of file resample.c.
int count_resampled_frames | ( | int | in_frames, |
double | orig_fps, | ||
double | resampled_fps | ||
) |
Definition at line 72 of file resample.c.
Referenced by resample_clipboard().
_resaudw* create_resaudw | ( | short | type, |
render_details * | , | ||
LiVESWidget * | top_vbox | ||
) |
resample audio window
type 1 : show current and new, type 2 : show new
Definition at line 1521 of file resample.c.
Referenced by on_capture_activate(), on_recaudclip_activate(), and on_resample_audio_activate().
int deorder_frames | ( | int | old_framecount, |
boolean | leave_bak | ||
) |
leave_bak is a special mode for the clipboard
Definition at line 2208 of file resample.c.
void on_change_speed_activate | ( | LiVESMenuItem * | , |
livespointer | |||
) |
Definition at line 2017 of file resample.c.
void on_change_speed_ok_clicked | ( | LiVESButton * | , |
livespointer | |||
) |
Definition at line 2025 of file resample.c.
Referenced by create_new_pb_speed(), and on_redo_activate().
ticks_t q_dbl | ( | double | in, |
double | fps | ||
) |
Definition at line 41 of file resample.c.
Referenced by add_blank_frames_up_to(), get_time_from_x(), mt_spin_end_value_changed(), and mt_spin_start_value_changed().
Definition at line 25 of file resample.c.
Referenced by add_blank_frames_up_to(), add_markers(), avel_spin_changed(), get_region_overlap(), insert_audio(), insert_frames(), mt_add_region_effect(), multitrack_audio_insert(), multitrack_insert(), multitrack_view_sel_events(), on_del_node_clicked(), on_effects_paused(), on_next_fm_clicked(), on_next_node_clicked(), on_node_spin_value_changed(), on_prev_fm_clicked(), on_prev_node_clicked(), on_set_pvals_clicked(), on_split_activate(), on_split_curr_activate(), render_events(), and virtual_to_images().
Definition at line 35 of file resample.c.
Referenced by calc_new_playback_position().
off_t quant_abytes | ( | double | seek, |
int | arate, | ||
int | achans, | ||
int | asampsize | ||
) |
Definition at line 66 of file resample.c.
size_t quant_asamps | ( | double | seek, |
int | arate | ||
) |
convert seek time to an integer number of samples
Definition at line 52 of file resample.c.
Referenced by quant_abytes(), and quant_aseek().
double quant_aseek | ( | double | seek, |
int | arate | ||
) |
convert seek time (secs) to an (almost) integer number of samples
Definition at line 58 of file resample.c.
weed_plant_t* quantise_events | ( | weed_plant_t * | in_list, |
double | qfps, | ||
boolean | allow_gap | ||
) |
quantise frame events for a single clip
quantise frame events for a single clip
This is called from 3 functions:
if old_list has no frames then we just return an empty list otherwise returned list will always have at least one event (a frame at timecode 0).
if there is a timecode gap at the start of the old_list (i.e frame 1 has a non-zero timecode) then this well be eliminated in the out iist; i.e. frame 1 in out_list always has a timecode of 0.
if the old event_list has a fixed fps, then we try to keep the duration as near as possible, so:
nframes_new = MAX(nframes_old / old_fps * new_fps , 1) the value is rounded DOWN in the case that qfps < old_fps and rounded to the nearest integer in the case that qfps > old_fps
e.g 210 frames @ 20.0 fps -> 157 frames @ 15.0 fps -> 410 frames @ 39.0 fps
i.e when the duration of the final frame is added, the total will always be >= duration of the old list
if old_list has no fixed fps, then new_frames = (timecode of last frame - timecode of first frame) * qfps rounded UP.
/ algorithm: / - get tc of 1st frame event in in_list / tc of out_list starts at zero. If allow_gap is FALSE we add an offset_tc / so out_list 0 coincides with tc of 1st frame in in_list. / loop: / - advance in_list until either we hit a frame event, or tc of NEXT event > out_tc / – if tc of next frame is <= out_tc, we continue / – update the state to current event / / - apply in_list state at out_tc, interpolating between last (current) in frame and next in frame / - advance out_tc by 1. / out_fps / - goto loop
/ inserting from scrap_file, we cannot interpolate frame numbers. So we just insert nearest frame
copy metadata; we will change PREV, NEXT and FPS
in pre-analysis, we will look at the audio frames, and instead of correcting the audio veloicity, we will attempt to slightly modify (scale) the frame timings such that the audio hits the precise seek point
in this mode we walk the event_list until we pass the output time, keeping track of state - frame and clip numbers, audio positions, param values, then insert everything at the output slot
values which we maintain: current init_events (cancelled by a deinit) current filter map (cancelled by a new filter_map) current deinits (cancelled by cancelling an init_event) current param changes (cancelled by another pchange for same fx / param or a deinit) audio seeks
events are added in the standard ordering, i.e filter_inits, param changes, filter map, frame, filter_deinits
update the state until we pass out_tc
now we have a choice: we can either insert this frame at out_tc with the current fx state, or with the state at out_tc the difference is: either we force insertion of this frame now, with the current filter state, or we wait until we pass the slot and insert with the filter inits at that time
force insertion by setting stop_tc to -1, thus all events will have a timecode
laud_tc is last frame in_tc, frame_event is last frame
if init_event is in list, discard it + this event
param changes just get inserted at whatever timcode, as long as their init_event isnt in the "to be added" list
replace current filter map
probably a marker; ignore
insert the state
INSERT A FRAME AT OUT_TC
interpolate frames if possible
now we insert the frame
insert the audio state
if there is still audio to be added, update the seek posn to out_tc laud_tc is last frame in_tc
the timecode of each audio frame is adjusted to the quantised time, and we update the seek position accordingly however, when playing back, any velocity change will come slightly later than when recorded; thus the player seek pos will be slightly off. To remedy this we can very slightly adjust the velocity at the prior frame, so that the seek is correct when arriving at the current audio frame
< audio was off, older lists didnt store the offset
find the prior audio frame for the track
what we will do here is insert an extra audio event at the previous out_frame. the seek will be calculated from old_val, and we will adjust the velocity so we hit the seek value at this frame adjust velocity by seek_delta / frame_duration
merge natracks with xatracks
frame insertion done
increase out_tc
end of the in_list
end of out_list
for completeness we should add closers for all active audio tracks, however this will be done in event_list_rectify() when necessary (or ideally, the player would add the closers and record the offsets)
Definition at line 456 of file resample.c.
Referenced by on_resample_vid_ok(), and render_to_clip().
int reorder_frames | ( | int | rwidth, |
int | rheight | ||
) |
Definition at line 2106 of file resample.c.
void reorder_leave_back_set | ( | boolean | val | ) |
Definition at line 21 of file resample.c.
Referenced by create_new_pb_speed().
boolean resample_clipboard | ( | double | new_fps | ) |
call this to resample clipboard video
Definition at line 2250 of file resample.c.
_resaudw* resaudw |
Definition at line 38 of file resample.h.
Referenced by apply_prefs(), create_resaudw(), mt_change_vals_activate(), multitrack(), on_capture_activate(), on_ins_silence_details_clicked(), on_multitrack_activate(), on_prefs_close_clicked(), on_rb_audrec_time_toggled(), on_recaudclip_activate(), on_recaudclip_ok_clicked(), on_resample_audio_activate(), on_resaudio_ok_clicked(), on_resaudw_asamps_changed(), and render_to_clip().