X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fsvq1_cb.h;h=e22cd60e231767a2ae6e989da618969ec482c14d;hb=3941df546276b190cc9362fd093e6721e8e52f50;hp=5c98c8047408622e3a87f2d8a4b27c41889bde2c;hpb=5509bffa88238d1f445a84a32e3791bfb9e532fd;p=ffmpeg diff --git a/libavcodec/svq1_cb.h b/libavcodec/svq1_cb.h index 5c98c804740..e22cd60e231 100644 --- a/libavcodec/svq1_cb.h +++ b/libavcodec/svq1_cb.h @@ -1,34 +1,43 @@ /* + * SVQ1 decoder + * ported to MPlayer by Arpi + * ported to libavcodec by Nick Kurshev * * Copyright (C) 2002 the xine project * Copyright (C) 2002 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of Libav. + * + * Libav 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 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * Libav 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 this library; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Ported to mplayer by Arpi - * Ported to libavcodec by Nick Kurshev - * */ /** - * @file svq1_cb.h + * @file * svq1 code books. */ +#ifndef AVCODEC_SVQ1_CB_H +#define AVCODEC_SVQ1_CB_H + +#include +#include + +#include "libavutil/mem.h" + /* 6x16-entry codebook for inter-coded 4x2 vectors */ -static const int8_t svq1_inter_codebook_4x2[768] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x2)[768] = { 7, 2, -6, -7, 7, 3, -3, -4, -7, -2, 7, 8, -8, -4, 3, 4, 19, 17, 9, 3,-14,-16,-12, -8,-18,-16, -8, -3, 11, 14, 12, 8, 7,-16,-10, 20, 7,-17,-10, 20, -6, 18, 8,-21, -7, 18, 9,-20, @@ -80,7 +89,7 @@ static const int8_t svq1_inter_codebook_4x2[768] = { }; /* 6x16-entry codebook for inter-coded 4x4 vectors */ -static const int8_t svq1_inter_codebook_4x4[1536] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x4)[1536] = { 4, 0, -6, -7, -4, -8,-13, -9, -8, -8, -1, 6, -2, 5, 22, 27, -16, -7, 11, 10,-18, -7, 13, 10,-15, -4, 12, 8, -9, -1, 9, 5, -2, 2, 15,-16, -3, 2, 19,-19, -3, 2, 19,-19, -2, 3, 15,-14, @@ -180,7 +189,7 @@ static const int8_t svq1_inter_codebook_4x4[1536] = { }; /* 6x16-entry codebook for inter-coded 8x4 vectors */ -static const int8_t svq1_inter_codebook_8x4[3072] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x4)[3072] = { 9, 8, 4, 0, -3, -4, -4, -3, 9, 8, 4, -1, -4, -5, -5, -3, 8, 7, 3, -2, -5, -5, -5, -4, 6, 4, 1, -2, -4, -5, -4, -3, -12,-14,-11, -4, 1, 5, 6, 6, -8,-10, -7, -5, -2, 1, 1, 1, @@ -376,7 +385,7 @@ static const int8_t svq1_inter_codebook_8x4[3072] = { }; /* 6x16-entry codebook for inter-coded 8x8 vectors */ -static const int8_t svq1_inter_codebook_8x8[6144] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] = { -4, -3, 4, 5, 2, 1, 1, 0, -5, -3, 5, 5, 2, 1, 0, 0, -6, -4, 5, 5, 2, 1, 0, 0, -7, -4, 4, 5, 2, 1, 0, 0, -8, -5, 3, 4, 2, 1, 0, 0, -8, -6, 3, 4, 1, 1, 1, 0, @@ -764,45 +773,14 @@ static const int8_t svq1_inter_codebook_8x8[6144] = { }; /* list of codebooks for inter-coded vectors */ -static const int8_t* const svq1_inter_codebooks[4] = { +const int8_t* const ff_svq1_inter_codebooks[6] = { svq1_inter_codebook_4x2, svq1_inter_codebook_4x4, - svq1_inter_codebook_8x4, svq1_inter_codebook_8x8 -}; - -static const int8_t svq1_inter_codebook_sum[4][16*6] = { - { - -1, 1, -2, 0, 1, -1, -1, -1, -2, -1, 1, -1, -1, 0, -1, -1, - 0, -1, -1, -1, -1, 0, -1, 0, 0, 0, -3, 1, -1, 0, 1, -1, - 1, -1, 2, 2, 1, 1, 2, 0, 0, 0, -1, 1, 1, 0, 0, 0, - 1, -1, 0, 1, -1, 1, 1, 0, 1, 0, -1, 1, 1, 0, 0, 0, - -2, 0, 0, -2, 0, 0, -2, 0, -2, -1, -2, -1, 0, 0, -1, 0, - 1, 0, 1, -1, 2, 2, 1, 2, 2, 1, 0, 1, 1, 0, 1, 1, - },{ - -2, 1, -1, -1, 1, 0, 1, -1, -1, -1, 1, -1, 0, -1, 0, -1, - 0, 0, 0, -2, 0, 1, 0, -1, -1, 0, 2, -3, 1, -2, 3, -1, - 2, 0, 2, 1, 1, -1, 1, 1, 0, 0, 1, 1, 2, -2, 1, 0, - -2, -1, 2, -2, -2, 0, -3, 0, -1, 0, -1, 0, -1, 0, -2, -3, - 1, -2, -2, -1, 1, -1, -1, 1, -1, 1, 1, 0, -2, 0, 1, 1, - 1, 1, 2, 1, 0, 0, -1, 0, 0, 1, 0, 1, -1, 1, 0, 2, - },{ - 0, 0, 0, -3, 1, 1, 1, -3, 0, -1, 0, -3, 1, -3, 0, -2, - 1, 2, -1, -3, 0, -3, 1, -1, 0, -1, 0, 0, 1, 2, 1, 1, - -1, 2, -3, 3, 1, 0, -5, 1, 0, -1, -3, 1, 0, 2, 0, -3, - 4, 2, 0, -2, 1, -2, 3, -2, 1, 1, 0, -1, 2, 5, 3, 1, - -1, 0, 2, -3, -2, 0, 0, -2, 2, -3, -1, -1, 2, 1, 0, -2, - 3, -1, 1, -1, 2, 4, 0, 1, 0, 1, 0, -1, -3, -2, -1, 0, - },{ - 0, 2, -1, -1, 2, -4, -2, 3, 0, -1, -5, 1, 0, 1, 0, 6, - -2, 2, 0, 1, 1, -1, -1, -2, 1, -2, -1, 0, 2, -2, -2, -1, - -4, 2, -1, -3, -1, -2, 2, -1, 2, -1, 2, 0, 3, -3, -3, 0, - -3, 0, 0, -2, 4, -4, 0, -1, 4, 0, -2, -2, 3, -2, 0, 4, - 5, 0, 1, 0, -3, 3, 3, 2, 0, 0, 1, 2, -5, -2, -3, 0, - -3, 2, -2, 2, -2, 4, 7, -3, 4, 2, 3, 2, -1, 0, -3, 1, - } + svq1_inter_codebook_8x4, svq1_inter_codebook_8x8, + NULL, NULL, }; /* 6x16-entry codebook for intra-coded 4x2 vectors */ -static const int8_t svq1_intra_codebook_4x2[768] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x2)[768] = { 12, 13, 13, 11, -7,-10,-15,-17,-16,-15,-12,-10, 11, 15, 15, 12, 2, 17, 20, 15,-45,-24, 2, 13, 21, 20, -6,-36, 12, 16, -1,-27, -18,-21, 10, 45,-11,-20, -7, 21, 43, -8,-28, 0, 33,-16,-28, 3, @@ -854,7 +832,7 @@ static const int8_t svq1_intra_codebook_4x2[768] = { }; /* 6x16-entry codebook for intra-coded 4x4 vectors */ -static const int8_t svq1_intra_codebook_4x4[1536] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x4)[1536] = { -11, -3, 3, 6,-10, -1, 5, 7, -9, -1, 6, 7, -9, -1, 4, 6, 5, 7, 0,-14, 6, 9, 2,-15, 6, 9, 2,-15, 4, 6, 0,-14, 16, 3, -5, -6, 16, 1, -8, -8, 14, -1, -9, -9, 12, 0, -8, -8, @@ -954,7 +932,7 @@ static const int8_t svq1_intra_codebook_4x4[1536] = { }; /* 6x16-entry codebook for intra-coded 8x4 vectors */ -static const int8_t svq1_intra_codebook_8x4[3072] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] = { 5, 6, 6, 6, 7, 7, 8, 8, 0, 0, 0, 0, 0, 1, 2, 3, -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 4, 4, 5, 5, 5, @@ -1150,7 +1128,7 @@ static const int8_t svq1_intra_codebook_8x4[3072] = { }; /* 6x16-entry codebook for intra-coded 8x8 vectors */ -static const int8_t svq1_intra_codebook_8x8[6144] = { +DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] = { 4, 4, 3, 2, 2, 1, 0, -1, 4, 3, 3, 2, 1, 0, -1, -1, 3, 3, 2, 2, 1, 0, -1, -2, 3, 2, 2, 1, 0, -1, -2, -3, 2, 2, 1, 0, -1, -1, -2, -3, 2, 1, 0, 0, -1, -2, -3, -4, @@ -1538,39 +1516,10 @@ static const int8_t svq1_intra_codebook_8x8[6144] = { }; /* list of codebooks for intra-coded vectors */ -static const int8_t* const svq1_intra_codebooks[4] = { +const int8_t* const ff_svq1_intra_codebooks[6] = { svq1_intra_codebook_4x2, svq1_intra_codebook_4x4, - svq1_intra_codebook_8x4, svq1_intra_codebook_8x8 + svq1_intra_codebook_8x4, svq1_intra_codebook_8x8, + NULL, NULL, }; -static const int8_t svq1_intra_codebook_sum[4][16*6] = { - { - 0, 0, 0, -1, -1, -1, -1, -2, 0, -1, -1, 0, -1, 0, 1, 0, - 1, 0, -1, 1, 0, 0, -1, 1, -1, 0, 0, 0, -1, 1, 0, 0, - -1, 0, 0, 1, -1, 1, 0, -1, -1, 0, 1, 1, 0, 0, -1, 1, - 0, 1, 0, 0, 1, -1, 0, 0, 0, -1, 1, 0, 1, 0, -2, 1, - 0, -1, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0, - 0, 1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 1, 1, -1, - },{ - -1, -2, 0, -1, 1, 0, -1, 0, -1, -4, -1, -2, -1, -2, 1, -2, - 0, 0, 4, -2, -1, 1, 1, 0, 2, 1, 1, 0, 2, 0, 0, 0, - 1, 1, 0, -1, -1, -1, 1, 0, -1, -3, -3, 1, -1, 1, -2, -1, - 1, -1, 0, 1, 2, 1, -1, -1, 1, 1, 1, 2, 1, 0, 1, -2, - -2, 0, -1, -2, -2, 0, -1, -1, -1, 0, 1, 0, -1, -1, 0, -1, - 0, 2, 1, 2, 2, 1, -1, 1, 0, 2, 0, -1, 1, 0, 0, 0, - },{ - -2, 0, -1, -1, 1, 1, -2, 0, -2, 0, 1, -2, -2, 1, -1, -1, - 3, -2, 0, -3, -4, -3, 2, 1, 0, 3, -2, 2, 3, 2, 2, -1, - -3, 1, 0, 1, 0, 0, 0, 1, -2, 1, -2, -2, -1, -2, -2, 2, - 0, -4, 0, 2, -1, 0, 2, 2, 2, 1, 0, -1, -1, 1, -3, 2, - 2, 1, 0, 3, 1, -1, 1, 3, 1, 0, 1, 1, 2, -1, 1, -1, - -2, -1, 0, -1, 1, -1, 1, -2, -2, -1, -1, -3, 1, -4, -3, 1, - },{ - -2, 0, -2, 3, -1, -1, 0, 2, 2, -1, -3, 2, 1, 0, -2, -1, - -3, -2, -2, 1, 2, -3, 0, 1, -5, -2, -3, 0, -2, -1, 2, 0, - -1, -1, 0, -2, 1, 3, -7, -2, -2, -1, 2, -1, 0, 3, 1, 3, - 1, 0, 0, 1, 2, 3, 1, 2, 0, -2, -2, 1, 1, 2, 2, 3, - 4, 1, -1, 2, -2, 4, 0, 0, 0, 4, 2, 0, -2, -2, 2, -4, - -1, 5, -2, -2, -3, 2, -3, -1, 3, -3, 0, 4, 3, 0, 1, -2, - } -}; +#endif /* AVCODEC_SVQ1_CB_H */