Added options to render only a part of the image.

The following options were added:
 - strip - specifies the strip to be rendered, from 1 to nstrips
 - minstrip - the bottom part of strip range to be rendered.
 - maxstrip - the top part of the strip range to be rendered.
This commit is contained in:
Jancsi Farkas 2016-01-07 00:09:10 +02:00
parent e080154353
commit 89226a7640
2 changed files with 30 additions and 1 deletions

View File

@ -62,6 +62,9 @@ static char *the_docstring1 =
"dtime 1 time between frames (animate only)\n"
"fields 0 if 1 then render fields, ie odd scanlines at time+0.5\n"
"nstrips 1 number of strips, ie render fractions of a frame at once (render only)\n"
"strip NA the strip number to be rendered.\n"
"minstrip NA minimum strip number to be rendered. Using this allows rendering only strips between minstrip and maxstrip.\n"
"maxstrip NA maximum strip number to be rendered. Using this allows rendering only strips between minstrip and maxstrip.\n"
"qs 1 quality scale, multiply quality of all frames by this\n"
"ss 1 size scale, multiply size (in pixels) of all frames by this\n"
"jpeg NA jpeg quality for compression, default is native jpeg default\n"

View File

@ -117,6 +117,7 @@ int main(int argc, char **argv) {
size_t this_size, last_size = -1;
double imgmem;
unsigned int strip;
int strip_to_render = argi("strip", -1);
double center_y, center_base;
unsigned int nstrips = 1;
randctx savectx;
@ -135,6 +136,8 @@ int main(int argc, char **argv) {
int name_enable = argi("name_enable",0);
int num_threads = argi("nthreads",0);
int earlyclip = argi("earlyclip",0);
int minstrip = argi("minstrip", -1);
int maxstrip = argi("maxstrip", -1);
FILE *in;
double zoom_scale;
unsigned int channels;
@ -319,7 +322,30 @@ int main(int argc, char **argv) {
/* Copy off random context to use for each strip */
memcpy(&savectx, &f.rc, sizeof(randctx));
for (strip = 0; strip < nstrips; strip++) {
if (minstrip < 1) {
minstrip = 1;
}
if (maxstrip < 0) {
maxstrip = nstrips;
}
// Only one strip is specified to be rendered, change minstrip and maxstrip accordingly
if (strip_to_render > 0 ) {
if (strip_to_render <= nstrips) {
minstrip = strip_to_render;
maxstrip = strip_to_render;
} else {
fprintf(stderr, "Te strip requested to be rendered %d %d is beyond the number of strips. Setting it to last strip\n", strip_to_render, nstrips - 1);
minstrip = nstrips;
maxstrip = nstrips;
}
}
for (strip = minstrip-1; strip < maxstrip; strip++) {
size_t ssoff = (size_t)cps[i].height * strip * cps[i].width * channels * f.bytes_per_channel;
void *strip_start = image + ssoff;
cps[i].center[1] = center_base + cps[i].height * (double) strip / (cps[i].pixels_per_unit * zoom_scale);