avcodec/lcevc_parser: move the resolution type table to a header

Will be useful in the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2026-03-09 20:20:53 -03:00
parent ce7375fc17
commit c5aa31d252
4 changed files with 64 additions and 22 deletions

View File

@@ -1277,7 +1277,7 @@ OBJS-$(CONFIG_IPU_PARSER) += ipu_parser.o
OBJS-$(CONFIG_JPEG2000_PARSER) += jpeg2000_parser.o
OBJS-$(CONFIG_JPEGXL_PARSER) += jpegxl_parser.o jpegxl_parse.o
OBJS-$(CONFIG_JPEGXS_PARSER) += jpegxs_parser.o
OBJS-$(CONFIG_LCEVC_PARSER) += lcevc_parser.o
OBJS-$(CONFIG_LCEVC_PARSER) += lcevc_parser.o lcevctab.o
OBJS-$(CONFIG_MISC4_PARSER) += misc4_parser.o
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
OBJS-$(CONFIG_MLP_PARSER) += mlp_parse.o mlp_parser.o mlp.o

View File

@@ -26,6 +26,7 @@
#include "h2645_parse.h"
#include "lcevc.h"
#include "lcevc_parse.h"
#include "lcevctab.h"
#include "parser.h"
#include "parser_internal.h"
@@ -82,25 +83,6 @@ static const enum AVPixelFormat pix_fmts[4][4] = {
AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14, },
};
static const struct {
int width;
int height;
} resolution_type_lut[63] = {
{ 0, 0},
{ 360, 200 }, { 400, 240 }, { 480, 320 }, { 640, 360 },
{ 640, 480 }, { 768, 480 }, { 800, 600 }, { 852, 480 },
{ 854, 480 }, { 856, 480 }, { 960, 540 }, { 960, 640 },
{ 1024, 576 }, { 1024, 600 }, { 1024, 768 }, { 1152, 864 },
{ 1280, 720 }, { 1280, 800 }, { 1280, 1024 }, { 1360, 768 },
{ 1366, 768 }, { 1920, 1200 }, { 2048, 1080 }, { 2048, 1152 },
{ 2048, 1536 }, { 2160, 1440 }, { 2560, 1440 }, { 2560, 1600 },
{ 2560, 2048 }, { 3200, 1800 }, { 3200, 2048 }, { 3200, 2400 },
{ 3440, 1440 }, { 3840, 1600 }, { 3840, 2160 }, { 3840, 2400 },
{ 4096, 2160 }, { 4096, 3072 }, { 5120, 2880 }, { 5120, 3200 },
{ 5120, 4096 }, { 6400, 4096 }, { 6400, 4800 }, { 7680, 4320 },
{ 7680, 4800 },
};
static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
const H2645NAL *nal)
{
@@ -152,8 +134,8 @@ static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
s->format = pix_fmts[bit_depth][chroma_format_idc];
if (resolution_type < 63) {
s->width = resolution_type_lut[resolution_type].width;
s->height = resolution_type_lut[resolution_type].height;
s->width = ff_lcevc_resolution_type[resolution_type].width;
s->height = ff_lcevc_resolution_type[resolution_type].height;
} else {
int upsample_type, tile_dimensions_type;
int temporal_step_width_modifier_signalled_flag, level1_filtering_signalled_flag;

19
libavcodec/lcevctab.c Normal file
View File

@@ -0,0 +1,19 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "lcevctab.h"

41
libavcodec/lcevctab.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_LCEVCTAB_H
#define AVCODEC_LCEVCTAB_H
static const struct {
int width;
int height;
} ff_lcevc_resolution_type[63] = {
{ 0, 0},
{ 360, 200 }, { 400, 240 }, { 480, 320 }, { 640, 360 },
{ 640, 480 }, { 768, 480 }, { 800, 600 }, { 852, 480 },
{ 854, 480 }, { 856, 480 }, { 960, 540 }, { 960, 640 },
{ 1024, 576 }, { 1024, 600 }, { 1024, 768 }, { 1152, 864 },
{ 1280, 720 }, { 1280, 800 }, { 1280, 1024 }, { 1360, 768 },
{ 1366, 768 }, { 1920, 1200 }, { 2048, 1080 }, { 2048, 1152 },
{ 2048, 1536 }, { 2160, 1440 }, { 2560, 1440 }, { 2560, 1600 },
{ 2560, 2048 }, { 3200, 1800 }, { 3200, 2048 }, { 3200, 2400 },
{ 3440, 1440 }, { 3840, 1600 }, { 3840, 2160 }, { 3840, 2400 },
{ 4096, 2160 }, { 4096, 3072 }, { 5120, 2880 }, { 5120, 3200 },
{ 5120, 4096 }, { 6400, 4096 }, { 6400, 4800 }, { 7680, 4320 },
{ 7680, 4800 },
};
#endif /* AVCODEC_LCEVCTAB_H */