summaryrefslogtreecommitdiff
path: root/camlibs/sq905
diff options
context:
space:
mode:
authorTheodore Kilgore <kilgota@auburn.edu>2005-07-11 19:34:19 +0000
committerTheodore Kilgore <kilgota@auburn.edu>2005-07-11 19:34:19 +0000
commit8840e94544f8ff93de2df07602cf22ed05ca930f (patch)
treeaafe553344109a7a90b01ef6b81afef4e82298c7 /camlibs/sq905
parentdf075b40edf523d6c6b26ee75ec925885095bb47 (diff)
downloadlibgphoto2-8840e94544f8ff93de2df07602cf22ed05ca930f.tar.gz
* 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
Diffstat (limited to 'camlibs/sq905')
-rw-r--r--camlibs/sq905/ChangeLog9
-rw-r--r--camlibs/sq905/library.c5
-rw-r--r--camlibs/sq905/postprocess.c1
-rw-r--r--camlibs/sq905/sq905.c40
4 files changed, 30 insertions, 25 deletions
diff --git a/camlibs/sq905/ChangeLog b/camlibs/sq905/ChangeLog
index a9e4ef124..97822f4ed 100644
--- a/camlibs/sq905/ChangeLog
+++ b/camlibs/sq905/ChangeLog
@@ -1,5 +1,14 @@
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.
diff --git a/camlibs/sq905/library.c b/camlibs/sq905/library.c
index 1975de39c..6e8a3af15 100644
--- a/camlibs/sq905/library.c
+++ b/camlibs/sq905/library.c
@@ -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);
diff --git a/camlibs/sq905/postprocess.c b/camlibs/sq905/postprocess.c
index 1a68b1474..61faf1ac5 100644
--- a/camlibs/sq905/postprocess.c
+++ b/camlibs/sq905/postprocess.c
@@ -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++) {
diff --git a/camlibs/sq905/sq905.c b/camlibs/sq905/sq905.c
index 04e6391cc..85eee38f8 100644
--- a/camlibs/sq905/sq905.c
+++ b/camlibs/sq905/sq905.c
@@ -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;
}