summaryrefslogtreecommitdiff
path: root/camlibs/sq905/sq905.c
diff options
context:
space:
mode:
Diffstat (limited to 'camlibs/sq905/sq905.c')
-rw-r--r--camlibs/sq905/sq905.c40
1 files changed, 17 insertions, 23 deletions
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;
}