Commit 6efb6988 authored by Mans Rullgard's avatar Mans Rullgard

cavsdsp: set idct permutation independently of dsputil

CAVS uses its own idct so using dsputil to set the permutation
is fragile.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 5fe64d88
...@@ -915,9 +915,10 @@ static int decode_pic(AVSContext *h) { ...@@ -915,9 +915,10 @@ static int decode_pic(AVSContext *h) {
enum cavs_mb mb_type; enum cavs_mb mb_type;
if (!s->context_initialized) { if (!s->context_initialized) {
s->avctx->idct_algo = FF_IDCT_CAVS;
if (ff_MPV_common_init(s) < 0) if (ff_MPV_common_init(s) < 0)
return -1; return -1;
ff_init_scantable_permutation(s->dsp.idct_permutation,
h->cdsp.idct_perm);
ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct); ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct);
} }
skip_bits(&s->gb,16);//bbv_dwlay skip_bits(&s->gb,16);//bbv_dwlay
......
...@@ -544,6 +544,7 @@ av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) { ...@@ -544,6 +544,7 @@ av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) {
c->cavs_filter_cv = cavs_filter_cv_c; c->cavs_filter_cv = cavs_filter_cv_c;
c->cavs_filter_ch = cavs_filter_ch_c; c->cavs_filter_ch = cavs_filter_ch_c;
c->cavs_idct8_add = cavs_idct8_add_c; c->cavs_idct8_add = cavs_idct8_add_c;
c->idct_perm = FF_NO_IDCT_PERM;
if (HAVE_MMX) ff_cavsdsp_init_mmx(c, avctx); if (HAVE_MMX) ff_cavsdsp_init_mmx(c, avctx);
} }
...@@ -33,6 +33,7 @@ typedef struct CAVSDSPContext { ...@@ -33,6 +33,7 @@ typedef struct CAVSDSPContext {
void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride);
int idct_perm;
} CAVSDSPContext; } CAVSDSPContext;
void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx); void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx);
......
...@@ -461,6 +461,7 @@ static void ff_cavsdsp_init_mmx2(CAVSDSPContext* c, AVCodecContext *avctx) { ...@@ -461,6 +461,7 @@ static void ff_cavsdsp_init_mmx2(CAVSDSPContext* c, AVCodecContext *avctx) {
dspfunc(avg_cavs_qpel, 1, 8); dspfunc(avg_cavs_qpel, 1, 8);
#undef dspfunc #undef dspfunc
c->cavs_idct8_add = cavs_idct8_add_mmx; c->cavs_idct8_add = cavs_idct8_add_mmx;
c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
} }
static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) { static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) {
...@@ -477,6 +478,7 @@ static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) { ...@@ -477,6 +478,7 @@ static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) {
dspfunc(avg_cavs_qpel, 1, 8); dspfunc(avg_cavs_qpel, 1, 8);
#undef dspfunc #undef dspfunc
c->cavs_idct8_add = cavs_idct8_add_mmx; c->cavs_idct8_add = cavs_idct8_add_mmx;
c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
} }
#endif /* HAVE_INLINE_ASM */ #endif /* HAVE_INLINE_ASM */
......
...@@ -3021,8 +3021,6 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx) ...@@ -3021,8 +3021,6 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
c->idct_add = ff_simple_idct_add_mmx; c->idct_add = ff_simple_idct_add_mmx;
c->idct = ff_simple_idct_mmx; c->idct = ff_simple_idct_mmx;
c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_CAVS) {
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_XVIDMMX) { } else if (idct_algo == FF_IDCT_XVIDMMX) {
if (mm_flags & AV_CPU_FLAG_SSE2) { if (mm_flags & AV_CPU_FLAG_SSE2) {
c->idct_put = ff_idct_xvid_sse2_put; c->idct_put = ff_idct_xvid_sse2_put;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment