binned fix

This commit is contained in:
2026-11-11 09:52:21 +03:00
parent 4192fc7f02
commit f6d2fd2e45
8 changed files with 18 additions and 12 deletions

View File

@@ -46,7 +46,7 @@ static double expt[2] = {0.}; // min/max exposition time
static double exptime = 0.; // actual exposition time static double exptime = 0.; // actual exposition time
static double tstart = 0.; // exposure start time static double tstart = 0.; // exposure start time
static char whynot[BUFSIZ]; // temporary buffer for error messages static char whynot[BUFSIZ]; // temporary buffer for error messages
static int imW = 0, imH = 0; // size of output image static int imW = 0, imH = 0; // size of output image (BINNED!)
static int pid = -1, vid = -1; static int pid = -1, vid = -1;
static int isexposuring = 0; static int isexposuring = 0;
@@ -224,8 +224,8 @@ static int setgeometry(cc_frameformat *f){
if(ApnGlueSetExpGeom(f->w, f->h, ow, 0, hbin, vbin, if(ApnGlueSetExpGeom(f->w, f->h, ow, 0, hbin, vbin,
f->xoff, f->yoff, &imW, &imH, whynot)){ f->xoff, f->yoff, &imW, &imH, whynot)){
WARNX("Can't set geometry: %s", whynot); WARNX("Can't set geometry: %s", whynot);
imW = f->w; imW = f->w / hbin;
imH = f->h; imH = f->h / vbin;
}else{ }else{
camera.geometry = *f; camera.geometry = *f;
} }

View File

@@ -345,7 +345,8 @@ static int pollcapt(cc_capture_status *st, float *remain){
static int capture(cc_IMG *ima){ static int capture(cc_IMG *ima){
FNAME(); FNAME();
//double __t0 = dtime(); //double __t0 = dtime();
if(!ima || !ima->data || !imgBuf || !isopened || !cc_fiximage(bitdepth, camera.geometry.w, camera.geometry.h, ima)) return FALSE; if(!ima || !ima->data || !imgBuf || !isopened ||
!cc_fiximage(bitdepth, camera.geometry.w / curhbin, camera.geometry.h / curvbin, ima)) return FALSE;
static int toohot = FALSE; static int toohot = FALSE;
float_values f; float_values f;
//TIMESTAMP("start capt"); //TIMESTAMP("start capt");

View File

@@ -168,7 +168,7 @@ add_custom_command(
DEPENDS ru_file_updated DEPENDS ru_file_updated
) )
add_custom_command( add_custom_target(
OUTPUT ru_file_updated OUTPUT ru_file_updated
COMMAND [ -f ${RU_FILE} ] && ${GETTEXT_MSGMERGE_EXECUTABLE} -Uis ${RU_FILE} ${PO_FILE} || cp ${PO_FILE} ${RU_FILE} COMMAND [ -f ${RU_FILE} ] && ${GETTEXT_MSGMERGE_EXECUTABLE} -Uis ${RU_FILE} ${PO_FILE} || cp ${PO_FILE} ${RU_FILE}
COMMAND ${CMAKE_COMMAND} -E touch ru_file_updated COMMAND ${CMAKE_COMMAND} -E touch ru_file_updated
@@ -176,3 +176,5 @@ add_custom_command(
) )
add_custom_target(MO_FILE ALL DEPENDS ${MO_FILE}) add_custom_target(MO_FILE ALL DEPENDS ${MO_FILE})
add_dependencies(${PROJ} MO_FILE)
install(FILES ${MO_FILE} DESTINATION "${LOCALEDIR}/ru/LC_MESSAGES")

View File

@@ -71,7 +71,8 @@ static int startexp(){
static int camcapt(cc_IMG *ima){ static int camcapt(cc_IMG *ima){
static int n = 0; static int n = 0;
if(!ima || !ima->data || !cc_fiximage(bitpix, camera.geometry.w, camera.geometry.h, ima)) return FALSE; if(!ima || !ima->data ||
!cc_fiximage(bitpix, camera.geometry.w / curhbin, camera.geometry.h / curvbin, ima)) return FALSE;
#ifdef EBUG #ifdef EBUG
double t0 = sl_dtime(); double t0 = sl_dtime();
#endif #endif

View File

@@ -462,7 +462,8 @@ retn:
static int fli_capt(cc_IMG *ima){ static int fli_capt(cc_IMG *ima){
int bitpix = is16bit ? 16 : 8; int bitpix = is16bit ? 16 : 8;
if(!ima || !ima->data || !cc_fiximage(bitpix, camera.geometry.w, camera.geometry.h, ima)) return FALSE; if(!ima || !ima->data ||
!cc_fiximage(bitpix, camera.geometry.w / curhbin, camera.geometry.h / curvbin, ima)) return FALSE;
for(int row = 0; row < ima->h; row++){ for(int row = 0; row < ima->h; row++){
void *ptr = NULL; void *ptr = NULL;
if(is16bit) ptr = (void*)(((uint16_t*)ima->data) + row * ima->w); if(is16bit) ptr = (void*)(((uint16_t*)ima->data) + row * ima->w);

View File

@@ -313,17 +313,18 @@ static int startexp(){
static int camcapt(cc_IMG *ima){ static int camcapt(cc_IMG *ima){
TCHECK(); TCHECK();
int bitpix = toupcam.bytepix * 8; int bitpix = toupcam.bytepix * 8;
if(!ima || !ima->data || !toupcam.data || !cc_fiximage(bitpix, camera.geometry.w, camera.geometry.h, ima)) return FALSE; int realw = camera.geometry.w / toupcam.curbin, realh = camera.geometry.h / toupcam.curbin;
if(!ima || !ima->data || !toupcam.data || !cc_fiximage(bitpix, realw, realh, ima)) return FALSE;
//DBG("LOCK"); //DBG("LOCK");
pthread_mutex_lock(&toupcam.mutex); pthread_mutex_lock(&toupcam.mutex);
size_t fullsz = ima->w * ima->h * toupcam.bytepix; size_t fullsz = ima->w * ima->h * toupcam.bytepix;
if(toupcam.imsz != fullsz){ if(toupcam.imsz != fullsz){
if(toupcam.imsz < fullsz) fullsz = toupcam.imsz; if(toupcam.imsz < fullsz) fullsz = toupcam.imsz;
int realw = camera.geometry.w / toupcam.curbin;
if(ima->w != realw) ima->w = realw; if(ima->w != realw) ima->w = realw;
ima->h = fullsz / realw / toupcam.bytepix; ima->h = fullsz / realw / toupcam.bytepix;
WARNX("Asked image size (%zd) not equal real (%zd); set w=%d, h=%d!", WARNX("Asked image size (%zd) not equal real (%zd); set w=%d, h=%d!",
ima->w * ima->h * toupcam.bytepix, toupcam.imsz, ima->w, ima->h); ima->w * ima->h * toupcam.bytepix, toupcam.imsz, ima->w, ima->h);
ima->bytelen = fullsz;
} }
memcpy(ima->data, toupcam.data, fullsz); memcpy(ima->data, toupcam.data, fullsz);
toupcam.lastcapno = toupcam.imseqno; toupcam.lastcapno = toupcam.imseqno;

Binary file not shown.

View File

@@ -235,7 +235,7 @@ msgstr "
#: main.c:129 #: main.c:129
msgid "Can't run in client and server modes simultaneously" msgid "Can't run in client and server modes simultaneously"
msgstr "" msgstr "îÅ ÍÏÇÕ ÏÄÎÏ×ÒÅÍÅÎÎÏ ÚÁÐÕÓÔÉÔØ ËÌÉÅÎÔ É ÓÅÒ×ÅÒ"
#: ccdfunc.c:684 #: ccdfunc.c:684
#, c-format #, c-format
@@ -499,12 +499,12 @@ msgstr "
#: cmdlnopts.c:123 #: cmdlnopts.c:123
msgid "INET command socket port (omit if use on same host with server)" msgid "INET command socket port (omit if use on same host with server)"
msgstr "" msgstr "ÐÏÒÔ ËÏÍÁÎÄÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ"
#: cmdlnopts.c:124 #: cmdlnopts.c:124
#, fuzzy #, fuzzy
msgid "INET image socket port (default: port+1)" msgid "INET image socket port (default: port+1)"
msgstr "ÐÏÒÔ ÌÏËÁÌØÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ ÐÅÒÅÄÁÞÉ ÉÚÏÂÒÁÖÅÎÉÑ" msgstr "ÐÏÒÔ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ ÐÅÒÅÄÁÞÉ ÉÚÏÂÒÁÖÅÎÉÑ"
#: ccdfunc.c:90 #: ccdfunc.c:90
msgid "Image not saved: neither filename nor filename prefix pointed" msgid "Image not saved: neither filename nor filename prefix pointed"