Skip to content

Commit 673305f

Browse files
committed
there is some systematic error, htat i cannot see
1 parent e32400a commit 673305f

File tree

5 files changed

+24
-41
lines changed

5 files changed

+24
-41
lines changed

src/common/imageio_rawspeed.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ dt_imageio_retval_t dt_imageio_open_rawspeed(dt_image_t *img, const char *filena
515515
const size_t bufSize_mipmap = (size_t)img->width * img->height * img->buf_dsc.frames * r.get(0)->getBpp();
516516
const size_t bufSize_rawspeed = (size_t)r.get(0)->pitch * dimUncropped.y * r.size();
517517
const size_t frame_size = bufSize_mipmap / r.size();
518-
printf("size mipmap: %lu\n size raw: %lu\nsize frame: %lu\n",bufSize_mipmap,bufSize_rawspeed,frame_size);
518+
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
{
521521
dt_imageio_flip_buffers(((char *)buf) + (i * frame_size), (char *)r.get(i)->getDataUncropped(0, 0),

src/develop/pixelpipe_hb.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <unistd.h>
4444
#include <errno.h>
4545

46-
//#define DEBUG_PIXELPIPE
46+
#define DEBUG_PIXELPIPE
4747

4848
typedef enum dt_pixelpipe_flow_t
4949
{
@@ -112,6 +112,11 @@ 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)
116+
{
117+
return;
118+
}*/
119+
115120
char filename[128];
116121
snprintf(filename, 128, "save_debug_bitmap_%s_%s.pfm", name, _pipe_type_to_str(pipe->type));
117122
for(int i = 0; i < 128; ++i)
@@ -1227,6 +1232,7 @@ static int dt_dev_pixelpipe_process_rec(dt_dev_pixelpipe_t *pipe, dt_develop_t *
12271232
const int in_y = MAX(roi_in.y, 0);
12281233
const int cp_width = MAX(0, MIN(roi_out->width, pipe->iwidth - in_x));
12291234
const int cp_height = MIN(roi_out->height, pipe->iheight - in_y);
1235+
const int frames = pipe->dsc.frames;
12301236

12311237
if (cp_width > 0)
12321238
{
@@ -1236,7 +1242,7 @@ static int dt_dev_pixelpipe_process_rec(dt_dev_pixelpipe_t *pipe, dt_develop_t *
12361242
shared(pipe, roi_out, roi_in, output) \
12371243
schedule(static)
12381244
#endif
1239-
for(int j = 0; j < cp_height; j++)
1245+
for(int j = 0; j < cp_height * frames; j++)
12401246
memcpy(((char *)*output) + (size_t)bpp * j * roi_out->width,
12411247
((char *)pipe->input) + (size_t)bpp * (in_x + (in_y + j) * pipe->iwidth),
12421248
(size_t)bpp * cp_width);

src/iop/demosaic.c

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,57 +2963,34 @@ void process_pixelshift(dt_dev_pixelpipe_iop_t *piece, const float *const in, fl
29632963
fprintf(stderr, "roi in %d %d %d %d\n", roi_in->x, roi_in->y, roi_in->width, roi_in->height);
29642964
fprintf(stderr, "roi out %d %d %d %d\n", roi_out->x, roi_out->y, roi_out->width, roi_out->height);
29652965

2966-
const size_t ox = roi_in->x;
2967-
const size_t oy = roi_in->y;
2966+
/*__asan_describe_address((void*)in);
2967+
fflush(stdout);
2968+
fflush(stderr);*/
29682969

2970+
//const size_t ox = roi_in->x;
2971+
//const size_t oy = roi_in->y;
29692972

29702973
size_t pout = 0;
2971-
size_t pin = 0;
2974+
//size_t pin = 0;
2975+
size_t pin3 = 0;
29722976
for(size_t j = 0; j < roi_out->height; j++)
29732977
{
29742978
for(size_t i = 0; i < roi_out->width; i++)
29752979
{
2976-
pout = (size_t)4 * ((roi_out->width * j) + i);
2977-
pin = (roi_in->width * (j + oy)) + ox + i;
2980+
pout = (size_t)4 * (((size_t)roi_out->width * j) + i);
2981+
//pin = (roi_in->width * (j + oy)) + ox + i;
2982+
///TODO why do i ignore offset of input roi?
2983+
pin3 = (roi_in->width * j) + i;
29782984

2979-
if(pin >= 24000000)
2980-
{
2981-
fprintf(stderr,"input overflow\n");
2982-
}
2983-
2984-
if(pin >= 24000000)
2985-
{
2986-
fprintf(stderr,"input overflow\n");
2987-
}
2988-
2989-
if(pout >= ((size_t)4*roi_out->height*roi_out->width))
2985+
if(pout+3 >= ((size_t)4*((size_t)roi_out->height*roi_out->width)))
29902986
{
29912987
fprintf(stderr,"output overflow\n");
29922988
}
29932989

29942990
for(size_t c=0;c<3;++c)
29952991
{
2996-
out[pout+c] = (frames_in[0])[pin];
2997-
//out[pout+c] = (float) pin / ((float) roi_out->height * roi_out->width);
2992+
out[pout+c] = (frames_in[1])[pin3];
29982993
}
2999-
3000-
/*out[pout + 0] = (float) j / (float) roi_out->height;
3001-
out[pout + 1] = (float) i / (float) roi_out->width;
3002-
out[pout + 2] = 0.0f;
3003-
out[pout + 3] = 0.0f;*/
3004-
3005-
3006-
3007-
//out[pout + 0] = frames_in[0][pin];
3008-
3009-
/*out[pout + 1] = (frames_in[0][pin] + frames_in[0][pin]) / 2.0f;
3010-
3011-
out[pout + 2] = frames_in[0][pin];*/
3012-
3013-
/*out[pout] = 1.0f;
3014-
out[pout+1] = 0.0f;
3015-
out[pout+2] = 0.0f;
3016-
out[pout+3] = 0.0f;*/
30172994
}
30182995
}
30192996
fprintf(stderr,"pout: %lu\n", pout+4);

src/iop/rawprepare.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ static void convert_uint_float(const uint16_t *const in, float *const out, const
284284

285285
const int id = BL(roi_out, d, j, i);
286286
out[pout] = (in[pin] - d->sub[id]) / d->div[id];
287-
//out[pout] = ((j/10)%2)?1.0f:0.0f;
288287
}
289288
}
290289
}
@@ -344,6 +343,7 @@ void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const
344343
{
345344
const dt_iop_rawprepare_data_t *const d = (dt_iop_rawprepare_data_t *)piece->data;
346345

346+
//fprintf(stderr,"rawprepare %s\n", dt_pixelpipe_name(piece->pipe->type));
347347
/*fprintf(stderr, "roi in %d %d %d %d\n", roi_in->x, roi_in->y, roi_in->width, roi_in->height);
348348
fprintf(stderr, "roi out %d %d %d %d\n", roi_out->x, roi_out->y, roi_out->width, roi_out->height);
349349
fprintf(stderr,"frame size in: %d\n", roi_in->width * roi_in->height);

0 commit comments

Comments
 (0)