2007-11-09 22:37:48 +01:00
|
|
|
/*
|
2011-03-18 18:35:10 +01:00
|
|
|
* This file is part of Libav.
|
2007-11-09 22:37:48 +01:00
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2007-11-09 22:37:48 +01:00
|
|
|
* 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.
|
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2007-11-09 22:37:48 +01:00
|
|
|
* 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
|
2011-03-18 18:35:10 +01:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2007-11-09 22:37:48 +01:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2008-08-31 09:39:47 +02:00
|
|
|
#ifndef AVCODEC_INTRAX8_H
|
|
|
|
#define AVCODEC_INTRAX8_H
|
2007-11-10 00:12:31 +01:00
|
|
|
|
2016-02-20 06:46:49 +01:00
|
|
|
#include "blockdsp.h"
|
2009-04-13 18:20:26 +02:00
|
|
|
#include "get_bits.h"
|
2007-11-24 11:08:02 +01:00
|
|
|
#include "mpegvideo.h"
|
2016-02-20 00:12:06 +01:00
|
|
|
#include "idctdsp.h"
|
2012-08-25 15:35:52 +02:00
|
|
|
#include "intrax8dsp.h"
|
2016-02-20 02:33:12 +01:00
|
|
|
#include "mpegpicture.h"
|
2007-11-24 11:08:02 +01:00
|
|
|
|
2012-09-27 10:19:53 +02:00
|
|
|
typedef struct IntraX8Context {
|
2016-02-24 23:45:11 +01: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 22:37:48 +01:00
|
|
|
|
|
|
|
int use_quant_matrix;
|
2016-02-24 23:45:11 +01:00
|
|
|
|
|
|
|
// set by ff_intrax8_common_init
|
|
|
|
uint8_t *prediction_table; // 2 * (mb_w * 2)
|
2007-11-09 22:37:48 +01:00
|
|
|
ScanTable scantable[3];
|
2016-02-20 06:43:22 +01:00
|
|
|
AVCodecContext *avctx;
|
2016-02-24 23:45:11 +01:00
|
|
|
|
|
|
|
// set by the caller codec
|
|
|
|
MpegEncContext *s;
|
2012-08-25 15:35:52 +02:00
|
|
|
IntraX8DSPContext dsp;
|
2016-02-20 00:12:06 +01:00
|
|
|
IDCTDSPContext idsp;
|
2016-02-20 06:46:49 +01:00
|
|
|
BlockDSPContext bdsp;
|
2007-11-09 22:37:48 +01:00
|
|
|
int quant;
|
|
|
|
int dquant;
|
|
|
|
int qsum;
|
2016-02-20 01:59:51 +01:00
|
|
|
int loopfilter;
|
2016-02-20 02:33:12 +01:00
|
|
|
AVFrame *frame;
|
2016-02-20 06:23:48 +01:00
|
|
|
GetBitContext *gb;
|
2016-02-24 23:45:11 +01:00
|
|
|
|
|
|
|
// calculated per frame
|
2007-11-09 22:37:48 +01:00
|
|
|
int quant_dc_chroma;
|
|
|
|
int divide_quant_dc_luma;
|
|
|
|
int divide_quant_dc_chroma;
|
2016-02-20 02:18:49 +01:00
|
|
|
uint8_t *dest[3];
|
2016-02-20 02:50:00 +01:00
|
|
|
uint8_t scratchpad[42]; // size of the block is fixed (8x8 plus padding)
|
2016-02-24 23:45:11 +01:00
|
|
|
|
|
|
|
// changed per block
|
2007-11-09 22:37:48 +01:00
|
|
|
int edges;
|
|
|
|
int flat_dc;
|
|
|
|
int predicted_dc;
|
|
|
|
int raw_orient;
|
|
|
|
int chroma_orient;
|
|
|
|
int orient;
|
|
|
|
int est_run;
|
2016-02-20 07:09:40 +01:00
|
|
|
|
|
|
|
// block props
|
|
|
|
int mb_x, mb_y;
|
|
|
|
int mb_width, mb_height;
|
2007-11-09 22:37:48 +01:00
|
|
|
} IntraX8Context;
|
|
|
|
|
2016-02-20 07:34:18 +01:00
|
|
|
/**
|
|
|
|
* Initialize IntraX8 frame decoder.
|
|
|
|
* Requires valid MpegEncContext with valid s->mb_width before calling.
|
2016-02-20 06:43:22 +01:00
|
|
|
* @param avctx pointer to AVCodecContext
|
2016-02-20 07:34:18 +01:00
|
|
|
* @param w pointer to IntraX8Context
|
2016-02-20 00:12:06 +01:00
|
|
|
* @param idsp pointer to IDCTDSPContext
|
2016-02-20 07:09:40 +01:00
|
|
|
* @param mb_width macroblock width
|
|
|
|
* @param mb_height macroblock height
|
2016-02-20 07:34:18 +01:00
|
|
|
* @param s pointer to MpegEncContext of the parent codec
|
2016-02-19 23:37:11 +01:00
|
|
|
* @return 0 on success, a negative AVERROR value on error
|
2016-02-20 07:34:18 +01:00
|
|
|
*/
|
2016-02-20 06:43:22 +01:00
|
|
|
int ff_intrax8_common_init(AVCodecContext *avctx,
|
|
|
|
IntraX8Context *w, IDCTDSPContext *idsp,
|
2016-02-20 07:09:40 +01:00
|
|
|
int mb_width, int mb_height,
|
2016-02-20 00:12:06 +01:00
|
|
|
MpegEncContext *const s);
|
2016-02-20 07:34:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy IntraX8 frame structure.
|
|
|
|
* @param w pointer to IntraX8Context
|
|
|
|
*/
|
2016-02-24 23:45:11 +01:00
|
|
|
void ff_intrax8_common_end(IntraX8Context *w);
|
2016-02-20 07:34:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decode single IntraX8 frame.
|
|
|
|
* The parent codec must call ff_mpv_frame_start() before calling this function.
|
|
|
|
* The parent codec must call ff_mpv_frame_end() after calling this function.
|
|
|
|
* This function does not use ff_mpv_decode_mb().
|
|
|
|
* @param w pointer to IntraX8Context
|
2016-02-20 02:33:12 +01:00
|
|
|
* @param pict the output Picture containing an AVFrame
|
2016-02-20 06:23:48 +01:00
|
|
|
* @param gb open bitstream reader
|
2016-02-26 06:04:36 +01: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 07:34:18 +01: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 01:59:51 +01:00
|
|
|
* @param loopfilter enable filter after decoding a block
|
2016-02-20 07:34:18 +01:00
|
|
|
*/
|
2016-02-20 02:33:12 +01:00
|
|
|
int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict,
|
2016-02-26 06:04:36 +01:00
|
|
|
GetBitContext *gb, int *mb_x, int *mb_y,
|
2016-02-20 02:33:12 +01:00
|
|
|
int quant, int halfpq, int loopfilter);
|
2007-11-10 00:12:31 +01:00
|
|
|
|
2008-08-31 09:39:47 +02:00
|
|
|
#endif /* AVCODEC_INTRAX8_H */
|