Lines Matching refs:jpeg
51 def strip_soi_marker(jpeg): argument
63 soi = jpeg[0:2]
66 return jpeg[2:]
69 def strip_appn_data(jpeg): argument
85 while i < len(jpeg) - 1:
86 if [jpeg[i], jpeg[i + 1]] in _JPEG_APPN_MARKERS:
87 length = jpeg[i + 2] * 256 + jpeg[i + 3] + 2
89 jpeg = np.concatenate((jpeg[0:i], jpeg[length:]), axis=None)
90 elif ([jpeg[i], jpeg[i + 1]] == _JPEG_DQT_MARKER or
91 [jpeg[i], jpeg[i + 1]] == _JPEG_DHT_MARKER):
96 return jpeg
99 def find_dqt_markers(marker, jpeg): argument
113 for i in range(len(jpeg) - marker_len + 1):
114 if list(jpeg[i:i + marker_len]) == marker:
119 def extract_dqts(jpeg, debug=False): argument
138 dqt_markers = find_dqt_markers(_JPEG_DQT_MARKER, jpeg)
145 jpeg[dqt:dqt + 2], jpeg[dqt + 2:dqt + 4])
146 dqt_size = jpeg[dqt + 2] * 256 + jpeg[dqt + 3] - 2 # strip off size marker
154 luma = np.array(jpeg[luma_start: luma_start + dqt_size])
155 chroma = np.array(jpeg[chroma_start: chroma_start + dqt_size])
168 matrix = np.array(jpeg[start:start + dqt_size])
169 if jpeg[dqt + 4]: # chroma == 1
245 jpeg = cap['data']
248 jpeg = strip_soi_marker(jpeg)
251 jpeg = strip_appn_data(jpeg)
252 logging.debug('remaining JPEG header:%s', jpeg[0:4])
255 lumas_i, chromas_i = extract_dqts(jpeg, debug)