2007-11-09 23:37:48 +02:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#ifndef AVCODEC_INTRAX8_H
|
|
|
|
#define AVCODEC_INTRAX8_H
|
2007-11-10 01:12:31 +02:00
|
|
|
|
2016-02-20 07:46:49 +02:00
|
|
|
#include "blockdsp.h"
|
2009-04-13 19:20:26 +03:00
|
|
|
#include "get_bits.h"
|
2016-02-20 01:12:06 +02:00
|
|
|
#include "idctdsp.h"
|
2012-08-25 16:35:52 +03:00
|
|
|
#include "intrax8dsp.h"
|
2013-04-26 23:45:38 +03:00
|
|
|
#include "wmv2dsp.h"
|
2016-02-20 03:33:12 +02:00
|
|
|
#include "mpegpicture.h"
|
2007-11-24 12:08:02 +02:00
|
|
|
|
2012-09-27 11:19:53 +03:00
|
|
|
typedef struct IntraX8Context {
|
2016-02-25 00:45:11 +02:00
|
|
|
VLC *j_ac_vlc[4]; // they point to the static j_mb_vlc
|
|
|
|
VLC *j_orient_vlc;
|
|
|
|
VLC *j_dc_vlc[3];
|
2007-11-09 23:37:48 +02:00
|
|
|
|
|
|
|
int use_quant_matrix;
|
2016-02-25 00:45:11 +02:00
|
|
|
|
|
|
|
// set by ff_intrax8_common_init
|
|
|
|
uint8_t *prediction_table; // 2 * (mb_w * 2)
|
2007-11-09 23:37:48 +02:00
|
|
|
ScanTable scantable[3];
|
2013-04-26 23:45:38 +03:00
|
|
|
WMV2DSPContext wdsp;
|
|
|
|
uint8_t idct_permutation[64];
|
2016-02-20 07:43:22 +02:00
|
|
|
AVCodecContext *avctx;
|
2016-02-20 08:57:47 +02:00
|
|
|
int *block_last_index; ///< last nonzero coefficient in block
|
|
|
|
int16_t (*block)[64];
|
2016-02-25 00:45:11 +02:00
|
|
|
|
|
|
|
// set by the caller codec
|
2012-08-25 16:35:52 +03:00
|
|
|
IntraX8DSPContext dsp;
|
2016-02-20 01:12:06 +02:00
|
|
|
IDCTDSPContext idsp;
|
2016-02-20 07:46:49 +02:00
|
|
|
BlockDSPContext bdsp;
|
2007-11-09 23:37:48 +02:00
|
|
|
int quant;
|
|
|
|
int dquant;
|
|
|
|
int qsum;
|
2016-02-20 02:59:51 +02:00
|
|
|
int loopfilter;
|
2016-02-20 03:33:12 +02:00
|
|
|
AVFrame *frame;
|
2016-02-20 07:23:48 +02:00
|
|
|
GetBitContext *gb;
|
2016-02-25 00:45:11 +02:00
|
|
|
|
|
|
|
// calculated per frame
|
2007-11-09 23:37:48 +02:00
|
|
|
int quant_dc_chroma;
|
|
|
|
int divide_quant_dc_luma;
|
|
|
|
int divide_quant_dc_chroma;
|
2016-02-20 03:18:49 +02:00
|
|
|
uint8_t *dest[3];
|
2016-02-20 03:50:00 +02:00
|
|
|
uint8_t scratchpad[42]; // size of the block is fixed (8x8 plus padding)
|
2016-02-25 00:45:11 +02:00
|
|
|
|
|
|
|
// changed per block
|
2007-11-09 23:37:48 +02:00
|
|
|
int edges;
|
|
|
|
int flat_dc;
|
|
|
|
int predicted_dc;
|
|
|
|
int raw_orient;
|
|
|
|
int chroma_orient;
|
|
|
|
int orient;
|
|
|
|
int est_run;
|
2016-02-20 08:09:40 +02:00
|
|
|
|
|
|
|
// block props
|
|
|
|
int mb_x, mb_y;
|
|
|
|
int mb_width, mb_height;
|
2007-11-09 23:37:48 +02:00
|
|
|
} IntraX8Context;
|
|
|
|
|
2016-02-20 08:34:18 +02:00
|
|
|
/**
|
|
|
|
* Initialize IntraX8 frame decoder.
|
2016-02-20 07:43:22 +02:00
|
|
|
* @param avctx pointer to AVCodecContext
|
2016-02-20 08:34:18 +02:00
|
|
|
* @param w pointer to IntraX8Context
|
2016-02-20 01:12:06 +02:00
|
|
|
* @param idsp pointer to IDCTDSPContext
|
2016-02-20 08:57:47 +02:00
|
|
|
* @param block pointer to block array
|
|
|
|
* @param block_last_index pointer to index array
|
2016-02-20 08:09:40 +02:00
|
|
|
* @param mb_width macroblock width
|
|
|
|
* @param mb_height macroblock height
|
2016-02-20 00:37:11 +02:00
|
|
|
* @return 0 on success, a negative AVERROR value on error
|
2016-02-20 08:34:18 +02:00
|
|
|
*/
|
2016-02-20 07:43:22 +02:00
|
|
|
int ff_intrax8_common_init(AVCodecContext *avctx,
|
|
|
|
IntraX8Context *w, IDCTDSPContext *idsp,
|
2016-02-20 08:57:47 +02:00
|
|
|
int16_t (*block)[64],
|
|
|
|
int block_last_index[12],
|
2016-02-20 09:29:43 +02:00
|
|
|
int mb_width, int mb_height);
|
2016-02-20 08:34:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy IntraX8 frame structure.
|
|
|
|
* @param w pointer to IntraX8Context
|
|
|
|
*/
|
2016-02-25 00:45:11 +02:00
|
|
|
void ff_intrax8_common_end(IntraX8Context *w);
|
2016-02-20 08:34:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decode single IntraX8 frame.
|
2016-04-17 20:30:01 +02:00
|
|
|
* lowres decoding is theoretically impossible.
|
2016-02-20 08:34:18 +02:00
|
|
|
* @param w pointer to IntraX8Context
|
2016-02-20 03:33:12 +02:00
|
|
|
* @param pict the output Picture containing an AVFrame
|
2016-02-20 07:23:48 +02:00
|
|
|
* @param gb open bitstream reader
|
2016-02-26 07:04:36 +02:00
|
|
|
* @param mb_x pointer to the x coordinate of the current macroblock
|
|
|
|
* @param mb_y pointer to the y coordinate of the current macroblock
|
2016-02-20 08:34:18 +02:00
|
|
|
* @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
|
|
|
|
* @param quant_offset offset away from zero
|
2016-02-20 02:59:51 +02:00
|
|
|
* @param loopfilter enable filter after decoding a block
|
2016-02-20 08:34:18 +02:00
|
|
|
*/
|
2016-02-20 03:33:12 +02:00
|
|
|
int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict,
|
2016-02-26 07:04:36 +02:00
|
|
|
GetBitContext *gb, int *mb_x, int *mb_y,
|
2016-02-20 08:25:03 +02:00
|
|
|
int quant, int halfpq,
|
|
|
|
int loopfilter, int lowdelay);
|
2007-11-10 01:12:31 +02:00
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVCODEC_INTRAX8_H */
|