History

dsputil: Split off *_8x8basis to a separate context

Diego Biurrun committed 12 years ago

Commit 8d686ca1 parent a7985cf11 files · +245 −125Browse files

Unified · Split

11 files
  1. libavcodec/Makefile +2 −1
  2. libavcodec/dsputil.c +0 −32
  3. libavcodec/dsputil.h +0 −6
  4. libavcodec/mpegvideo.h +2 −0
  5. libavcodec/mpegvideo_enc.c +8 −5
  6. libavcodec/mpegvideoencdsp.c +64 −0
  7. libavcodec/mpegvideoencdsp.h +41 −0
  8. libavcodec/x86/Makefile +2 −1
  9. libavcodec/x86/dsputilenc_mmx.c +0 −79
  10. libavcodec/x86/mpegvideoenc_qns_template.c +1 −1
  11. libavcodec/x86/mpegvideoencdsp_init.c +125 −0
libavcodec/Makefile+2−1
@@ -67,7 +67,8 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ · 66 unmodified lines
67OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o \67OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o \
68 mpegvideo_motion.o mpegutils.o68 mpegvideo_motion.o mpegutils.o
69OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \69OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
70 motion_est.o ratecontrol.o70 motion_est.o ratecontrol.o \
71 mpegvideoencdsp.o
71OBJS-$(CONFIG_QPELDSP) += qpeldsp.o72OBJS-$(CONFIG_QPELDSP) += qpeldsp.o
72OBJS-$(CONFIG_RANGECODER) += rangecoder.o73OBJS-$(CONFIG_RANGECODER) += rangecoder.o
73RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o74RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
libavcodec/dsputil.c+0−32
@@ -464,35 +464,6 @@ static int nsse8_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, int stride, int · 463 unmodified lines
464 return score1 + FFABS(score2) * 8;464 return score1 + FFABS(score2) * 8;
465}465}
466 466
467static int try_8x8basis_c(int16_t rem[64], int16_t weight[64],
468 int16_t basis[64], int scale)
469{
470 int i;
471 unsigned int sum = 0;
472
473 for (i = 0; i < 8 * 8; i++) {
474 int b = rem[i] + ((basis[i] * scale +
475 (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >>
476 (BASIS_SHIFT - RECON_SHIFT));
477 int w = weight[i];
478 b >>= RECON_SHIFT;
479 assert(-512 < b && b < 512);
480
481 sum += (w * b) * (w * b) >> 4;
482 }
483 return sum >> 2;
484}
485
486static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale)
487{
488 int i;
489
490 for (i = 0; i < 8 * 8; i++)
491 rem[i] += (basis[i] * scale +
492 (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >>
493 (BASIS_SHIFT - RECON_SHIFT);
494}
495
496static int zero_cmp(MpegEncContext *s, uint8_t *a, uint8_t *b,467static int zero_cmp(MpegEncContext *s, uint8_t *a, uint8_t *b,
497 int stride, int h)468 int stride, int h)
498{469{
@@ -1126,9 +1097,6 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx) · 627 unmodified lines
1126 c->nsse[0] = nsse16_c;1097 c->nsse[0] = nsse16_c;
1127 c->nsse[1] = nsse8_c;1098 c->nsse[1] = nsse8_c;
1128 1099
1129 c->try_8x8basis = try_8x8basis_c;
1130 c->add_8x8basis = add_8x8basis_c;
1131
1132 c->shrink[0] = av_image_copy_plane;1100 c->shrink[0] = av_image_copy_plane;
1133 c->shrink[1] = ff_shrink22;1101 c->shrink[1] = ff_shrink22;
1134 c->shrink[2] = ff_shrink44;1102 c->shrink[2] = ff_shrink44;
libavcodec/dsputil.h+0−6
@@ -87,12 +87,6 @@ typedef struct DSPContext { · 86 unmodified lines
87 void (*fdct)(int16_t *block /* align 16 */);87 void (*fdct)(int16_t *block /* align 16 */);
88 void (*fdct248)(int16_t *block /* align 16 */);88 void (*fdct248)(int16_t *block /* align 16 */);
89 89
90 int (*try_8x8basis)(int16_t rem[64], int16_t weight[64],
91 int16_t basis[64], int scale);
92 void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
93#define BASIS_SHIFT 16
94#define RECON_SHIFT 6
95
96 void (*draw_edges)(uint8_t *buf, int wrap, int width, int height,90 void (*draw_edges)(uint8_t *buf, int wrap, int width, int height,
97 int w, int h, int sides);91 int w, int h, int sides);
98#define EDGE_WIDTH 1692#define EDGE_WIDTH 16
libavcodec/mpegvideo.h+2−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
37#include "hpeldsp.h"37#include "hpeldsp.h"
38#include "idctdsp.h"38#include "idctdsp.h"
39#include "mpegvideodsp.h"39#include "mpegvideodsp.h"
40#include "mpegvideoencdsp.h"
40#include "put_bits.h"41#include "put_bits.h"
41#include "ratecontrol.h"42#include "ratecontrol.h"
42#include "parser.h"43#include "parser.h"
@@ -355,6 +356,7 @@ typedef struct MpegEncContext { · 312 unmodified lines
355 HpelDSPContext hdsp;356 HpelDSPContext hdsp;
356 IDCTDSPContext idsp;357 IDCTDSPContext idsp;
357 MpegVideoDSPContext mdsp;358 MpegVideoDSPContext mdsp;
359 MpegvideoEncDSPContext mpvencdsp;
358 QpelDSPContext qdsp;360 QpelDSPContext qdsp;
359 VideoDSPContext vdsp;361 VideoDSPContext vdsp;
360 H263DSPContext h263dsp;362 H263DSPContext h263dsp;
libavcodec/mpegvideo_enc.c+8−5
@@ -701,6 +701,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) · 700 unmodified lines
701 if (ARCH_X86)701 if (ARCH_X86)
702 ff_MPV_encode_init_x86(s);702 ff_MPV_encode_init_x86(s);
703 703
704 ff_mpegvideoencdsp_init(&s->mpvencdsp, avctx);
704 ff_qpeldsp_init(&s->qdsp);705 ff_qpeldsp_init(&s->qdsp);
705 706
706 s->avctx->coded_frame = s->current_picture.f;707 s->avctx->coded_frame = s->current_picture.f;
@@ -3871,7 +3872,7 @@ STOP_TIMER("memset rem[]")} · 3164 unmodified lines
3871 run_tab[rle_index++]=run;3872 run_tab[rle_index++]=run;
3872 run=0;3873 run=0;
3873 3874
3874 s->dsp.add_8x8basis(rem, basis[j], coeff);3875 s->mpvencdsp.add_8x8basis(rem, basis[j], coeff);
3875 }else{3876 }else{
3876 run++;3877 run++;
3877 }3878 }
@@ -3885,7 +3886,7 @@ STOP_TIMER("init rem[]") · 7 unmodified lines
3885{START_TIMER3886{START_TIMER
3886#endif3887#endif
3887 for(;;){3888 for(;;){
3888 int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0);3889 int best_score = s->mpvencdsp.try_8x8basis(rem, weight, basis[0], 0);
3889 int best_coeff=0;3890 int best_coeff=0;
3890 int best_change=0;3891 int best_change=0;
3891 int run2, best_unquant_change=0, analyze_gradient;3892 int run2, best_unquant_change=0, analyze_gradient;
@@ -3929,7 +3930,8 @@ STOP_TIMER("dct")} · 37 unmodified lines
3929 if(new_coeff >= 2048 || new_coeff < 0)3930 if(new_coeff >= 2048 || new_coeff < 0)
3930 continue;3931 continue;
3931 3932
3932 score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff);3933 score = s->mpvencdsp.try_8x8basis(rem, weight, basis[0],
3934 new_coeff - old_coeff);
3933 if(score<best_score){3935 if(score<best_score){
3934 best_score= score;3936 best_score= score;
3935 best_coeff= 0;3937 best_coeff= 0;
@@ -4052,7 +4054,8 @@ STOP_TIMER("dct")} · 116 unmodified lines
4052 unquant_change= new_coeff - old_coeff;4054 unquant_change= new_coeff - old_coeff;
4053 assert((score < 100*lambda && score > -100*lambda) || lambda==0);4055 assert((score < 100*lambda && score > -100*lambda) || lambda==0);
4054 4056
4055 score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change);4057 score += s->mpvencdsp.try_8x8basis(rem, weight, basis[j],
4058 unquant_change);
4056 if(score<best_score){4059 if(score<best_score){
4057 best_score= score;4060 best_score= score;
4058 best_coeff= i;4061 best_coeff= i;
@@ -4126,7 +4129,7 @@ if(256*256*256*64 % count == 0){ · 67 unmodified lines
4126 }4129 }
4127 }4130 }
4128 4131
4129 s->dsp.add_8x8basis(rem, basis[j], best_unquant_change);4132 s->mpvencdsp.add_8x8basis(rem, basis[j], best_unquant_change);
4130 }else{4133 }else{
4131 break;4134 break;
4132 }4135 }
libavcodec/mpegvideoencdsp.c+64−0
@@ -0,0 +1,64 @@
1/*
2 * This file is part of Libav.
3 *
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <assert.h>
20#include <stdint.h>
21
22#include "config.h"
23#include "libavutil/attributes.h"
24#include "avcodec.h"
25#include "mpegvideoencdsp.h"
26
27static int try_8x8basis_c(int16_t rem[64], int16_t weight[64],
28 int16_t basis[64], int scale)
29{
30 int i;
31 unsigned int sum = 0;
32
33 for (i = 0; i < 8 * 8; i++) {
34 int b = rem[i] + ((basis[i] * scale +
35 (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >>
36 (BASIS_SHIFT - RECON_SHIFT));
37 int w = weight[i];
38 b >>= RECON_SHIFT;
39 assert(-512 < b && b < 512);
40
41 sum += (w * b) * (w * b) >> 4;
42 }
43 return sum >> 2;
44}
45
46static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale)
47{
48 int i;
49
50 for (i = 0; i < 8 * 8; i++)
51 rem[i] += (basis[i] * scale +
52 (1 << (BASIS_SHIFT - RECON_SHIFT - 1))) >>
53 (BASIS_SHIFT - RECON_SHIFT);
54}
55
56av_cold void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c,
57 AVCodecContext *avctx)
58{
59 c->try_8x8basis = try_8x8basis_c;
60 c->add_8x8basis = add_8x8basis_c;
61
62 if (ARCH_X86)
63 ff_mpegvideoencdsp_init_x86(c, avctx);
64}
libavcodec/mpegvideoencdsp.h+41−0
@@ -0,0 +1,41 @@
1/*
2 * This file is part of Libav.
3 *
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVCODEC_MPEGVIDEOENCDSP_H
20#define AVCODEC_MPEGVIDEOENCDSP_H
21
22#include <stdint.h>
23
24#include "avcodec.h"
25
26#define BASIS_SHIFT 16
27#define RECON_SHIFT 6
28
29typedef struct MpegvideoEncDSPContext {
30 int (*try_8x8basis)(int16_t rem[64], int16_t weight[64],
31 int16_t basis[64], int scale);
32 void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
33
34} MpegvideoEncDSPContext;
35
36void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c,
37 AVCodecContext *avctx);
38void ff_mpegvideoencdsp_init_x86(MpegvideoEncDSPContext *c,
39 AVCodecContext *avctx);
40
41#endif /* AVCODEC_MPEGVIDEOENCDSP_H */
libavcodec/x86/Makefile+2−1
@@ -23,7 +23,8 @@ OBJS-$(CONFIG_LPC) += x86/lpc.o · 22 unmodified lines
23OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o23OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o
24OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \24OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \
25 x86/mpegvideodsp.o25 x86/mpegvideodsp.o
26OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o26OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o \
27 x86/mpegvideoencdsp_init.o
27OBJS-$(CONFIG_QPELDSP) += x86/qpeldsp_init.o28OBJS-$(CONFIG_QPELDSP) += x86/qpeldsp_init.o
28OBJS-$(CONFIG_VIDEODSP) += x86/videodsp_init.o29OBJS-$(CONFIG_VIDEODSP) += x86/videodsp_init.o
29OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o30OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o
libavcodec/x86/dsputilenc_mmx.c+0−79
@@ -805,72 +805,6 @@ DCT_SAD_FUNC(ssse3) · 804 unmodified lines
805#undef HSUM805#undef HSUM
806#undef DCT_SAD806#undef DCT_SAD
807 807
808#define PHADDD(a, t) \
809 "movq " #a ", " #t " \n\t" \
810 "psrlq $32, " #a " \n\t" \
811 "paddd " #t ", " #a " \n\t"
812
813/*
814 * pmulhw: dst[0 - 15] = (src[0 - 15] * dst[0 - 15])[16 - 31]
815 * pmulhrw: dst[0 - 15] = (src[0 - 15] * dst[0 - 15] + 0x8000)[16 - 31]
816 * pmulhrsw: dst[0 - 15] = (src[0 - 15] * dst[0 - 15] + 0x4000)[15 - 30]
817 */
818#define PMULHRW(x, y, s, o) \
819 "pmulhw " #s ", " #x " \n\t" \
820 "pmulhw " #s ", " #y " \n\t" \
821 "paddw " #o ", " #x " \n\t" \
822 "paddw " #o ", " #y " \n\t" \
823 "psraw $1, " #x " \n\t" \
824 "psraw $1, " #y " \n\t"
825#define DEF(x) x ## _mmx
826#define SET_RND MOVQ_WONE
827#define SCALE_OFFSET 1
828
829#include "dsputil_qns_template.c"
830
831#undef DEF
832#undef SET_RND
833#undef SCALE_OFFSET
834#undef PMULHRW
835
836#define DEF(x) x ## _3dnow
837#define SET_RND(x)
838#define SCALE_OFFSET 0
839#define PMULHRW(x, y, s, o) \
840 "pmulhrw " #s ", " #x " \n\t" \
841 "pmulhrw " #s ", " #y " \n\t"
842
843#include "dsputil_qns_template.c"
844
845#undef DEF
846#undef SET_RND
847#undef SCALE_OFFSET
848#undef PMULHRW
849
850#if HAVE_SSSE3_INLINE
851#undef PHADDD
852#define DEF(x) x ## _ssse3
853#define SET_RND(x)
854#define SCALE_OFFSET -1
855
856#define PHADDD(a, t) \
857 "pshufw $0x0E, " #a ", " #t " \n\t" \
858 /* faster than phaddd on core2 */ \
859 "paddd " #t ", " #a " \n\t"
860
861#define PMULHRW(x, y, s, o) \
862 "pmulhrsw " #s ", " #x " \n\t" \
863 "pmulhrsw " #s ", " #y " \n\t"
864
865#include "dsputil_qns_template.c"
866
867#undef DEF
868#undef SET_RND
869#undef SCALE_OFFSET
870#undef PMULHRW
871#undef PHADDD
872#endif /* HAVE_SSSE3_INLINE */
873
874#endif /* HAVE_INLINE_ASM */808#endif /* HAVE_INLINE_ASM */
875 809
876int ff_sse16_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,810int ff_sse16_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
@@ -921,16 +855,7 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx, · 44 unmodified lines
921 c->nsse[1] = nsse8_mmx;855 c->nsse[1] = nsse8_mmx;
922 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {856 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
923 c->vsad[0] = vsad16_mmx;857 c->vsad[0] = vsad16_mmx;
924 c->try_8x8basis = try_8x8basis_mmx;
925 }
926 c->add_8x8basis = add_8x8basis_mmx;
927 }
928
929 if (INLINE_AMD3DNOW(cpu_flags)) {
930 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
931 c->try_8x8basis = try_8x8basis_3dnow;
932 }858 }
933 c->add_8x8basis = add_8x8basis_3dnow;
934 }859 }
935 860
936 if (INLINE_MMXEXT(cpu_flags)) {861 if (INLINE_MMXEXT(cpu_flags)) {
@@ -956,10 +881,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx, · 19 unmodified lines
956 881
957#if HAVE_SSSE3_INLINE882#if HAVE_SSSE3_INLINE
958 if (INLINE_SSSE3(cpu_flags)) {883 if (INLINE_SSSE3(cpu_flags)) {
959 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
960 c->try_8x8basis = try_8x8basis_ssse3;
961 }
962 c->add_8x8basis = add_8x8basis_ssse3;
963 c->sum_abs_dctelem = sum_abs_dctelem_ssse3;884 c->sum_abs_dctelem = sum_abs_dctelem_ssse3;
964 }885 }
965#endif886#endif
libavcodec/x86/mpegvideoenc_qns_template.crenamed from libavcodec/x86/dsputil_qns_template.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2 * DSP utils : QNS functions are compiled 3 times for mmx/3dnow/ssse32 * QNS functions are compiled 3 times for MMX/3DNOW/SSSE3
3 * Copyright (c) 2004 Michael Niedermayer3 * Copyright (c) 2004 Michael Niedermayer
4 *4 *
5 * MMX optimization by Michael Niedermayer <michaelni@gmx.at>5 * MMX optimization by Michael Niedermayer <michaelni@gmx.at>
libavcodec/x86/mpegvideoencdsp_init.c+125−0
@@ -0,0 +1,125 @@
1/*
2 * This file is part of Libav.
3 *
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "libavutil/attributes.h"
20#include "libavutil/cpu.h"
21#include "libavutil/x86/cpu.h"
22#include "libavcodec/avcodec.h"
23#include "libavcodec/mpegvideoencdsp.h"
24
25#if HAVE_INLINE_ASM
26
27#define PHADDD(a, t) \
28 "movq " #a ", " #t " \n\t" \
29 "psrlq $32, " #a " \n\t" \
30 "paddd " #t ", " #a " \n\t"
31
32/*
33 * pmulhw: dst[0 - 15] = (src[0 - 15] * dst[0 - 15])[16 - 31]
34 * pmulhrw: dst[0 - 15] = (src[0 - 15] * dst[0 - 15] + 0x8000)[16 - 31]
35 * pmulhrsw: dst[0 - 15] = (src[0 - 15] * dst[0 - 15] + 0x4000)[15 - 30]
36 */
37#define PMULHRW(x, y, s, o) \
38 "pmulhw " #s ", " #x " \n\t" \
39 "pmulhw " #s ", " #y " \n\t" \
40 "paddw " #o ", " #x " \n\t" \
41 "paddw " #o ", " #y " \n\t" \
42 "psraw $1, " #x " \n\t" \
43 "psraw $1, " #y " \n\t"
44#define DEF(x) x ## _mmx
45#define SET_RND MOVQ_WONE
46#define SCALE_OFFSET 1
47
48#include "mpegvideoenc_qns_template.c"
49
50#undef DEF
51#undef SET_RND
52#undef SCALE_OFFSET
53#undef PMULHRW
54
55#define DEF(x) x ## _3dnow
56#define SET_RND(x)
57#define SCALE_OFFSET 0
58#define PMULHRW(x, y, s, o) \
59 "pmulhrw " #s ", " #x " \n\t" \
60 "pmulhrw " #s ", " #y " \n\t"
61
62#include "mpegvideoenc_qns_template.c"
63
64#undef DEF
65#undef SET_RND
66#undef SCALE_OFFSET
67#undef PMULHRW
68
69#if HAVE_SSSE3_INLINE
70#undef PHADDD
71#define DEF(x) x ## _ssse3
72#define SET_RND(x)
73#define SCALE_OFFSET -1
74
75#define PHADDD(a, t) \
76 "pshufw $0x0E, " #a ", " #t " \n\t" \
77 /* faster than phaddd on core2 */ \
78 "paddd " #t ", " #a " \n\t"
79
80#define PMULHRW(x, y, s, o) \
81 "pmulhrsw " #s ", " #x " \n\t" \
82 "pmulhrsw " #s ", " #y " \n\t"
83
84#include "mpegvideoenc_qns_template.c"
85
86#undef DEF
87#undef SET_RND
88#undef SCALE_OFFSET
89#undef PMULHRW
90#undef PHADDD
91#endif /* HAVE_SSSE3_INLINE */
92
93#endif /* HAVE_INLINE_ASM */
94
95av_cold void ff_mpegvideoencdsp_init_x86(MpegvideoEncDSPContext *c,
96 AVCodecContext *avctx)
97{
98#if HAVE_INLINE_ASM
99 int cpu_flags = av_get_cpu_flags();
100
101 if (INLINE_MMX(cpu_flags)) {
102 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
103 c->try_8x8basis = try_8x8basis_mmx;
104 }
105 c->add_8x8basis = add_8x8basis_mmx;
106 }
107
108 if (INLINE_AMD3DNOW(cpu_flags)) {
109 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
110 c->try_8x8basis = try_8x8basis_3dnow;
111 }
112 c->add_8x8basis = add_8x8basis_3dnow;
113 }
114
115#if HAVE_SSSE3_INLINE
116 if (INLINE_SSSE3(cpu_flags)) {
117 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
118 c->try_8x8basis = try_8x8basis_ssse3;
119 }
120 c->add_8x8basis = add_8x8basis_ssse3;
121 }
122#endif /* HAVE_SSSE3_INLINE */
123
124#endif /* HAVE_INLINE_ASM */
125}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t