1/* 2 * This file is part of FFmpeg. 3 * 4 * FFmpeg is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * FFmpeg is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with FFmpeg; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19#ifndef AVCODEC_IDCTDSP_H 20#define AVCODEC_IDCTDSP_H 21 22#include <stdint.h> 23 24#include "avcodec.h" 25 26/** 27 * Scantable. 28 */ 29typedef struct ScanTable { 30 const uint8_t *scantable; 31 uint8_t permutated[64]; 32 uint8_t raster_end[64]; 33} ScanTable; 34 35void ff_init_scantable(uint8_t *permutation, ScanTable *st, 36 const uint8_t *src_scantable); 37void ff_init_scantable_permutation(uint8_t *idct_permutation, 38 int idct_permutation_type); 39int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, 40 int idct_permutation_type); 41 42typedef struct IDCTDSPContext { 43 /* pixel ops : interface with DCT */ 44 void (*put_pixels_clamped)(const int16_t *block /* align 16 */, 45 uint8_t *pixels /* align 8 */, 46 int line_size); 47 void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */, 48 uint8_t *pixels /* align 8 */, 49 int line_size); 50 void (*add_pixels_clamped)(const int16_t *block /* align 16 */, 51 uint8_t *pixels /* align 8 */, 52 int line_size); 53 54 void (*idct)(int16_t *block /* align 16 */); 55 56 /** 57 * block -> idct -> clip to unsigned 8 bit -> dest. 58 * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...) 59 * @param line_size size in bytes of a horizontal line of dest 60 */ 61 void (*idct_put)(uint8_t *dest /* align 8 */, 62 int line_size, int16_t *block /* align 16 */); 63 64 /** 65 * block -> idct -> add dest -> clip to unsigned 8 bit -> dest. 66 * @param line_size size in bytes of a horizontal line of dest 67 */ 68 void (*idct_add)(uint8_t *dest /* align 8 */, 69 int line_size, int16_t *block /* align 16 */); 70 71 /** 72 * IDCT input permutation. 73 * Several optimized IDCTs need a permutated input (relative to the 74 * normal order of the reference IDCT). 75 * This permutation must be performed before the idct_put/add. 76 * Note, normally this can be merged with the zigzag/alternate scan<br> 77 * An example to avoid confusion: 78 * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) 79 * - (x -> reference DCT -> reference IDCT -> x) 80 * - (x -> reference DCT -> simple_mmx_perm = idct_permutation 81 * -> simple_idct_mmx -> x) 82 * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant 83 * -> simple_idct_mmx -> ...) 84 */ 85 uint8_t idct_permutation[64]; 86 int idct_permutation_type; 87#define FF_NO_IDCT_PERM 1 88#define FF_LIBMPEG2_IDCT_PERM 2 89#define FF_SIMPLE_IDCT_PERM 3 90#define FF_TRANSPOSE_IDCT_PERM 4 91#define FF_PARTTRANS_IDCT_PERM 5 92#define FF_SSE2_IDCT_PERM 6 93} IDCTDSPContext; 94 95void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx); 96 97void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx, 98 unsigned high_bit_depth); 99void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, 100 unsigned high_bit_depth); 101void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx, 102 unsigned high_bit_depth); 103void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx, 104 unsigned high_bit_depth); 105 106#endif /* AVCODEC_IDCTDSP_H */ 107