@@ -2942,44 +2942,64 @@ static int demosaic_qual_flags(const dt_dev_pixelpipe_iop_t *const piece,
29422942
29432943#include "dual_demosaic.c"
29442944
2945- void process_pixelshift (dt_dev_pixelpipe_iop_t * piece , const float * const i , float * const o , const dt_iop_roi_t * const roi_in ,
2945+ void process_pixelshift (dt_dev_pixelpipe_iop_t * piece , const float * const in , float * const out , const dt_iop_roi_t * const roi_in ,
29462946 const dt_iop_roi_t * const roi_out )
29472947{
2948+ assert (roi_in -> width >= roi_out -> width );
2949+ assert (roi_in -> height >= roi_out -> height );
29482950 float const * frames_in [4 ];
29492951 for (int f = 0 ; f < 4 ; ++ f )
29502952 {
29512953 /// TODO need original size here
2952- frames_in [f ] = i + (f * roi_in -> width * roi_in -> height );
2954+ frames_in [f ] = in + (f * piece -> buf_in . width * piece -> buf_in . height );
29532955 }
29542956
29552957 if (piece -> dsc_out .channels != 4 )
29562958 {
29572959 fprintf (stderr , "unsuported number of output channels, got: %i\n" , piece -> dsc_out .channels );
29582960 }
29592961
2960- fprintf (stderr , "demosaic enabled\n" );
2962+ fprintf (stderr , "pixelshift enabled, pipe type: %s \n" , dt_pixelpipe_name ( piece -> pipe -> type ) );
29612963 fprintf (stderr , "roi in %d %d %d %d\n" , roi_in -> x , roi_in -> y , roi_in -> width , roi_in -> height );
29622964 fprintf (stderr , "roi out %d %d %d %d\n" , roi_out -> x , roi_out -> y , roi_out -> width , roi_out -> height );
29632965
2964- //const size_t row_offset = roi_out->height;
2966+ const size_t ox = roi_in -> x ;
2967+ const size_t oy = roi_in -> y ;
29652968
2966- for (size_t idx = 0 ; idx < roi_out -> width * roi_out -> height * piece -> dsc_out .channels ;
2967- idx += piece -> dsc_out .channels )
2969+
2970+ size_t pout = 0 ;
2971+ size_t pin = 0 ;
2972+ for (size_t j = 0 ; j < roi_out -> height ; j ++ )
29682973 {
2969- // R
2970- o [idx + 0 ] = frames_in [0 ][idx /piece -> dsc_out .channels ];
2971- // G
2972- o [idx + 1 ] = frames_in [1 ][idx /piece -> dsc_out .channels ];
2973- o [idx + 1 ] += frames_in [2 ][idx /piece -> dsc_out .channels ];
2974- o [idx + 1 ] /= 2.0 ;
2975- // B
2976- o [idx + 2 ] = frames_in [3 ][idx /piece -> dsc_out .channels ];
2977- /*for(size_t c = 0; c < 3; ++c)
2974+ for (size_t i = 0 ; i < roi_out -> width ; i ++ )
29782975 {
2979- o[idx + c] = i[idx / piece->dsc_out.channels];
2980- }*/
2981- }
2976+ pout = 4 * ((roi_out -> width * j ) + i );
2977+ pin = (roi_in -> width * (j + oy )) + ox + i ;
2978+
2979+ for (size_t c = 0 ;c < 3 ;++ c )
2980+ {
2981+ out [pout + c ] = (frames_in [0 ])[pin ];
2982+ }
2983+
2984+ out [pout + 0 ] = (float ) j / (float ) roi_out -> height ;
2985+ out [pout + 1 ] = (float ) i / (float ) roi_out -> width ;
2986+ out [pout + 2 ] = 0.0f ;
2987+ out [pout + 3 ] = 0.0f ;
29822988
2989+
2990+
2991+ //out[pout + 0] = frames_in[0][pin];
2992+
2993+ /*out[pout + 1] = (frames_in[0][pin] + frames_in[0][pin]) / 2.0f;
2994+
2995+ out[pout + 2] = frames_in[0][pin];*/
2996+
2997+ /*out[pout] = 1.0f;
2998+ out[pout+1] = 0.0f;
2999+ out[pout+2] = 0.0f;
3000+ out[pout+3] = 0.0f;*/
3001+ }
3002+ }
29833003}
29843004
29853005
@@ -2992,9 +3012,9 @@ void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const
29923012
29933013 dt_dev_clear_rawdetail_mask (piece -> pipe );
29943014
2995- /* fprintf(stderr, "demosaic, %s\n", dt_pixelpipe_name(piece->pipe->type));
3015+ fprintf (stderr , "demosaic, %s\n" , dt_pixelpipe_name (piece -> pipe -> type ));
29963016 fprintf (stderr , "roi in %d %d %d %d\n" , roi_in -> x , roi_in -> y , roi_in -> width , roi_in -> height );
2997- fprintf(stderr, "roi out %d %d %d %d\n", roi_out->x, roi_out->y, roi_out->width, roi_out->height);*/
3017+ fprintf (stderr , "roi out %d %d %d %d\n" , roi_out -> x , roi_out -> y , roi_out -> width , roi_out -> height );
29983018 dt_iop_roi_t roi = * roi_in ;
29993019 dt_iop_roi_t roo = * roi_out ;
30003020 roo .x = roo .y = 0 ;
@@ -3046,6 +3066,7 @@ void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const
30463066 roo .height = roi_in -> height ;
30473067 roo .scale = 1.0f ;
30483068 tmp = (float * )dt_alloc_align_float ((size_t )4 * roo .width * roo .height );
3069+ fprintf (stderr ,"scaled\n" );
30493070 }
30503071 if (info ) dt_get_times (& start_time );
30513072
0 commit comments