mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit 'e63b818dbe6060b606ae10eb184859f8b97d2353'
* commit 'e63b818dbe6060b606ae10eb184859f8b97d2353': dv: Properly split decoder and encoder initialization Conflicts: libavcodec/dv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
3ac5114530
|
@ -235,7 +235,6 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const DVprofile *d)
|
||||||
av_cold int ff_dvvideo_init(AVCodecContext *avctx)
|
av_cold int ff_dvvideo_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
DVVideoContext *s = avctx->priv_data;
|
DVVideoContext *s = avctx->priv_data;
|
||||||
DSPContext dsp;
|
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
@ -292,30 +291,6 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
|
||||||
ff_free_vlc(&dv_vlc);
|
ff_free_vlc(&dv_vlc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic DSP setup */
|
|
||||||
memset(&dsp,0, sizeof(dsp));
|
|
||||||
ff_dsputil_init(&dsp, avctx);
|
|
||||||
ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp);
|
|
||||||
s->get_pixels = dsp.get_pixels;
|
|
||||||
s->ildct_cmp = dsp.ildct_cmp[5];
|
|
||||||
|
|
||||||
/* 88DCT setup */
|
|
||||||
s->fdct[0] = dsp.fdct;
|
|
||||||
s->idct_put[0] = dsp.idct_put;
|
|
||||||
for (i = 0; i < 64; i++)
|
|
||||||
s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]];
|
|
||||||
|
|
||||||
/* 248DCT setup */
|
|
||||||
s->fdct[1] = dsp.fdct248;
|
|
||||||
s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP
|
|
||||||
if (avctx->lowres){
|
|
||||||
for (i = 0; i < 64; i++){
|
|
||||||
int j = ff_dv_zigzag248_direct[i];
|
|
||||||
s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2];
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, sizeof(s->dv_zigzag[1]));
|
|
||||||
|
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
|
avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,32 @@ typedef struct BlockInfo {
|
||||||
|
|
||||||
static const int dv_iweight_bits = 14;
|
static const int dv_iweight_bits = 14;
|
||||||
|
|
||||||
|
static av_cold int dvvideo_decode_init(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
DVVideoContext *s = avctx->priv_data;
|
||||||
|
DSPContext dsp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
memset(&dsp,0, sizeof(dsp));
|
||||||
|
ff_dsputil_init(&dsp, avctx);
|
||||||
|
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]];
|
||||||
|
|
||||||
|
if (avctx->lowres){
|
||||||
|
for (i = 0; i < 64; i++){
|
||||||
|
int j = ff_dv_zigzag248_direct[i];
|
||||||
|
s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2];
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, sizeof(s->dv_zigzag[1]));
|
||||||
|
|
||||||
|
s->idct_put[0] = dsp.idct_put;
|
||||||
|
s->idct_put[1] = ff_simple_idct248_put;
|
||||||
|
|
||||||
|
return ff_dvvideo_init(avctx);
|
||||||
|
}
|
||||||
|
|
||||||
/* decode AC coefficients */
|
/* decode AC coefficients */
|
||||||
static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, int16_t *block)
|
static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, int16_t *block)
|
||||||
{
|
{
|
||||||
|
@ -385,7 +411,7 @@ AVCodec ff_dvvideo_decoder = {
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.id = AV_CODEC_ID_DVVIDEO,
|
.id = AV_CODEC_ID_DVVIDEO,
|
||||||
.priv_data_size = sizeof(DVVideoContext),
|
.priv_data_size = sizeof(DVVideoContext),
|
||||||
.init = ff_dvvideo_init,
|
.init = dvvideo_decode_init,
|
||||||
.decode = dvvideo_decode_frame,
|
.decode = dvvideo_decode_frame,
|
||||||
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
|
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
|
||||||
.max_lowres = 3,
|
.max_lowres = 3,
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
#include "dsputil.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "put_bits.h"
|
#include "put_bits.h"
|
||||||
#include "dv.h"
|
#include "dv.h"
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
|
static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
DVVideoContext *s = avctx->priv_data;
|
DVVideoContext *s = avctx->priv_data;
|
||||||
|
DSPContext dsp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
s->sys = avpriv_dv_codec_profile(avctx);
|
s->sys = avpriv_dv_codec_profile(avctx);
|
||||||
|
@ -62,6 +64,16 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
|
||||||
|
|
||||||
dv_vlc_map_tableinit();
|
dv_vlc_map_tableinit();
|
||||||
|
|
||||||
|
memset(&dsp,0, sizeof(dsp));
|
||||||
|
ff_dsputil_init(&dsp, avctx);
|
||||||
|
ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp);
|
||||||
|
|
||||||
|
s->get_pixels = dsp.get_pixels;
|
||||||
|
s->ildct_cmp = dsp.ildct_cmp[5];
|
||||||
|
|
||||||
|
s->fdct[0] = dsp.fdct;
|
||||||
|
s->fdct[1] = dsp.fdct248;
|
||||||
|
|
||||||
return ff_dvvideo_init(avctx);
|
return ff_dvvideo_init(avctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue