// SPDX-License-Identifier: GPL-2.0-or-later /* * Coda multi-standard codec IP - MPEG-2 helper functions * * Copyright (C) 2019 Pengutronix, Philipp Zabel */ #include <linux/kernel.h> #include <linux/videodev2.h> #include "coda.h" int coda_mpeg2_profile(int profile_idc) { … } int coda_mpeg2_level(int level_idc) { … } /* * Check if the buffer starts with the MPEG-2 sequence header (with or without * quantization matrix) and extension header, for example: * * 00 00 01 b3 2d 01 e0 34 08 8b a3 81 * 10 11 11 12 12 12 13 13 13 13 14 14 14 14 14 15 * 15 15 15 15 15 16 16 16 16 16 16 16 17 17 17 17 * 17 17 17 17 18 18 18 19 18 18 18 19 1a 1a 1a 1a * 19 1b 1b 1b 1b 1b 1c 1c 1c 1c 1e 1e 1e 1f 1f 21 * 00 00 01 b5 14 8a 00 01 00 00 * * or: * * 00 00 01 b3 08 00 40 15 ff ff e0 28 * 00 00 01 b5 14 8a 00 01 00 00 * * Returns the detected header size in bytes or 0. */ u32 coda_mpeg2_parse_headers(struct coda_ctx *ctx, u8 *buf, u32 size) { … }