@@ -102,7 +102,6 @@ cdef extern from "libraw.h":
102102 double aber[4 ] # -C
103103 double gamm[6 ] # -g
104104 float user_mul[4 ] # -r mul0 mul1 mul2 mul3
105- unsigned shot_select # -s
106105 float bright # -b
107106 float threshold # -n
108107 int half_size # -h
@@ -165,6 +164,18 @@ cdef extern from "libraw.h":
165164 # Force use x3f data decoding either if demosaic pack GPL2 enabled
166165 int force_foveon_x3f
167166
167+ ctypedef struct libraw_raw_unpack_params_t:
168+ int use_rawspeed
169+ int use_dngsdk
170+ unsigned options
171+ unsigned shot_select
172+ unsigned specials
173+ unsigned max_raw_memory_mb
174+ int sony_arw2_posterization_thr
175+ float coolscan_nef_gamma
176+ char p4shot_order[5 ]
177+ char ** custom_camera_strings
178+
168179 ctypedef struct libraw_iparams_t:
169180 char make[64 ]
170181 char model[64 ]
@@ -183,6 +194,7 @@ cdef extern from "libraw.h":
183194 libraw_image_sizes_t sizes
184195 libraw_iparams_t idata
185196 libraw_output_params_t params
197+ libraw_raw_unpack_params_t rawparams
186198# unsigned int progress_flags
187199# unsigned int process_warnings
188200 libraw_colordata_t color
@@ -440,6 +452,21 @@ cdef class RawPy:
440452 e = self .p.open_buffer(buf, buf_len)
441453 self .handle_error(e)
442454
455+ def set_unpack_params (self , shot_select = 0 ):
456+ """
457+ Set parameters that affect RAW image unpacking.
458+
459+ This should be called after opening a file and before unpacking.
460+
461+ .. NOTE:: This is a low-level method. When using :func:`rawpy.imread`,
462+ unpack parameters can be provided directly.
463+
464+ :param int shot_select: select which image to extract from RAW files that contain multiple images
465+ (e.g., Dual Pixel RAW). Default is 0 for the first/main image.
466+ """
467+ cdef libraw_raw_unpack_params_t* rp = & self .p.imgdata.rawparams
468+ rp.shot_select = shot_select
469+
443470 def unpack (self ):
444471 """
445472 Unpacks/decodes the opened RAW image.
@@ -1208,7 +1235,7 @@ class Params(object):
12081235 self .aber = (chromatic_aberration[0 ], chromatic_aberration[1 ])
12091236 else :
12101237 self .aber = (1 , 1 )
1211- self .bad_pixels = bad_pixels_path
1238+ self .bad_pixels = bad_pixels_path
12121239
12131240cdef class processed_image_wrapper:
12141241 cdef RawPy raw
0 commit comments