2007-11-09 23:37:48 +02:00
|
|
|
/*
|
2011-03-18 19:35:10 +02:00
|
|
|
* This file is part of Libav.
|
2007-11-09 23:37:48 +02:00
|
|
|
*
|
2011-03-18 19:35:10 +02:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2007-11-09 23:37:48 +02: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 19:35:10 +02:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2007-11-09 23:37:48 +02: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 19:35:10 +02:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2007-11-09 23:37:48 +02:00
|
|
|
* 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"
|
2007-11-24 12:08:02 +02:00
|
|
|
#include "mpegvideo.h"
|
2016-02-20 01:12:06 +02:00
|
|
|
#include "idctdsp.h"
|
2012-08-25 16:35:52 +03:00
|
|
|
#include "intrax8dsp.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];
|
2016-02-20 07:43:22 +02:00
|
|
|
AVCodecContext *avctx;
|
2016-02-25 00:45:11 +02:00
|
|
|
|
|
|
|
// set by the caller codec
|
|
|
|
MpegEncContext *s;
|
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;
|
|
|
|
} IntraX8Context;
|
|
|
|
|
2016-02-20 08:34:18 +02:00
|
|
|
/**
|
|
|
|
* Initialize IntraX8 frame decoder.
|
|
|
|
* Requires valid MpegEncContext with valid s->mb_width before calling.
|
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:34:18 +02:00
|
|
|
* @param s pointer to MpegEncContext of the parent codec
|
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 01:12:06 +02:00
|
|
|
MpegEncContext *const s);
|
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.
|
|
|
|
* 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 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-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-20 07:23:48 +02:00
|
|
|
GetBitContext *gb,
|
2016-02-20 03:33:12 +02:00
|
|
|
int quant, int halfpq, int loopfilter);
|
2007-11-10 01:12:31 +02:00
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVCODEC_INTRAX8_H */
|