18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2013
48c2ecf20Sopenharmony_ci * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef DELTA_MJPEG_H
88c2ecf20Sopenharmony_ci#define DELTA_MJPEG_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "delta.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cistruct mjpeg_component {
138c2ecf20Sopenharmony_ci	unsigned int id;/* 1=Y, 2=Cb, 3=Cr, 4=L, 5=Q */
148c2ecf20Sopenharmony_ci	unsigned int h_sampling_factor;
158c2ecf20Sopenharmony_ci	unsigned int v_sampling_factor;
168c2ecf20Sopenharmony_ci	unsigned int quant_table_index;
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define MJPEG_MAX_COMPONENTS 5
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct mjpeg_header {
228c2ecf20Sopenharmony_ci	unsigned int length;
238c2ecf20Sopenharmony_ci	unsigned int sample_precision;
248c2ecf20Sopenharmony_ci	unsigned int frame_width;
258c2ecf20Sopenharmony_ci	unsigned int frame_height;
268c2ecf20Sopenharmony_ci	unsigned int nb_of_components;
278c2ecf20Sopenharmony_ci	struct mjpeg_component components[MJPEG_MAX_COMPONENTS];
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciint delta_mjpeg_read_header(struct delta_ctx *pctx,
318c2ecf20Sopenharmony_ci			    unsigned char *data, unsigned int size,
328c2ecf20Sopenharmony_ci			    struct mjpeg_header *header,
338c2ecf20Sopenharmony_ci			    unsigned int *data_offset);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#endif /* DELTA_MJPEG_H */
36