Skip to content

Commit e8c873d

Browse files
committed
looks like issue with frame offset input to rawprepare
1 parent ae2213b commit e8c873d

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

src/common/imageio_rawspeed.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ dt_imageio_retval_t dt_imageio_open_rawspeed(dt_image_t *img, const char *filena
518518
fprintf(stderr,"[rawspeed] size mipmap: %lu, size raw: %lu, size frame: %lu\n",bufSize_mipmap,bufSize_rawspeed,frame_size);
519519
for(size_t i = 0; i < r.size(); ++i)
520520
{
521+
fprintf(stderr,"[rawspeed] frame %lu, %p\n",i, (void*)((char *)buf + (i*frame_size)));
521522
dt_imageio_flip_buffers(((char *)buf) + (i * frame_size), (char *)r.get(i)->getDataUncropped(0, 0),
522523
r.get(i)->getBpp(), dimUncropped.x, dimUncropped.y, dimUncropped.x, dimUncropped.y,
523524
r.get(i)->pitch, ORIENTATION_NONE);

src/develop/imageop.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ typedef struct dt_iop_roi_t
2828
{
2929
int x, y, width, height;
3030
float scale;
31-
int frame_offset;
3231
} dt_iop_roi_t;
3332

3433
#include "common/darktable.h"

src/develop/pixelpipe_hb.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ static char *_pipe_type_to_str(int pipe_type)
112112
#ifdef DEBUG_PIXELPIPE
113113
static void save_debug_bitmap(dt_dev_pixelpipe_t *pipe, const char *name, void *out, const dt_iop_roi_t *roi_out)
114114
{
115-
/*if(pipe->type != DT_DEV_PIXELPIPE_FULL)
115+
if(pipe->type != DT_DEV_PIXELPIPE_FULL)
116116
{
117117
return;
118-
}*/
118+
}
119119

120120
char filename[128];
121121
snprintf(filename, 128, "save_debug_bitmap_%s_%s.pfm", name, _pipe_type_to_str(pipe->type));
@@ -150,7 +150,18 @@ static void save_debug_bitmap(dt_dev_pixelpipe_t *pipe, const char *name, void *
150150
float *ptr = (float *)out;
151151
if((pipe->dsc.channels == 1) || (pipe->dsc.channels == 3))
152152
{
153-
fwrite(ptr, sizeof(float), roi_out->height * roi_out->width * pipe->dsc.channels * pipe->dsc.frames, file);
153+
for(size_t f = 0; f < pipe->dsc.frames; ++f)
154+
{
155+
float *tmp = ptr + (f * roi_out->width * roi_out->height);
156+
for(size_t i = 0; i < roi_out->width; ++i)
157+
{
158+
for(size_t j = 0; j < roi_out->height; ++j)
159+
{
160+
const size_t pout = j + (roi_out->height * (i));
161+
fwrite(tmp + pout, sizeof(float) * pipe->dsc.channels, 1, file);
162+
}
163+
}
164+
}
154165
}
155166
else
156167
{

src/iop/demosaic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2951,6 +2951,7 @@ void process_pixelshift(dt_dev_pixelpipe_iop_t *piece, const float *const in, fl
29512951
for(int f = 0; f < 4; ++f)
29522952
{
29532953
frames_in[f] = in + (f * roi_in->width * roi_in->height);
2954+
fprintf(stderr, "frame %i: %p\n", f, frames_in[f]);
29542955
}
29552956

29562957
if(piece->dsc_out.channels != 4)
@@ -2990,7 +2991,7 @@ void process_pixelshift(dt_dev_pixelpipe_iop_t *piece, const float *const in, fl
29902991

29912992
for(size_t c=0;c<3;++c)
29922993
{
2993-
out[pout+c] = (frames_in[0])[pin3];
2994+
out[pout+c] = (frames_in[2])[pin3];
29942995
}
29952996
}
29962997
}

src/iop/rawprepare.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,6 @@ void modify_roi_out(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, dt_iop
212212
const float scale = roi_in->scale / piece->iscale;
213213
roi_out->width -= (int)roundf((float)x * scale);
214214
roi_out->height -= (int)roundf((float)y * scale);
215-
216-
if(piece->pipe->type & (DT_DEV_PIXELPIPE_FULL | DT_DEV_PIXELPIPE_EXPORT))
217-
{
218-
if(piece->pipe->image.buf_dsc.frames > 1)
219-
{
220-
roi_out->frame_offset = roi_out->width * roi_out->height;
221-
}
222-
}
223215
}
224216

225217
void modify_roi_in(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_out,
@@ -283,7 +275,7 @@ static void convert_uint_float(const uint16_t *const in, float *const out, const
283275
dt_omp_firstprivate(csx, csy, d, in, out, roi_in, roi_out) \
284276
schedule(static) collapse(2)
285277
#endif
286-
for(int j = 0; j < roi_out->height; j++)
278+
for(int j = 0; j < roi_out->height-100; j++)
287279
{
288280
for(int i = 0; i < roi_out->width; i++)
289281
{
@@ -294,6 +286,18 @@ static void convert_uint_float(const uint16_t *const in, float *const out, const
294286
out[pout] = (in[pin] - d->sub[id]) / d->div[id];
295287
}
296288
}
289+
290+
for(int j = roi_out->height-100; j < roi_out->height; j++)
291+
{
292+
for(int i = 0; i < roi_out->width; i++)
293+
{
294+
//const size_t pin = (size_t)(roi_in->width * (j + csy) + csx) + i;
295+
const size_t pout = (size_t)j * roi_out->width + i;
296+
297+
298+
out[pout] = 0.0f;
299+
}
300+
}
297301
}
298302

299303
static void convert_float_float(const float *const in, float *const out, const dt_iop_roi_t *const roi_in,
@@ -374,6 +378,11 @@ void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const
374378
const uint16_t *const frame_in = in + (f * roi_in->width * roi_in->height);
375379
float *const frame_out = out + (f * roi_out->width * roi_out->height);
376380
convert_uint_float(frame_in, frame_out, roi_in, roi_out, csx, csy, d);
381+
fprintf(stderr, "frame %lu: %p\n", f, frame_in);
382+
/*for(size_t i=0;i<roi_out->width * roi_out->height;++i)
383+
{
384+
frame_out[i] = (float)f / (float)piece->dsc_out.frames;
385+
}*/
377386
}
378387

379388
piece->pipe->dsc.filters = dt_rawspeed_crop_dcraw_filters(self->dev->image_storage.buf_dsc.filters, csx, csy);

0 commit comments

Comments
 (0)