Skip to content

Commit ed04992

Browse files
committed
cleanup ms import
1 parent 5c34c87 commit ed04992

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

encode.avs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ resized = hd || ARCorrection \
188188

189189
# If ms enabled, we use parameters of "resized" to apply to all segments
190190
if (ms) {
191-
resized = resized.AppendSegment(msBase, msStart, msEnd, msFormat, resizer, hd, pixelType).ConvertToRGB32()
191+
resized = resized \
192+
.AppendSegment(msBase, msStart, msEnd, msFormat, resizer, hd, pixelType) \
193+
.ConvertToRGB32()
192194

193195
if (msAudio) {
194196
resized = AudioDub(resized, WavSource(msAudiotrack))

programs/functions.avsi

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,24 @@ function AppendSegment(
99
\ bool hd,
1010
\ string pix_type
1111
\){
12-
filename = base + string(first_val, format) + ".avi"
13-
result = AviSource(filename, pixel_type=pix_type)
14-
15-
if (hd) {
16-
result = result.Eval(resizer + """Resize(sample.width, sample.height)""")
17-
} else {
18-
scaler = float(sample.height) / float(result.height)
19-
temp_width = float(result.width) * scaler
20-
result = result.PointResize(int(temp_width), sample.height)
21-
result = result.Lanczos4Resize(sample.width, sample.height)
22-
}
23-
24-
for (i = first_val + 1, last_val) {
12+
for (i = first_val, last_val) {
2513
filename = base + string(i, format) + ".avi"
26-
next_clip = AviSource(filename, pixel_type=pix_type)
14+
AviSource(filename, pixel_type=pix_type)
2715

2816
if (hd) {
29-
next_clip = next_clip.Eval(resizer + """Resize(sample.width, sample.height)""")
17+
Eval(resizer + """Resize(sample.width, sample.height)""")
3018
} else {
31-
scaler = float(sample.height) / float(next_clip.height)
32-
temp_width = float(next_clip.width) * scaler
33-
next_clip = next_clip.PointResize(int(temp_width), sample.height)
34-
next_clip = next_clip.Lanczos4Resize(sample.width, sample.height)
19+
scaler = float(sample.height) / float(last.height)
20+
temp_width = float(last.width) * scaler
21+
PointResize(int(temp_width), sample.height)
22+
Lanczos4Resize(sample.width, sample.height)
3523
}
3624

37-
result = result + next_clip
25+
if (i == first_val) {
26+
result = last
27+
} else {
28+
result = result + last
29+
}
3830
}
3931

4032
return result

0 commit comments

Comments
 (0)