blob: 3aa08c30c0975986d2ba9e50bab57f7ab1bf1a5e [file] [log] [blame]
Anton Khirnov233a5a82012-10-08 10:03:081/*
2 * Copyright (c) 2003 Michael Niedermayer
3 *
Michael Niedermayercd6f5c42012-10-10 12:04:034 * This file is part of FFmpeg.
Anton Khirnov233a5a82012-10-08 10:03:085 *
Michael Niedermayercd6f5c42012-10-10 12:04:036 * FFmpeg is free software; you can redistribute it and/or
Anton Khirnov233a5a82012-10-08 10:03:087 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
Michael Niedermayercd6f5c42012-10-10 12:04:0311 * FFmpeg is distributed in the hope that it will be useful,
Anton Khirnov233a5a82012-10-08 10:03:0812 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
Michael Niedermayercd6f5c42012-10-10 12:04:0317 * License along with FFmpeg; if not, write to the Free Software
Anton Khirnov233a5a82012-10-08 10:03:0818 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/**
22 * @file
23 * ASUS V1/V2 encoder/decoder common data
24 */
25
26#include <stdint.h>
27
Andreas Rheinhardt8a9eac72022-10-01 15:05:4528#include "libavutil/attributes.h"
29
Anton Khirnov233a5a82012-10-08 10:03:0830#include "asv.h"
31#include "avcodec.h"
Diego Biurrunc67b4492014-02-13 16:57:0532#include "bswapdsp.h"
Anton Khirnov233a5a82012-10-08 10:03:0833
34const uint8_t ff_asv_scantab[64] = {
Gabriel Dumef61e47d2014-09-01 19:18:5835 0x00, 0x08, 0x01, 0x09, 0x10, 0x18, 0x11, 0x19,
36 0x02, 0x0A, 0x03, 0x0B, 0x12, 0x1A, 0x13, 0x1B,
37 0x04, 0x0C, 0x05, 0x0D, 0x20, 0x28, 0x21, 0x29,
38 0x06, 0x0E, 0x07, 0x0F, 0x14, 0x1C, 0x15, 0x1D,
39 0x22, 0x2A, 0x23, 0x2B, 0x30, 0x38, 0x31, 0x39,
40 0x16, 0x1E, 0x17, 0x1F, 0x24, 0x2C, 0x25, 0x2D,
41 0x32, 0x3A, 0x33, 0x3B, 0x26, 0x2E, 0x27, 0x2F,
42 0x34, 0x3C, 0x35, 0x3D, 0x36, 0x3E, 0x37, 0x3F,
Anton Khirnov233a5a82012-10-08 10:03:0843};
44
45const uint8_t ff_asv_ccp_tab[17][2] = {
Gabriel Dumef61e47d2014-09-01 19:18:5846 { 0x2, 2 }, { 0x7, 5 }, { 0xB, 5 }, { 0x3, 5 },
47 { 0xD, 5 }, { 0x5, 5 }, { 0x9, 5 }, { 0x1, 5 },
48 { 0xE, 5 }, { 0x6, 5 }, { 0xA, 5 }, { 0x2, 5 },
49 { 0xC, 5 }, { 0x4, 5 }, { 0x8, 5 }, { 0x3, 2 },
50 { 0xF, 5 }, // EOB
Anton Khirnov233a5a82012-10-08 10:03:0851};
52
53const uint8_t ff_asv_level_tab[7][2] = {
Gabriel Dumef61e47d2014-09-01 19:18:5854 { 3, 4 }, { 3, 3 }, { 3, 2 }, { 0, 3 }, { 2, 2 }, { 2, 3 }, { 2, 4 }
Anton Khirnov233a5a82012-10-08 10:03:0855};
56
57const uint8_t ff_asv_dc_ccp_tab[8][2] = {
Andreas Rheinhardt746ab832020-10-13 01:11:3758 { 0x2, 2 }, { 0xB, 4 }, { 0xF, 4 }, { 0x3, 4 },
59 { 0x5, 3 }, { 0x7, 4 }, { 0x1, 3 }, { 0x0, 2 },
Anton Khirnov233a5a82012-10-08 10:03:0860};
61
62const uint8_t ff_asv_ac_ccp_tab[16][2] = {
Andreas Rheinhardt746ab832020-10-13 01:11:3763 { 0x00, 2 }, { 0x37, 6 }, { 0x05, 4 }, { 0x17, 6 },
64 { 0x02, 3 }, { 0x27, 6 }, { 0x0F, 6 }, { 0x07, 6 },
65 { 0x06, 3 }, { 0x2F, 6 }, { 0x01, 4 }, { 0x1F, 5 },
66 { 0x09, 4 }, { 0x0D, 4 }, { 0x0B, 4 }, { 0x03, 4 },
Anton Khirnov233a5a82012-10-08 10:03:0867};
68
Andreas Rheinhardt746ab832020-10-13 01:11:3769const uint16_t ff_asv2_level_tab[63][2] = {
70 { 0x3F0, 10 }, { 0x3D0, 10 }, { 0x3B0, 10 }, { 0x390, 10 }, { 0x370, 10 },
71 { 0x350, 10 }, { 0x330, 10 }, { 0x310, 10 }, { 0x2F0, 10 }, { 0x2D0, 10 },
72 { 0x2B0, 10 }, { 0x290, 10 }, { 0x270, 10 }, { 0x250, 10 }, { 0x230, 10 },
73 { 0x210, 10 },
74 { 0x0F8, 8 }, { 0x0E8, 8 }, { 0x0D8, 8 }, { 0x0C8, 8 }, { 0x0B8, 8 },
75 { 0x0A8, 8 }, { 0x098, 8 }, { 0x088, 8 },
76 { 0x03C, 6 }, { 0x034, 6 }, { 0x02C, 6 }, { 0x024, 6 },
77 { 0x00E, 4 }, { 0x00A, 4 },
78 { 0x003, 2 },
79 { 0x000, 5 },
80 { 0x001, 2 },
81 { 0x002, 4 }, { 0x006, 4 },
82 { 0x004, 6 }, { 0x00C, 6 }, { 0x014, 6 }, { 0x01C, 6 },
83 { 0x008, 8 }, { 0x018, 8 }, { 0x028, 8 }, { 0x038, 8 }, { 0x048, 8 },
84 { 0x058, 8 }, { 0x068, 8 }, { 0x078, 8 },
85 { 0x010, 10 }, { 0x030, 10 }, { 0x050, 10 }, { 0x070, 10 }, { 0x090, 10 },
86 { 0x0B0, 10 }, { 0x0D0, 10 }, { 0x0F0, 10 }, { 0x110, 10 }, { 0x130, 10 },
87 { 0x150, 10 }, { 0x170, 10 }, { 0x190, 10 }, { 0x1B0, 10 }, { 0x1D0, 10 },
88 { 0x1F0, 10 }
Anton Khirnov233a5a82012-10-08 10:03:0889};
90
Gabriel Dumef61e47d2014-09-01 19:18:5891av_cold void ff_asv_common_init(AVCodecContext *avctx)
92{
Andreas Rheinhardt8a9eac72022-10-01 15:05:4593 ASVCommonContext *const a = avctx->priv_data;
Anton Khirnov233a5a82012-10-08 10:03:0894
Diego Biurrunc67b4492014-02-13 16:57:0595 ff_bswapdsp_init(&a->bbdsp);
Anton Khirnov233a5a82012-10-08 10:03:0896
97 a->mb_width = (avctx->width + 15) / 16;
98 a->mb_height = (avctx->height + 15) / 16;
Gabriel Dumef61e47d2014-09-01 19:18:5899 a->mb_width2 = (avctx->width + 0) / 16;
100 a->mb_height2 = (avctx->height + 0) / 16;
Anton Khirnov233a5a82012-10-08 10:03:08101
Gabriel Dumef61e47d2014-09-01 19:18:58102 a->avctx = avctx;
Anton Khirnov233a5a82012-10-08 10:03:08103}