1. JPEG, TIFF: 大小: 寬 * 高 * 1 byte (8 bits) 顏色: 每個點擁有2的8次方 = 256 個層級,因此8bit的JPEG可以表示出256(R) * 256(G) * 256(B) = 16,777,216 = 16.77M 種顏色。 2. RAW 12: 大小: 寬 * 高 * 1.5 byte (12 bits) 顏色: 每個點擁有2的12次方 = 4096 個層級,因此RAW 12bit可表示出4096(R) * 4096(G) * 4096(B) = 68,719,476,736 = 68700M = 68.7G 種顏色。 3. RAW 14: 大小: 寬 * 高 * 1.75 byte (14 bits) 顏色: 每個點擁有2的14次方 = 16384 個級,因此14bit RAW可表示出16384(R) * 16384(G) * 16384(B) = 4,398,046,511,104 = 4398000M = 4398G = 4.398T 種顏色。 4. BMP 16 5. BMP 24 6. PPM (portable pixmap format) 7. 單眼中,每個檔案格式的大小 RAW 14-bit 未壓縮, 74.4MB, 103張 RAW 14-bit 無損壓縮, 41.3MB, 103張 RAW 14-bit 壓縮, 35.9MB, 151張 RAW 12-bit 未壓縮, 57.0MB, 133張 RAW 12-bit 無損壓縮, 32.4MB, 133張 RAW 12-bit 壓縮, 29.0MB, 182張 TIFF (RGB) -L 108.2MB, 71張 TIFF (RGB) -M 61.5MB, 126張 TIFF (RGB) -S 28.0MB, 277張 JPEG fine -L 16.3 MB, 360張 JPEG fine -M 10.4 MB, 616張 JPEG fine -S 5.2 MB, 1200張 JPEG normal -L 9.1 MB, 718張 JPEG normal -M 5.3 MB, 1200張 JPEG normal -S 2.6 MB, 2400張 JPEG basic -L 4.0 MB, 1400張 JPEG basic -M 2.7 MB, 2400張 JPEG basic -S 1.4 MB, 4800張
2016年9月28日 星期三
RAW12, RAW14, JPEG, TIFF影像格式
User space存取記憶體: devmem
1. 透過devmem,可以在userspace存取記憶體
2. 範例
2. 範例
/* * devmem2.c: Simple program to read/write from/to any location in memory. * * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) * * * This software has been developed for the LART computing board * (http://www.lart.tudelft.nl/). The development has been sponsored by * the Mobile MultiMedia Communications (http://www.mmc.tudelft.nl/) * and Ubiquitous Communications (http://www.ubicom.tudelft.nl/) * projects. * * The author can be reached at: * * Jan-Derk Bakker * Information and Communication Theory Group * Faculty of Information Technology and Systems * Delft University of Technology * P.O. Box 5031 * 2600 GA Delft * The Netherlands * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include3. 使用方法#include #include #include #include #include #include #include #include #include #include #define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) #define MAP_SIZE 4096UL #define MAP_MASK (MAP_SIZE - 1) int main(int argc, char **argv) { int fd; void *map_base, *virt_addr; unsigned long read_result, writeval; off_t target; int access_type = 'w'; if(argc < 2) { fprintf(stderr, "\nUsage:\t%s { address } [ type [ data ] ]\n" "\taddress : memory address to act upon\n" "\ttype : access operation type : [b]yte, [h]alfword, [w]ord\n" "\tdata : data to be written\n\n", argv[0]); exit(1); } target = strtoul(argv[1], 0, 0); if(argc > 2) access_type = tolower(argv[2][0]); if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; printf("/dev/mem opened.\n"); fflush(stdout); /* Map one page */ map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK); if(map_base == (void *) -1) FATAL; printf("Memory mapped at address %p.\n", map_base); fflush(stdout); virt_addr = map_base + (target & MAP_MASK); switch(access_type) { case 'b': read_result = *((unsigned char *) virt_addr); break; case 'h': read_result = *((unsigned short *) virt_addr); break; case 'w': read_result = *((unsigned long *) virt_addr); break; default: fprintf(stderr, "Illegal data type '%c'.\n", access_type); exit(2); } printf("Value at address 0x%X (%p): 0x%X\n", target, virt_addr, read_result); fflush(stdout); if(argc > 3) { writeval = strtoul(argv[3], 0, 0); switch(access_type) { case 'b': *((unsigned char *) virt_addr) = writeval; read_result = *((unsigned char *) virt_addr); break; case 'h': *((unsigned short *) virt_addr) = writeval; read_result = *((unsigned short *) virt_addr); break; case 'w': *((unsigned long *) virt_addr) = writeval; read_result = *((unsigned long *) virt_addr); break; } printf("Written 0x%X; readback 0x%X\n", writeval, read_result); fflush(stdout); } if(munmap(map_base, MAP_SIZE) == -1) FATAL; close(fd); return 0; }
$ ./devmem Usage: ./devmem { address } [ type [ data ] ] address : memory address to act upon type : access operation type : [b]yte, [h]alfword, [w]ord data : data to be written讀取記憶體
$ devmem 0x97000000 32寫入記憶體
$ devmem 0x97000000 32 0x000000004. 參考來源 http://free-electrons.com/pub/mirror/devmem2.c
訂閱:
文章 (Atom)