* library.c: Several improvements for SQ_MODEL_POCK_CAM

* postprocess.c: Several improvements for SQ_MODEL_POCK_CAM
        * sq905.c: Several improvements for SQ_MODEL_POCK_CAM, thanks to
        Julius Schwartzenberg <julius@zgod.cjb.net> for exhaustive testing!


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8174 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Theodore Kilgore
2005-07-11 19:34:19 +00:00
parent df075b40ed
commit 8840e94544
4 changed files with 30 additions and 25 deletions

View File

@@ -1,3 +1,12 @@
2005-05-18 Theodore Kilgore <kilgota@auburn.edu>
* library.c: Several improvements for SQ_MODEL_POCK_CAM
* postprocess.c: Several improvements for SQ_MODEL_POCK_CAM
* sq905.c: Several improvements for SQ_MODEL_POCK_CAM, thanks to
Julius Schwartzenberg <julius@zgod.cjb.net> for exhaustive testing!
2005-05-18 Theodore Kilgore <kilgota@auburn.edu>
* library.c: bug in compressed photo routine fixed, found by Cedric Cellier.

View File

@@ -250,6 +250,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
unsigned char gtable[256];
int size;
if (GP_FILE_TYPE_EXIF ==type) return GP_ERROR_FILE_EXISTS;
if (GP_FILE_TYPE_RAW!=type && GP_FILE_TYPE_NORMAL
!=type && GP_FILE_TYPE_PREVIEW!=type) {
@@ -320,7 +322,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
default: h = 288; break;
}
b = nb_frames * w * h / comp_ratio;
do_preprocess = 1;
if (camera->pl->last_fetched_data) break;
camera->pl->last_fetched_data = malloc (nb_frames*w*h);
@@ -331,7 +333,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
GP_DEBUG("Fetch entry %i\n", to_fetch);
sq_read_picture_data
(camera->port, camera->pl->last_fetched_data, b);
do_preprocess = 1;
camera->pl->last_fetched_entry = to_fetch;
} while (camera->pl->last_fetched_entry<entry);

View File

@@ -324,6 +324,7 @@ sq_decompress (SQModel model, unsigned char *output, unsigned char *data,
/* De-mirroring for some models */
switch(model) {
case(SQ_MODEL_MAGPIX):
case(SQ_MODEL_POCK_CAM):
for (m=0; m<h; m++){
for(i=0; i<w/2; i++){
for(j=0; j<3; j++) {

View File

@@ -250,36 +250,30 @@ sq_preprocess (SQModel model, int comp_ratio, unsigned char is_in_clip,
unsigned char temp;
b=w*h/comp_ratio;
switch (is_in_clip) {
case 0:
GP_DEBUG("Running sq_preprocess\n");
if (!is_in_clip) {
/* Turning the picture right-side up. */
for (i = 0; i < b/2; ++i) {
temp = data[i];
data[i] = data[b -1 -i];
data[b - 1 - i] = temp;
}
/* Some cameras need de-mirror-imaging, too. */
switch (model) {
case SQ_MODEL_POCK_CAM:
for (i = 0; i < h/comp_ratio; i++) {
for (m = 0 ; m < w/(2*comp_ratio*comp_ratio); m++) {
temp = data[w*i/(comp_ratio*comp_ratio) +m];
data[w*i/(comp_ratio*comp_ratio)]
= data[w*i/(comp_ratio*comp_ratio) +w -1 -m];
data[w*i/(comp_ratio*comp_ratio) +w -1 -m] = temp;
}
}
break;
default: ; /* If any other model, do nothing here. */
}
break;
case 1: break; /* Photos in a clip come to us correctly oriented */
default:
return GP_ERROR_NOT_SUPPORTED;
/* But clip frames are already right-side-up */
}
/*
* POCK_CAM needs de-mirror-imaging, too. But if a photo is
* compressed we de-mirror after decompression, so not here.
*/
if ((model == SQ_MODEL_POCK_CAM) && (comp_ratio == 1)) {
for (i = 0; i < h; i++) {
for (m = 0 ; m < w/2; m++) {
temp = data[w*i +m];
data[w*i + m] = data[w*i + w -1 -m];
data[w*i + w - 1 - m] = temp;
}
}
}
return GP_OK;
}