avcodec/lcevc_parser: move pixel format table to a shared file

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2026-03-29 11:03:33 -03:00
parent 589da160b2
commit 01b0b86225
4 changed files with 46 additions and 12 deletions

View File

@@ -81,4 +81,34 @@ enum {
LCEVC_ADDITIONAL_INFO_TYPE_VUI = 1,
};
/*
* Table 21 — Colour format for the decoded picture
*/
enum {
LCEVC_CHROMA_SAMPLING_TYPE_400 = 0,
LCEVC_CHROMA_SAMPLING_TYPE_420 = 1,
LCEVC_CHROMA_SAMPLING_TYPE_422 = 2,
LCEVC_CHROMA_SAMPLING_TYPE_444 = 3,
};
/*
* Table 23 — Bit depth of the decoded base picture
*/
enum {
LCEVC_BASE_DEPTH_TYPE_8 = 0,
LCEVC_BASE_DEPTH_TYPE_10 = 1,
LCEVC_BASE_DEPTH_TYPE_12 = 2,
LCEVC_BASE_DEPTH_TYPE_14 = 3,
};
/*
* Table 24 — Bit depth of the decoded picture
*/
enum {
LCEVC_ENHANCEMENT_DEPTH_TYPE_8 = 0,
LCEVC_ENHANCEMENT_DEPTH_TYPE_10 = 1,
LCEVC_ENHANCEMENT_DEPTH_TYPE_12 = 2,
LCEVC_ENHANCEMENT_DEPTH_TYPE_14 = 3,
};
#endif /* AVCODEC_LCEVC_H */

View File

@@ -72,17 +72,6 @@ static int lcevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
return END_NOT_FOUND;
}
static const enum AVPixelFormat pix_fmts[4][4] = {
{ AV_PIX_FMT_GRAY8, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, },
{ AV_PIX_FMT_GRAY10, AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, },
{ AV_PIX_FMT_GRAY12, AV_PIX_FMT_YUV420P12,
AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, },
{ AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV420P14,
AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14, },
};
static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
const H2645NAL *nal)
{
@@ -131,7 +120,7 @@ static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
skip_bits(&gb, 2);
bit_depth = get_bits(&gb, 2); // enhancement_depth_type
s->format = pix_fmts[bit_depth][chroma_format_idc];
s->format = ff_lcevc_depth_type[bit_depth][chroma_format_idc];
if (resolution_type < 63) {
s->width = ff_lcevc_resolution_type[resolution_type].width;

View File

@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "lcevc.h"
#include "lcevctab.h"
const struct FFLCEVCDim ff_lcevc_resolution_type[63] = {
@@ -33,3 +34,14 @@ const struct FFLCEVCDim ff_lcevc_resolution_type[63] = {
{ 5120, 4096 }, { 6400, 4096 }, { 6400, 4800 }, { 7680, 4320 },
{ 7680, 4800 },
};
const enum AVPixelFormat ff_lcevc_depth_type[4][4] = {
[LCEVC_BASE_DEPTH_TYPE_8] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P },
[LCEVC_BASE_DEPTH_TYPE_10] = { AV_PIX_FMT_GRAY10, AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10 },
[LCEVC_BASE_DEPTH_TYPE_12] = { AV_PIX_FMT_GRAY12, AV_PIX_FMT_YUV420P12,
AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12 },
[LCEVC_BASE_DEPTH_TYPE_14] = { AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV420P14,
AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14 },
};

View File

@@ -22,10 +22,13 @@
#include <stdint.h>
#include "libavutil/attributes_internal.h"
#include "libavutil/pixfmt.h"
EXTERN const struct FFLCEVCDim {
uint16_t width;
uint16_t height;
} ff_lcevc_resolution_type[63];
EXTERN const enum AVPixelFormat ff_lcevc_depth_type[4][4];
#endif /* AVCODEC_LCEVCTAB_H */