Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
imageio_j2k.c File Reference
#include "common/darktable.h"
#include "common/exif.h"
#include "common/imageio_j2k.h"
#include "develop/imageop.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <openjpeg.h>
+ Include dependency graph for imageio_j2k.c:

Macros

#define J2K_CFMT   0
 
#define JP2_CFMT   1
 
#define JPT_CFMT   2
 

Functions

static void color_sycc_to_rgb (opj_image_t *img)
 
static void error_callback (const char *msg, void *client_data)
 
static int get_file_format (const char *filename)
 
dt_imageio_retval_t dt_imageio_open_j2k (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *mbuf)
 
int dt_imageio_j2k_read_profile (const char *filename, uint8_t **out)
 
static void sycc_to_rgb (int offset, int upb, int y, int cb, int cr, int *out_r, int *out_g, int *out_b)
 
static void sycc444_to_rgb (opj_image_t *img)
 
static void sycc422_to_rgb (opj_image_t *img)
 
static void sycc420_to_rgb (opj_image_t *img)
 

Variables

static char JP2_HEAD [] = { 0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A }
 
static char JP2_MAGIC [] = { 0x0d, 0x0a, 0x87, 0x0a }
 
static char J2K_HEAD [] = { 0xFF, 0x4F, 0xFF, 0x51, 0x00 }
 

Macro Definition Documentation

◆ J2K_CFMT

#define J2K_CFMT   0

◆ JP2_CFMT

#define JP2_CFMT   1

◆ JPT_CFMT

#define JPT_CFMT   2

Function Documentation

◆ color_sycc_to_rgb()

static void color_sycc_to_rgb ( opj_image_t *  img)
static

◆ dt_imageio_j2k_read_profile()

int dt_imageio_j2k_read_profile ( const char *  filename,
uint8_t **  out 
)

reads the color profile attached to the image

Todo:
: how to do it without fully-decoding the whole image?

References DT_IMAGEIO_FILE_CORRUPTED, get_file_format(), J2K_HEAD, JP2_HEAD, and JP2_MAGIC.

Referenced by dt_image_find_best_color_profile().

◆ dt_imageio_open_j2k()

◆ error_callback()

static void error_callback ( const char *  msg,
void client_data 
)
static

sample error callback expecting a FILE* client object

Referenced by dt_imageio_open_j2k().

◆ get_file_format()

static int get_file_format ( const char *  filename)
static

sample warning callback expecting a FILE* client object sample debug callback expecting no client object

References extension(), J2K_CFMT, JP2_CFMT, and JPT_CFMT.

Referenced by dt_imageio_j2k_read_profile(), and dt_imageio_open_j2k().

◆ sycc420_to_rgb()

static void sycc420_to_rgb ( opj_image_t *  img)
static

References sycc_to_rgb().

Referenced by color_sycc_to_rgb().

◆ sycc422_to_rgb()

static void sycc422_to_rgb ( opj_image_t *  img)
static

References sycc_to_rgb().

Referenced by color_sycc_to_rgb().

◆ sycc444_to_rgb()

static void sycc444_to_rgb ( opj_image_t *  img)
static

References sycc_to_rgb().

Referenced by color_sycc_to_rgb().

◆ sycc_to_rgb()

static void sycc_to_rgb ( int  offset,
int  upb,
int  y,
int  cb,
int  cr,
int *  out_r,
int *  out_g,
int *  out_b 
)
static

Variable Documentation

◆ J2K_HEAD

char J2K_HEAD[] = { 0xFF, 0x4F, 0xFF, 0x51, 0x00 }
static

◆ JP2_HEAD

char JP2_HEAD[] = { 0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A }
static

◆ JP2_MAGIC

char JP2_MAGIC[] = { 0x0d, 0x0a, 0x87, 0x0a }
static