Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 291539 Details for
Bug 428600
Add GPS data support
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to add GPS support
d-dcraw-gps (text/plain), 5.90 KB, created by
Ulrich Drepper
on 2008-01-14 02:50:06 UTC
(
hide
)
Description:
Patch to add GPS support
Filename:
MIME Type:
Creator:
Ulrich Drepper
Created:
2008-01-14 02:50:06 UTC
Size:
5.90 KB
patch
obsolete
>--- dcraw.c-old 2008-01-13 18:09:44.000000000 -0800 >+++ dcraw.c 2008-01-13 18:25:51.000000000 -0800 >@@ -79,6 +79,15 @@ > typedef long long INT64; > typedef unsigned long long UINT64; > #endif >+#ifdef __GLIBC__ >+#define fread(p, s, n, f) fread_unlocked(p, s, n, f) >+#undef putc >+#define putc(c, f) putc_unlocked(c, f) >+#define fputc(c, f) fputc_unlocked(c, f) >+#define fgets(s, n, f) fgets_unlocked(s, n, f) >+#define fwrite(p, s, n, f) fwrite_unlocked(p, s, n, f) >+#define feof(f) feof_unlocked(f) >+#endif > > #ifdef LJPEG_DECODE > #error Please compile dcraw.c by itself. >@@ -116,6 +125,13 @@ > ushort raw_height, raw_width, height, width, top_margin, left_margin; > ushort shrink, iheight, iwidth, fuji_width, thumb_width, thumb_height; > int flip, tiff_flip, colors; >+int gpsifdsize; >+struct tiff_tag { >+ ushort tag, type; >+ int count; >+ union { short s0, s1; int i0; } val; >+}; >+ushort *gpsifd; > double pixel_aspect, aber[4]={1,1,1,1}; > ushort (*image)[4], white[8][8], curve[0x4001], cr2_slice[3], sraw_mul[4]; > float bright=1, user_mul[4]={0,0,0,0}, threshold=0; >@@ -4790,6 +4806,119 @@ > > void CLASS parse_minolta (int base); > >+void CLASS parse_gps (int base) >+{ >+ unsigned entries, tag, type, len, save, datasize, n, m, nonzerotag = 0; >+ unsigned cpoff; >+ ushort *ifd; >+ >+ entries = get2(); >+ cpoff = 2 + entries * 12 + 4; >+ datasize = cpoff + 100; >+ ifd = malloc(datasize); >+ merror (ifd, "parse_gps()"); >+ *ifd = entries; >+ struct tiff_tag *tags = (struct tiff_tag *) (ifd + 1); >+ unsigned *zero = (unsigned*)&tags[entries]; >+ *zero = 0; >+ for (n = 0; n < entries; ++n) { >+ tiff_get (base, &tag, &type, &len, &save); >+ tags[n].tag = tag; >+ tags[n].type = type; >+ tags[n].count = len; >+ >+ nonzerotag |= tag != 0; >+ >+ switch (type) >+ { >+ case 1: >+ case 2: >+ case 6: >+ case 7: >+ if (len <= 4) { >+ tags[n].val.i0 = 0; >+ fread(&tags[n].val, 1, len, ifp); >+ } else { >+ tags[n].val.i0 = cpoff; >+ if (cpoff + len > datasize) { >+ ifd = realloc(ifd, datasize + MAX(100, len)); >+ merror (ifd, "parse_gps()"); >+ tags = (struct tiff_tag *) (ifd + 1); >+ datasize += MAX(100, len); >+ } >+ fread((char *) ifd + cpoff, len, 1, ifp); >+ cpoff += len; >+ } >+ break; >+ >+ case 3: >+ case 8: >+ if (len <= 2) { >+ tags[n].val.i0 = 0; >+ fread(&tags[n].val, 2, len, ifp); >+ } else { >+ tags[n].val.i0 = cpoff; >+ if (cpoff + 2 * len > datasize) { >+ ifd = realloc(ifd, datasize + MAX(100, 2 * len)); >+ merror (ifd, "parse_gps()"); >+ tags = (struct tiff_tag *) (ifd + 1); >+ datasize += MAX(100, 2 * len); >+ } >+ for (m = 0; m < len; ++m) { >+ *((ushort *) ((char *) ifd + cpoff)) = get2(); >+ cpoff += 2; >+ } >+ } >+ break; >+ >+ case 5: >+ case 10: >+ len *= 2; >+ case 4: >+ case 9: >+ case 11: >+ if (len <= 1) >+ fread(&tags[n].val, 4, len, ifp); >+ else { >+ tags[n].val.i0 = cpoff; >+ if (cpoff + 4 * len > datasize) { >+ ifd = realloc(ifd, datasize + MAX(100, 4 * len)); >+ merror (ifd, "parse_gps()"); >+ tags = (struct tiff_tag *) (ifd + 1); >+ datasize += MAX(100, 4 * len); >+ } >+ for (m = 0; m < len; ++m) { >+ *((unsigned *) ((char *) ifd + cpoff)) = get4(); >+ cpoff += 4; >+ } >+ } >+ break; >+ >+ case 12: >+ tags[n].val.i0 = cpoff; >+ if (cpoff + 8 * len > datasize) { >+ ifd = realloc(ifd, datasize + MAX(100, 8 * len)); >+ merror (ifd, "parse_gps()"); >+ tags = (struct tiff_tag *) (ifd + 1); >+ datasize += MAX(100, 8 * len); >+ } >+ for (m = 0; m < len; ++m) { >+ ((unsigned *) ((char *) ifd + cpoff))[1] = get4(); >+ ((unsigned *) ((char *) ifd + cpoff))[0] = get4(); >+ cpoff += 8; >+ } >+ break; >+ } >+ >+ fseek (ifp, save, SEEK_SET); >+ } >+ if (nonzerotag) { >+ gpsifdsize = cpoff; >+ gpsifd = ifd; >+ } else >+ free (ifd); >+} >+ > int CLASS parse_tiff_ifd (int base) > { > unsigned entries, tag, type, len, plen=16, save; >@@ -4996,6 +5125,10 @@ > profile_offset = ftell(ifp); > profile_length = len; > break; >+ case 34853: /* GPS IFD */ >+ fseek (ifp, get4()+base, SEEK_SET); >+ parse_gps (base); >+ break; > case 37122: /* CompressedBitsPerPixel */ > kodak_cbpp = get4(); > break; >@@ -7759,17 +7892,11 @@ > } > } > >-struct tiff_tag { >- ushort tag, type; >- int count; >- union { short s0, s1; int i0; } val; >-}; >- > struct tiff_hdr { > ushort order, magic; > int ifd; > ushort pad, ntag; >- struct tiff_tag tag[22]; >+ struct tiff_tag tag[23]; > int nextifd; > ushort pad2, nexif; > struct tiff_tag exif[4]; >@@ -7819,7 +7946,7 @@ > tiff_set (&th->ntag, 272, 2, 64, TOFF(th->model)); > if (full) { > if (oprof) psize = ntohl(oprof[0]); >- tiff_set (&th->ntag, 273, 4, 1, sizeof *th + psize); >+ tiff_set (&th->ntag, 273, 4, 1, sizeof *th + psize + gpsifdsize); > tiff_set (&th->ntag, 277, 3, 1, colors); > tiff_set (&th->ntag, 278, 4, 1, height); > tiff_set (&th->ntag, 279, 4, 1, height*width*colors*output_bps/8); >@@ -7834,6 +7961,7 @@ > tiff_set (&th->ntag, 315, 2, 64, TOFF(th->artist)); > tiff_set (&th->ntag, 34665, 4, 1, TOFF(th->nexif)); > if (psize) tiff_set (&th->ntag, 34675, 7, psize, sizeof *th); >+ if (full && gpsifdsize) tiff_set (&th->ntag, 34853, 4, 1, sizeof *th + psize); > tiff_set (&th->nexif, 33434, 5, 1, TOFF(th->rat[0])); > tiff_set (&th->nexif, 33437, 5, 1, TOFF(th->rat[2])); > tiff_set (&th->nexif, 34855, 3, 1, iso_speed); >@@ -7894,6 +8022,17 @@ > fwrite (&th, sizeof th, 1, ofp); > if (oprof) > fwrite (oprof, ntohl(oprof[0]), 1, ofp); >+ if (gpsifd) { >+ struct tiff_tag *tags = (struct tiff_tag *) (gpsifd + 1); >+ int i; >+ unsigned o = sizeof (th) + (oprof ? ntohl(oprof[0]) : 0); >+ for (i = 0; i < *gpsifd; ++i) { >+ ushort type = tags[i].type; >+ unsigned t = tags[i].count * ("11124811248488"[type < 14 ? type : 0] - '0'); >+ if (t > 4) tags[i].val.i0 += o; >+ } >+ fwrite (gpsifd, gpsifdsize, 1, ofp); >+ } > } else if (colors > 3) > fprintf (ofp, > "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 428600
: 291539