* commit 'e3fcb14347466095839c2a3c47ebecff02da891e': dsputil: Split off IDCT bits into their own context Conflicts: configure libavcodec/aic.c libavcodec/arm/Makefile libavcodec/arm/dsputil_init_arm.c libavcodec/arm/dsputil_init_armv6.c libavcodec/asvdec.c libavcodec/dnxhdenc.c libavcodec/dsputil.c libavcodec/dvdec.c libavcodec/dxva2_mpeg2.c libavcodec/intrax8.c libavcodec/mdec.c libavcodec/mjpegdec.c libavcodec/mjpegenc_common.h libavcodec/mpegvideo.c libavcodec/ppc/dsputil_altivec.h libavcodec/ppc/dsputil_ppc.c libavcodec/ppc/idctdsp.c libavcodec/x86/Makefile libavcodec/x86/dsputil_init.c libavcodec/x86/dsputil_mmx.c libavcodec/x86/dsputil_x86.h
Unified · Split
| @@ -1814,6 +1814,7 @@ CONFIG_EXTRA=" · 1813 unmodified lines | |||
| 1814 | huffman | 1814 | huffman |
| 1815 | huffyuvdsp | 1815 | huffyuvdsp |
| 1816 | huffyuvencdsp | 1816 | huffyuvencdsp |
| 1817 | idctdsp | ||
| 1817 | intrax8 | 1818 | intrax8 |
| 1818 | lgplv3 | 1819 | lgplv3 |
| 1819 | llauddsp | 1820 | llauddsp |
| @@ -1992,6 +1993,7 @@ threads_if_any="$THREADS_LIST" · 172 unmodified lines | |||
| 1992 | 1993 | ||
| 1993 | # subsystems | 1994 | # subsystems |
| 1994 | dct_select="rdft" | 1995 | dct_select="rdft" |
| 1996 | dsputil_select="idctdsp" | ||
| 1995 | error_resilience_select="dsputil" | 1997 | error_resilience_select="dsputil" |
| 1996 | frame_thread_encoder_deps="encoders threads" | 1998 | frame_thread_encoder_deps="encoders threads" |
| 1997 | intrax8_select="error_resilience" | 1999 | intrax8_select="error_resilience" |
| @@ -2000,7 +2002,7 @@ rdft_select="fft" · 2 unmodified lines | |||
| 2000 | mpeg_er_select="error_resilience" | 2002 | mpeg_er_select="error_resilience" |
| 2001 | mpegaudio_select="mpegaudiodsp" | 2003 | mpegaudio_select="mpegaudiodsp" |
| 2002 | mpegaudiodsp_select="dct" | 2004 | mpegaudiodsp_select="dct" |
| 2003 | mpegvideo_select="blockdsp dsputil h264chroma hpeldsp videodsp" | 2005 | mpegvideo_select="blockdsp dsputil h264chroma hpeldsp idctdsp videodsp" |
| 2004 | mpegvideoenc_select="dsputil mpegvideo qpeldsp" | 2006 | mpegvideoenc_select="dsputil mpegvideo qpeldsp" |
| 2005 | 2007 | ||
| 2006 | # decoders / encoders | 2008 | # decoders / encoders |
| @@ -2011,7 +2013,7 @@ ac3_decoder_select="ac3_parser ac3dsp bswapdsp mdct" · 4 unmodified lines | |||
| 2011 | ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct" | 2013 | ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct" |
| 2012 | ac3_encoder_select="ac3dsp audiodsp dsputil mdct" | 2014 | ac3_encoder_select="ac3dsp audiodsp dsputil mdct" |
| 2013 | ac3_fixed_encoder_select="ac3dsp audiodsp dsputil mdct" | 2015 | ac3_fixed_encoder_select="ac3dsp audiodsp dsputil mdct" |
| 2014 | aic_decoder_select="dsputil golomb" | 2016 | aic_decoder_select="golomb idctdsp" |
| 2015 | alac_encoder_select="lpc" | 2017 | alac_encoder_select="lpc" |
| 2016 | als_decoder_select="bswapdsp" | 2018 | als_decoder_select="bswapdsp" |
| 2017 | amrnb_decoder_select="lsp" | 2019 | amrnb_decoder_select="lsp" |
| @@ -2019,9 +2021,9 @@ amrwb_decoder_select="lsp" · 1 unmodified line | |||
| 2019 | amv_decoder_select="sp5x_decoder exif" | 2021 | amv_decoder_select="sp5x_decoder exif" |
| 2020 | amv_encoder_select="aandcttables" | 2022 | amv_encoder_select="aandcttables" |
| 2021 | ape_decoder_select="bswapdsp llauddsp" | 2023 | ape_decoder_select="bswapdsp llauddsp" |
| 2022 | asv1_decoder_select="blockdsp bswapdsp dsputil" | 2024 | asv1_decoder_select="blockdsp bswapdsp idctdsp" |
| 2023 | asv1_encoder_select="bswapdsp dsputil" | 2025 | asv1_encoder_select="bswapdsp dsputil" |
| 2024 | asv2_decoder_select="blockdsp bswapdsp dsputil" | 2026 | asv2_decoder_select="blockdsp bswapdsp idctdsp" |
| 2025 | asv2_encoder_select="bswapdsp dsputil" | 2027 | asv2_encoder_select="bswapdsp dsputil" |
| 2026 | atrac1_decoder_select="mdct sinewin" | 2028 | atrac1_decoder_select="mdct sinewin" |
| 2027 | atrac3_decoder_select="mdct" | 2029 | atrac3_decoder_select="mdct" |
| @@ -2030,7 +2032,7 @@ avrn_decoder_select="exif" · 2 unmodified lines | |||
| 2030 | bink_decoder_select="blockdsp hpeldsp" | 2032 | bink_decoder_select="blockdsp hpeldsp" |
| 2031 | binkaudio_dct_decoder_select="mdct rdft dct sinewin" | 2033 | binkaudio_dct_decoder_select="mdct rdft dct sinewin" |
| 2032 | binkaudio_rdft_decoder_select="mdct rdft sinewin" | 2034 | binkaudio_rdft_decoder_select="mdct rdft sinewin" |
| 2033 | cavs_decoder_select="blockdsp dsputil golomb h264chroma qpeldsp videodsp" | 2035 | cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp" |
| 2034 | cllc_decoder_select="bswapdsp" | 2036 | cllc_decoder_select="bswapdsp" |
| 2035 | comfortnoise_encoder_select="lpc" | 2037 | comfortnoise_encoder_select="lpc" |
| 2036 | cook_decoder_select="audiodsp mdct sinewin" | 2038 | cook_decoder_select="audiodsp mdct sinewin" |
| @@ -2038,16 +2040,16 @@ cscd_decoder_select="lzo" · 1 unmodified line | |||
| 2038 | cscd_decoder_suggest="zlib" | 2040 | cscd_decoder_suggest="zlib" |
| 2039 | dca_decoder_select="mdct" | 2041 | dca_decoder_select="mdct" |
| 2040 | dirac_decoder_select="dsputil dwt golomb videodsp" | 2042 | dirac_decoder_select="dsputil dwt golomb videodsp" |
| 2041 | dnxhd_decoder_select="blockdsp dsputil" | 2043 | dnxhd_decoder_select="blockdsp idctdsp" |
| 2042 | dnxhd_encoder_select="aandcttables blockdsp dsputil mpegvideoenc" | 2044 | dnxhd_encoder_select="aandcttables blockdsp dsputil idctdsp mpegvideoenc" |
| 2043 | dvvideo_decoder_select="dsputil" | 2045 | dvvideo_decoder_select="idctdsp" |
| 2044 | dvvideo_encoder_select="dsputil" | 2046 | dvvideo_encoder_select="dsputil" |
| 2045 | dxa_decoder_select="zlib" | 2047 | dxa_decoder_select="zlib" |
| 2046 | eac3_decoder_select="ac3_decoder" | 2048 | eac3_decoder_select="ac3_decoder" |
| 2047 | eac3_encoder_select="ac3_encoder" | 2049 | eac3_encoder_select="ac3_encoder" |
| 2048 | eamad_decoder_select="aandcttables blockdsp bswapdsp dsputil mpegvideo" | 2050 | eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo" |
| 2049 | eatgq_decoder_select="aandcttables" | 2051 | eatgq_decoder_select="aandcttables" |
| 2050 | eatqi_decoder_select="aandcttables blockdsp bswapdsp dsputil mpeg1video_decoder" | 2052 | eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpeg1video_decoder" |
| 2051 | exr_decoder_select="zlib" | 2053 | exr_decoder_select="zlib" |
| 2052 | ffv1_decoder_select="golomb rangecoder" | 2054 | ffv1_decoder_select="golomb rangecoder" |
| 2053 | ffv1_encoder_select="rangecoder" | 2055 | ffv1_encoder_select="rangecoder" |
| @@ -2064,7 +2066,7 @@ flv_decoder_select="h263_decoder" · 10 unmodified lines | |||
| 2064 | flv_encoder_select="h263_encoder" | 2066 | flv_encoder_select="h263_encoder" |
| 2065 | fourxm_decoder_select="blockdsp bswapdsp" | 2067 | fourxm_decoder_select="blockdsp bswapdsp" |
| 2066 | fraps_decoder_select="bswapdsp huffman" | 2068 | fraps_decoder_select="bswapdsp huffman" |
| 2067 | g2m_decoder_select="blockdsp dsputil zlib" | 2069 | g2m_decoder_select="blockdsp idctdsp zlib" |
| 2068 | g729_decoder_select="audiodsp" | 2070 | g729_decoder_select="audiodsp" |
| 2069 | h261_decoder_select="mpeg_er mpegvideo" | 2071 | h261_decoder_select="mpeg_er mpegvideo" |
| 2070 | h261_encoder_select="aandcttables mpegvideoenc" | 2072 | h261_encoder_select="aandcttables mpegvideoenc" |
| @@ -2085,12 +2087,12 @@ jpegls_decoder_select="golomb mjpeg_decoder" · 14 unmodified lines | |||
| 2085 | jpegls_encoder_select="golomb" | 2087 | jpegls_encoder_select="golomb" |
| 2086 | jv_decoder_select="blockdsp" | 2088 | jv_decoder_select="blockdsp" |
| 2087 | lagarith_decoder_select="huffyuvdsp" | 2089 | lagarith_decoder_select="huffyuvdsp" |
| 2088 | ljpeg_encoder_select="aandcttables dsputil" | 2090 | ljpeg_encoder_select="aandcttables idctdsp" |
| 2089 | loco_decoder_select="golomb" | 2091 | loco_decoder_select="golomb" |
| 2090 | mdec_decoder_select="blockdsp dsputil mpegvideo" | 2092 | mdec_decoder_select="blockdsp idctdsp mpegvideo" |
| 2091 | metasound_decoder_select="lsp mdct sinewin" | 2093 | metasound_decoder_select="lsp mdct sinewin" |
| 2092 | mimic_decoder_select="blockdsp bswapdsp dsputil hpeldsp" | 2094 | mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp" |
| 2093 | mjpeg_decoder_select="blockdsp dsputil hpeldsp exif" | 2095 | mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp" |
| 2094 | mjpeg_encoder_select="aandcttables mpegvideoenc" | 2096 | mjpeg_encoder_select="aandcttables mpegvideoenc" |
| 2095 | mjpegb_decoder_select="mjpeg_decoder" | 2097 | mjpegb_decoder_select="mjpeg_decoder" |
| 2096 | mlp_decoder_select="mlp_parser" | 2098 | mlp_decoder_select="mlp_parser" |
| @@ -2124,12 +2126,12 @@ mss2_decoder_select="error_resilience mpeg_er qpeldsp vc1_decoder" · 27 unmodified lines | |||
| 2124 | mxpeg_decoder_select="mjpeg_decoder" | 2126 | mxpeg_decoder_select="mjpeg_decoder" |
| 2125 | nellymoser_decoder_select="mdct sinewin" | 2127 | nellymoser_decoder_select="mdct sinewin" |
| 2126 | nellymoser_encoder_select="audio_frame_queue mdct sinewin" | 2128 | nellymoser_encoder_select="audio_frame_queue mdct sinewin" |
| 2127 | nuv_decoder_select="dsputil lzo" | 2129 | nuv_decoder_select="idctdsp lzo" |
| 2128 | on2avc_decoder_select="mdct" | 2130 | on2avc_decoder_select="mdct" |
| 2129 | opus_decoder_deps="swresample" | 2131 | opus_decoder_deps="swresample" |
| 2130 | png_decoder_select="zlib" | 2132 | png_decoder_select="zlib" |
| 2131 | png_encoder_select="huffyuvencdsp zlib" | 2133 | png_encoder_select="huffyuvencdsp zlib" |
| 2132 | prores_decoder_select="blockdsp dsputil" | 2134 | prores_decoder_select="blockdsp idctdsp" |
| 2133 | prores_encoder_select="dsputil" | 2135 | prores_encoder_select="dsputil" |
| 2134 | qcelp_decoder_select="lsp" | 2136 | qcelp_decoder_select="lsp" |
| 2135 | qdm2_decoder_select="mdct rdft mpegaudiodsp" | 2137 | qdm2_decoder_select="mdct rdft mpegaudiodsp" |
| @@ -2191,7 +2193,7 @@ wmav2_encoder_select="mdct sinewin" · 55 unmodified lines | |||
| 2191 | wmavoice_decoder_select="lsp rdft dct mdct sinewin" | 2193 | wmavoice_decoder_select="lsp rdft dct mdct sinewin" |
| 2192 | wmv1_decoder_select="h263_decoder" | 2194 | wmv1_decoder_select="h263_decoder" |
| 2193 | wmv1_encoder_select="h263_encoder" | 2195 | wmv1_encoder_select="h263_encoder" |
| 2194 | wmv2_decoder_select="blockdsp h263_decoder intrax8 videodsp" | 2196 | wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp" |
| 2195 | wmv2_encoder_select="h263_encoder" | 2197 | wmv2_encoder_select="h263_encoder" |
| 2196 | wmv3_decoder_select="vc1_decoder" | 2198 | wmv3_decoder_select="vc1_decoder" |
| 2197 | wmv3image_decoder_select="wmv3_decoder" | 2199 | wmv3image_decoder_select="wmv3_decoder" |
| @@ -136,9 +136,6 @@ dct_unquantize_mpeg2 · 135 unmodified lines | |||
| 136 | dct_unquantize_h263 | 136 | dct_unquantize_h263 |
| 137 | Used in MPEG-4/H.263 en/decoding. | 137 | Used in MPEG-4/H.263 en/decoding. |
| 138 | 138 | ||
| 139 | FIXME remaining functions? | ||
| 140 | BTW, most of these functions are in dsputil.c/.h, some are in mpegvideo.c/.h. | ||
| 141 | |||
| 142 | 139 | ||
| 143 | 140 | ||
| 144 | Alignment: | 141 | Alignment: |
| @@ -39,9 +39,8 @@ OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o · 38 unmodified lines | |||
| 39 | OBJS-$(CONFIG_CABAC) += cabac.o | 39 | OBJS-$(CONFIG_CABAC) += cabac.o |
| 40 | OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o | 40 | OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o |
| 41 | OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o | 41 | OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o |
| 42 | OBJS-$(CONFIG_DSPUTIL) += dsputil.o | ||
| 42 | OBJS-$(CONFIG_DXVA2) += dxva2.o | 43 | OBJS-$(CONFIG_DXVA2) += dxva2.o |
| 43 | OBJS-$(CONFIG_DSPUTIL) += dsputil.o faanidct.o \ | ||
| 44 | simple_idct.o jrevdct.o | ||
| 45 | OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o | 44 | OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o |
| 46 | OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o | 45 | OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o |
| 47 | OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o | 46 | OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o |
| @@ -59,6 +58,8 @@ OBJS-$(CONFIG_HPELDSP) += hpeldsp.o · 11 unmodified lines | |||
| 59 | OBJS-$(CONFIG_HUFFMAN) += huffman.o | 58 | OBJS-$(CONFIG_HUFFMAN) += huffman.o |
| 60 | OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o | 59 | OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o |
| 61 | OBJS-$(CONFIG_HUFFYUVENCDSP) += huffyuvencdsp.o | 60 | OBJS-$(CONFIG_HUFFYUVENCDSP) += huffyuvencdsp.o |
| 61 | OBJS-$(CONFIG_IDCTDSP) += idctdsp.o faanidct.o \ | ||
| 62 | simple_idct.o jrevdct.o | ||
| 62 | OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o | 63 | OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o |
| 63 | OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o | 64 | OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o |
| 64 | OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o | 65 | OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o |
| @@ -24,10 +24,10 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include "avcodec.h" | 25 | #include "avcodec.h" |
| 26 | #include "bytestream.h" | 26 | #include "bytestream.h" |
| 27 | #include "dsputil.h" | ||
| 28 | #include "internal.h" | 27 | #include "internal.h" |
| 29 | #include "get_bits.h" | 28 | #include "get_bits.h" |
| 30 | #include "golomb.h" | 29 | #include "golomb.h" |
| 30 | #include "idctdsp.h" | ||
| 31 | #include "unary.h" | 31 | #include "unary.h" |
| 32 | 32 | ||
| 33 | #define AIC_HDR_SIZE 24 | 33 | #define AIC_HDR_SIZE 24 |
| @@ -139,7 +139,7 @@ static const uint8_t *aic_scan[NUM_BANDS] = { · 105 unmodified lines | |||
| 139 | typedef struct AICContext { | 139 | typedef struct AICContext { |
| 140 | AVCodecContext *avctx; | 140 | AVCodecContext *avctx; |
| 141 | AVFrame *frame; | 141 | AVFrame *frame; |
| 142 | DSPContext dsp; | 142 | IDCTDSPContext idsp; |
| 143 | ScanTable scantable; | 143 | ScanTable scantable; |
| 144 | 144 | ||
| 145 | int num_x_slices; | 145 | int num_x_slices; |
| @@ -338,16 +338,15 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y, · 192 unmodified lines | |||
| 338 | recombine_block_il(ctx->block, ctx->scantable.permutated, | 338 | recombine_block_il(ctx->block, ctx->scantable.permutated, |
| 339 | &base_y, &ext_y, blk); | 339 | &base_y, &ext_y, blk); |
| 340 | unquant_block(ctx->block, ctx->quant, ctx->quant_matrix); | 340 | unquant_block(ctx->block, ctx->quant, ctx->quant_matrix); |
| 341 | ctx->dsp.idct(ctx->block); | 341 | ctx->idsp.idct(ctx->block); |
| 342 | 342 | ||
| 343 | if (!ctx->interlaced) { | 343 | if (!ctx->interlaced) { |
| 344 | dst = Y + (blk >> 1) * 8 * ystride + (blk & 1) * 8; | 344 | dst = Y + (blk >> 1) * 8 * ystride + (blk & 1) * 8; |
| 345 | ctx->dsp.put_signed_pixels_clamped(ctx->block, dst, | 345 | ctx->idsp.put_signed_pixels_clamped(ctx->block, dst, ystride); |
| 346 | ystride); | ||
| 347 | } else { | 346 | } else { |
| 348 | dst = Y + (blk & 1) * 8 + (blk >> 1) * ystride; | 347 | dst = Y + (blk & 1) * 8 + (blk >> 1) * ystride; |
| 349 | ctx->dsp.put_signed_pixels_clamped(ctx->block, dst, | 348 | ctx->idsp.put_signed_pixels_clamped(ctx->block, dst, |
| 350 | ystride * 2); | 349 | ystride * 2); |
| 351 | } | 350 | } |
| 352 | } | 351 | } |
| 353 | Y += 16; | 352 | Y += 16; |
| @@ -356,9 +355,9 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y, · 2 unmodified lines | |||
| 356 | recombine_block(ctx->block, ctx->scantable.permutated, | 355 | recombine_block(ctx->block, ctx->scantable.permutated, |
| 357 | &base_c, &ext_c); | 356 | &base_c, &ext_c); |
| 358 | unquant_block(ctx->block, ctx->quant, ctx->quant_matrix); | 357 | unquant_block(ctx->block, ctx->quant, ctx->quant_matrix); |
| 359 | ctx->dsp.idct(ctx->block); | 358 | ctx->idsp.idct(ctx->block); |
| 360 | ctx->dsp.put_signed_pixels_clamped(ctx->block, C[blk], | 359 | ctx->idsp.put_signed_pixels_clamped(ctx->block, C[blk], |
| 361 | ctx->frame->linesize[blk + 1]); | 360 | ctx->frame->linesize[blk + 1]); |
| 362 | C[blk] += 8; | 361 | C[blk] += 8; |
| 363 | } | 362 | } |
| 364 | } | 363 | } |
| @@ -428,13 +427,13 @@ static av_cold int aic_decode_init(AVCodecContext *avctx) · 63 unmodified lines | |||
| 428 | 427 | ||
| 429 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; | 428 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| 430 | 429 | ||
| 431 | ff_dsputil_init(&ctx->dsp, avctx); | 430 | ff_idctdsp_init(&ctx->idsp, avctx); |
| 432 | 431 | ||
| 433 | for (i = 0; i < 64; i++) | 432 | for (i = 0; i < 64; i++) |
| 434 | scan[i] = i; | 433 | scan[i] = i; |
| 435 | ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, scan); | 434 | ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable, scan); |
| 436 | for (i = 0; i < 64; i++) | 435 | for (i = 0; i < 64; i++) |
| 437 | ctx->quant_matrix[ctx->dsp.idct_permutation[i]] = aic_quant_matrix[i]; | 436 | ctx->quant_matrix[ctx->idsp.idct_permutation[i]] = aic_quant_matrix[i]; |
| 438 | 437 | ||
| 439 | ctx->mb_width = FFALIGN(avctx->width, 16) >> 4; | 438 | ctx->mb_width = FFALIGN(avctx->width, 16) >> 4; |
| 440 | ctx->mb_height = FFALIGN(avctx->height, 16) >> 4; | 439 | ctx->mb_height = FFALIGN(avctx->height, 16) >> 4; |
| @@ -6,10 +6,7 @@ OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \ · 5 unmodified lines | |||
| 6 | arm/ac3dsp_arm.o | 6 | arm/ac3dsp_arm.o |
| 7 | OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_arm.o | 7 | OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_arm.o |
| 8 | OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_arm.o | 8 | OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_arm.o |
| 9 | OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_arm.o \ | 9 | OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_arm.o |
| 10 | arm/dsputil_arm.o \ | ||
| 11 | arm/jrevdct_arm.o \ | ||
| 12 | arm/simple_idct_arm.o | ||
| 13 | OBJS-$(CONFIG_FFT) += arm/fft_init_arm.o \ | 10 | OBJS-$(CONFIG_FFT) += arm/fft_init_arm.o \ |
| 14 | arm/fft_fixed_init_arm.o | 11 | arm/fft_fixed_init_arm.o |
| 15 | OBJS-$(CONFIG_H264CHROMA) += arm/h264chroma_init_arm.o | 12 | OBJS-$(CONFIG_H264CHROMA) += arm/h264chroma_init_arm.o |
| @@ -18,6 +15,10 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o · 2 unmodified lines | |||
| 18 | OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o | 15 | OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o |
| 19 | OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \ | 16 | OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \ |
| 20 | arm/hpeldsp_arm.o | 17 | arm/hpeldsp_arm.o |
| 18 | OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_arm.o \ | ||
| 19 | arm/idctdsp_arm.o \ | ||
| 20 | arm/jrevdct_arm.o \ | ||
| 21 | arm/simple_idct_arm.o | ||
| 21 | OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_init_arm.o | 22 | OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_init_arm.o |
| 22 | OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o | 23 | OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o |
| 23 | OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o | 24 | OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o |
| @@ -41,7 +42,7 @@ OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_init_arm.o · 17 unmodified lines | |||
| 41 | OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_init_arm.o \ | 42 | OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_init_arm.o \ |
| 42 | arm/rv40dsp_init_arm.o | 43 | arm/rv40dsp_init_arm.o |
| 43 | 44 | ||
| 44 | ARMV5TE-OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_armv5te.o \ | 45 | ARMV5TE-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv5te.o \ |
| 45 | arm/simple_idct_armv5te.o | 46 | arm/simple_idct_armv5te.o |
| 46 | ARMV5TE-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_armv5te.o \ | 47 | ARMV5TE-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_armv5te.o \ |
| 47 | arm/mpegvideo_armv5te_s.o | 48 | arm/mpegvideo_armv5te_s.o |
| @@ -52,11 +53,13 @@ ARMV5TE-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv5te.o · 4 unmodified lines | |||
| 52 | 53 | ||
| 53 | ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o | 54 | ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o |
| 54 | ARMV6-OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_armv6.o \ | 55 | ARMV6-OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_armv6.o \ |
| 55 | arm/dsputil_armv6.o \ | 56 | arm/dsputil_armv6.o |
| 56 | arm/simple_idct_armv6.o | ||
| 57 | ARMV6-OBJS-$(CONFIG_H264DSP) += arm/startcode_armv6.o | 57 | ARMV6-OBJS-$(CONFIG_H264DSP) += arm/startcode_armv6.o |
| 58 | ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ | 58 | ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ |
| 59 | arm/hpeldsp_armv6.o | 59 | arm/hpeldsp_armv6.o |
| 60 | ARMV6-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv6.o \ | ||
| 61 | arm/idctdsp_armv6.o \ | ||
| 62 | arm/simple_idct_armv6.o | ||
| 60 | ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o | 63 | ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o |
| 61 | 64 | ||
| 62 | ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o | 65 | ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o |
| @@ -86,9 +89,6 @@ NEON-OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_neon.o \ · 23 unmodified lines | |||
| 86 | arm/int_neon.o | 89 | arm/int_neon.o |
| 87 | NEON-OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_neon.o \ | 90 | NEON-OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_neon.o \ |
| 88 | arm/blockdsp_neon.o | 91 | arm/blockdsp_neon.o |
| 89 | NEON-OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_neon.o \ | ||
| 90 | arm/dsputil_neon.o \ | ||
| 91 | arm/simple_idct_neon.o | ||
| 92 | NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ | 92 | NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ |
| 93 | arm/fft_fixed_neon.o | 93 | arm/fft_fixed_neon.o |
| 94 | NEON-OBJS-$(CONFIG_H264CHROMA) += arm/h264cmc_neon.o | 94 | NEON-OBJS-$(CONFIG_H264CHROMA) += arm/h264cmc_neon.o |
| @@ -99,6 +99,9 @@ NEON-OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_neon.o \ · 4 unmodified lines | |||
| 99 | arm/hpeldsp_neon.o | 99 | arm/hpeldsp_neon.o |
| 100 | NEON-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_neon.o \ | 100 | NEON-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_neon.o \ |
| 101 | arm/hpeldsp_neon.o | 101 | arm/hpeldsp_neon.o |
| 102 | NEON-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_neon.o \ | ||
| 103 | arm/idctdsp_neon.o \ | ||
| 104 | arm/simple_idct_neon.o | ||
| 102 | NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ | 105 | NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ |
| 103 | arm/mdct_fixed_neon.o | 106 | arm/mdct_fixed_neon.o |
| 104 | NEON-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_neon.o | 107 | NEON-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_neon.o |
| @@ -24,11 +24,7 @@ · 23 unmodified lines | |||
| 24 | #include "libavcodec/avcodec.h" | 24 | #include "libavcodec/avcodec.h" |
| 25 | #include "libavcodec/dsputil.h" | 25 | #include "libavcodec/dsputil.h" |
| 26 | 26 | ||
| 27 | void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx, | ||
| 28 | unsigned high_bit_depth); | ||
| 29 | void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx, | 27 | void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx, |
| 30 | unsigned high_bit_depth); | 28 | unsigned high_bit_depth); |
| 31 | void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx, | ||
| 32 | unsigned high_bit_depth); | ||
| 33 | 29 | ||
| 34 | #endif /* AVCODEC_ARM_DSPUTIL_ARM_H */ | 30 | #endif /* AVCODEC_ARM_DSPUTIL_ARM_H */ |
| @@ -20,33 +20,6 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | #include "libavutil/arm/asm.S" | 21 | #include "libavutil/arm/asm.S" |
| 22 | 22 | ||
| 23 | function ff_add_pixels_clamped_armv6, export=1 | ||
| 24 | push {r4-r8,lr} | ||
| 25 | mov r3, #8 | ||
| 26 | 1: | ||
| 27 | ldm r0!, {r4,r5,r12,lr} | ||
| 28 | ldrd r6, r7, [r1] | ||
| 29 | pkhbt r8, r4, r5, lsl #16 | ||
| 30 | pkhtb r5, r5, r4, asr #16 | ||
| 31 | pkhbt r4, r12, lr, lsl #16 | ||
| 32 | pkhtb lr, lr, r12, asr #16 | ||
| 33 | pld [r1, r2] | ||
| 34 | uxtab16 r8, r8, r6 | ||
| 35 | uxtab16 r5, r5, r6, ror #8 | ||
| 36 | uxtab16 r4, r4, r7 | ||
| 37 | uxtab16 lr, lr, r7, ror #8 | ||
| 38 | usat16 r8, #8, r8 | ||
| 39 | usat16 r5, #8, r5 | ||
| 40 | usat16 r4, #8, r4 | ||
| 41 | usat16 lr, #8, lr | ||
| 42 | orr r6, r8, r5, lsl #8 | ||
| 43 | orr r7, r4, lr, lsl #8 | ||
| 44 | subs r3, r3, #1 | ||
| 45 | strd_post r6, r7, r1, r2 | ||
| 46 | bgt 1b | ||
| 47 | pop {r4-r8,pc} | ||
| 48 | endfunc | ||
| 49 | |||
| 50 | function ff_get_pixels_armv6, export=1 | 23 | function ff_get_pixels_armv6, export=1 |
| 51 | pld [r1, r2] | 24 | pld [r1, r2] |
| 52 | push {r4-r8, lr} | 25 | push {r4-r8, lr} |
| @@ -28,71 +28,11 @@ · 27 unmodified lines | |||
| 28 | #include "libavcodec/dsputil.h" | 28 | #include "libavcodec/dsputil.h" |
| 29 | #include "dsputil_arm.h" | 29 | #include "dsputil_arm.h" |
| 30 | 30 | ||
| 31 | void ff_j_rev_dct_arm(int16_t *data); | ||
| 32 | void ff_simple_idct_arm(int16_t *data); | ||
| 33 | |||
| 34 | /* XXX: local hack */ | ||
| 35 | static void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size); | ||
| 36 | static void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size); | ||
| 37 | |||
| 38 | void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest, | ||
| 39 | int line_size); | ||
| 40 | |||
| 41 | /* XXX: those functions should be suppressed ASAP when all IDCTs are | ||
| 42 | * converted */ | ||
| 43 | static void j_rev_dct_arm_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 44 | { | ||
| 45 | ff_j_rev_dct_arm(block); | ||
| 46 | ff_put_pixels_clamped(block, dest, line_size); | ||
| 47 | } | ||
| 48 | |||
| 49 | static void j_rev_dct_arm_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 50 | { | ||
| 51 | ff_j_rev_dct_arm(block); | ||
| 52 | ff_add_pixels_clamped(block, dest, line_size); | ||
| 53 | } | ||
| 54 | |||
| 55 | static void simple_idct_arm_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 56 | { | ||
| 57 | ff_simple_idct_arm(block); | ||
| 58 | ff_put_pixels_clamped(block, dest, line_size); | ||
| 59 | } | ||
| 60 | |||
| 61 | static void simple_idct_arm_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 62 | { | ||
| 63 | ff_simple_idct_arm(block); | ||
| 64 | ff_add_pixels_clamped(block, dest, line_size); | ||
| 65 | } | ||
| 66 | |||
| 67 | av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx, | 31 | av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx, |
| 68 | unsigned high_bit_depth) | 32 | unsigned high_bit_depth) |
| 69 | { | 33 | { |
| 70 | int cpu_flags = av_get_cpu_flags(); | 34 | int cpu_flags = av_get_cpu_flags(); |
| 71 | 35 | ||
| 72 | ff_put_pixels_clamped = c->put_pixels_clamped; | ||
| 73 | ff_add_pixels_clamped = c->add_pixels_clamped; | ||
| 74 | |||
| 75 | if (!avctx->lowres && !high_bit_depth) { | ||
| 76 | if (avctx->idct_algo == FF_IDCT_AUTO || | ||
| 77 | avctx->idct_algo == FF_IDCT_ARM) { | ||
| 78 | c->idct_put = j_rev_dct_arm_put; | ||
| 79 | c->idct_add = j_rev_dct_arm_add; | ||
| 80 | c->idct = ff_j_rev_dct_arm; | ||
| 81 | c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; | ||
| 82 | } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM) { | ||
| 83 | c->idct_put = simple_idct_arm_put; | ||
| 84 | c->idct_add = simple_idct_arm_add; | ||
| 85 | c->idct = ff_simple_idct_arm; | ||
| 86 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
| 90 | c->add_pixels_clamped = ff_add_pixels_clamped_arm; | ||
| 91 | |||
| 92 | if (have_armv5te(cpu_flags)) | ||
| 93 | ff_dsputil_init_armv5te(c, avctx, high_bit_depth); | ||
| 94 | if (have_armv6(cpu_flags)) | 36 | if (have_armv6(cpu_flags)) |
| 95 | ff_dsputil_init_armv6(c, avctx, high_bit_depth); | 37 | ff_dsputil_init_armv6(c, avctx, high_bit_depth); |
| 96 | if (have_neon(cpu_flags)) | ||
| 97 | ff_dsputil_init_neon(c, avctx, high_bit_depth); | ||
| 98 | } | 38 | } |
| @@ -26,13 +26,6 @@ · 25 unmodified lines | |||
| 26 | #include "libavcodec/mpegvideo.h" | 26 | #include "libavcodec/mpegvideo.h" |
| 27 | #include "dsputil_arm.h" | 27 | #include "dsputil_arm.h" |
| 28 | 28 | ||
| 29 | void ff_simple_idct_armv6(int16_t *data); | ||
| 30 | void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, int16_t *data); | ||
| 31 | void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, int16_t *data); | ||
| 32 | |||
| 33 | void ff_add_pixels_clamped_armv6(const int16_t *block, uint8_t *pixels, | ||
| 34 | int line_size); | ||
| 35 | |||
| 36 | void ff_get_pixels_armv6(int16_t *block, const uint8_t *pixels, int stride); | 29 | void ff_get_pixels_armv6(int16_t *block, const uint8_t *pixels, int stride); |
| 37 | void ff_diff_pixels_armv6(int16_t *block, const uint8_t *s1, | 30 | void ff_diff_pixels_armv6(int16_t *block, const uint8_t *s1, |
| 38 | const uint8_t *s2, int stride); | 31 | const uint8_t *s2, int stride); |
| @@ -56,17 +49,6 @@ int ff_pix_sum_armv6(uint8_t *pix, int line_size); · 17 unmodified lines | |||
| 56 | av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx, | 49 | av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx, |
| 57 | unsigned high_bit_depth) | 50 | unsigned high_bit_depth) |
| 58 | { | 51 | { |
| 59 | if (!avctx->lowres && !high_bit_depth) { | ||
| 60 | if (avctx->idct_algo == FF_IDCT_AUTO || | ||
| 61 | avctx->idct_algo == FF_IDCT_SIMPLEARMV6) { | ||
| 62 | c->idct_put = ff_simple_idct_put_armv6; | ||
| 63 | c->idct_add = ff_simple_idct_add_armv6; | ||
| 64 | c->idct = ff_simple_idct_armv6; | ||
| 65 | c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | c->add_pixels_clamped = ff_add_pixels_clamped_armv6; | ||
| 69 | |||
| 70 | if (!high_bit_depth) | 52 | if (!high_bit_depth) |
| 71 | c->get_pixels = ff_get_pixels_armv6; | 53 | c->get_pixels = ff_get_pixels_armv6; |
| 72 | c->diff_pixels = ff_diff_pixels_armv6; | 54 | c->diff_pixels = ff_diff_pixels_armv6; |
| @@ -1,5 +1,5 @@ | |||
| 1 | @ | 1 | @ |
| 2 | @ ARMv4 optimized DSP utils | 2 | @ ARMv4-optimized IDCT functions |
| 3 | @ Copyright (c) 2004 AGAWA Koji <i (AT) atty (DOT) jp> | 3 | @ Copyright (c) 2004 AGAWA Koji <i (AT) atty (DOT) jp> |
| 4 | @ | 4 | @ |
| 5 | @ This file is part of FFmpeg. | 5 | @ This file is part of FFmpeg. |
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2009 Mans Rullgard <mans@mansr.com> | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef AVCODEC_ARM_IDCTDSP_ARM_H | ||
| 22 | #define AVCODEC_ARM_IDCTDSP_ARM_H | ||
| 23 | |||
| 24 | #include "libavcodec/avcodec.h" | ||
| 25 | #include "libavcodec/idctdsp.h" | ||
| 26 | |||
| 27 | void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 28 | unsigned high_bit_depth); | ||
| 29 | void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 30 | unsigned high_bit_depth); | ||
| 31 | void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 32 | unsigned high_bit_depth); | ||
| 33 | |||
| 34 | #endif /* AVCODEC_ARM_IDCTDSP_ARM_H */ | ||
| @@ -0,0 +1,48 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2009 Mans Rullgard <mans@mansr.com> | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include "libavutil/arm/asm.S" | ||
| 22 | |||
| 23 | function ff_add_pixels_clamped_armv6, export=1 | ||
| 24 | push {r4-r8,lr} | ||
| 25 | mov r3, #8 | ||
| 26 | 1: | ||
| 27 | ldm r0!, {r4,r5,r12,lr} | ||
| 28 | ldrd r6, r7, [r1] | ||
| 29 | pkhbt r8, r4, r5, lsl #16 | ||
| 30 | pkhtb r5, r5, r4, asr #16 | ||
| 31 | pkhbt r4, r12, lr, lsl #16 | ||
| 32 | pkhtb lr, lr, r12, asr #16 | ||
| 33 | pld [r1, r2] | ||
| 34 | uxtab16 r8, r8, r6 | ||
| 35 | uxtab16 r5, r5, r6, ror #8 | ||
| 36 | uxtab16 r4, r4, r7 | ||
| 37 | uxtab16 lr, lr, r7, ror #8 | ||
| 38 | usat16 r8, #8, r8 | ||
| 39 | usat16 r5, #8, r5 | ||
| 40 | usat16 r4, #8, r4 | ||
| 41 | usat16 lr, #8, lr | ||
| 42 | orr r6, r8, r5, lsl #8 | ||
| 43 | orr r7, r4, lr, lsl #8 | ||
| 44 | subs r3, r3, #1 | ||
| 45 | strd_post r6, r7, r1, r2 | ||
| 46 | bgt 1b | ||
| 47 | pop {r4-r8,pc} | ||
| 48 | endfunc | ||
| @@ -0,0 +1,98 @@ | |||
| 1 | /* | ||
| 2 | * ARM-optimized IDCT functions | ||
| 3 | * Copyright (c) 2001 Lionel Ulmer | ||
| 4 | * | ||
| 5 | * This file is part of FFmpeg. | ||
| 6 | * | ||
| 7 | * FFmpeg is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU Lesser General Public | ||
| 9 | * License as published by the Free Software Foundation; either | ||
| 10 | * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * Lesser General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU Lesser General Public | ||
| 18 | * License along with FFmpeg; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <stdint.h> | ||
| 23 | |||
| 24 | #include "libavutil/attributes.h" | ||
| 25 | #include "libavutil/cpu.h" | ||
| 26 | #include "libavutil/arm/cpu.h" | ||
| 27 | #include "libavcodec/avcodec.h" | ||
| 28 | #include "libavcodec/idctdsp.h" | ||
| 29 | #include "idctdsp_arm.h" | ||
| 30 | |||
| 31 | void ff_j_rev_dct_arm(int16_t *data); | ||
| 32 | void ff_simple_idct_arm(int16_t *data); | ||
| 33 | |||
| 34 | /* XXX: local hack */ | ||
| 35 | static void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size); | ||
| 36 | static void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size); | ||
| 37 | |||
| 38 | void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest, | ||
| 39 | int line_size); | ||
| 40 | |||
| 41 | /* XXX: those functions should be suppressed ASAP when all IDCTs are | ||
| 42 | * converted */ | ||
| 43 | static void j_rev_dct_arm_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 44 | { | ||
| 45 | ff_j_rev_dct_arm(block); | ||
| 46 | ff_put_pixels_clamped(block, dest, line_size); | ||
| 47 | } | ||
| 48 | |||
| 49 | static void j_rev_dct_arm_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 50 | { | ||
| 51 | ff_j_rev_dct_arm(block); | ||
| 52 | ff_add_pixels_clamped(block, dest, line_size); | ||
| 53 | } | ||
| 54 | |||
| 55 | static void simple_idct_arm_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 56 | { | ||
| 57 | ff_simple_idct_arm(block); | ||
| 58 | ff_put_pixels_clamped(block, dest, line_size); | ||
| 59 | } | ||
| 60 | |||
| 61 | static void simple_idct_arm_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 62 | { | ||
| 63 | ff_simple_idct_arm(block); | ||
| 64 | ff_add_pixels_clamped(block, dest, line_size); | ||
| 65 | } | ||
| 66 | |||
| 67 | av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 68 | unsigned high_bit_depth) | ||
| 69 | { | ||
| 70 | int cpu_flags = av_get_cpu_flags(); | ||
| 71 | |||
| 72 | ff_put_pixels_clamped = c->put_pixels_clamped; | ||
| 73 | ff_add_pixels_clamped = c->add_pixels_clamped; | ||
| 74 | |||
| 75 | if (!avctx->lowres && !high_bit_depth) { | ||
| 76 | if (avctx->idct_algo == FF_IDCT_AUTO || | ||
| 77 | avctx->idct_algo == FF_IDCT_ARM) { | ||
| 78 | c->idct_put = j_rev_dct_arm_put; | ||
| 79 | c->idct_add = j_rev_dct_arm_add; | ||
| 80 | c->idct = ff_j_rev_dct_arm; | ||
| 81 | c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; | ||
| 82 | } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM) { | ||
| 83 | c->idct_put = simple_idct_arm_put; | ||
| 84 | c->idct_add = simple_idct_arm_add; | ||
| 85 | c->idct = ff_simple_idct_arm; | ||
| 86 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
| 90 | c->add_pixels_clamped = ff_add_pixels_clamped_arm; | ||
| 91 | |||
| 92 | if (have_armv5te(cpu_flags)) | ||
| 93 | ff_idctdsp_init_armv5te(c, avctx, high_bit_depth); | ||
| 94 | if (have_armv6(cpu_flags)) | ||
| 95 | ff_idctdsp_init_armv6(c, avctx, high_bit_depth); | ||
| 96 | if (have_neon(cpu_flags)) | ||
| 97 | ff_idctdsp_init_neon(c, avctx, high_bit_depth); | ||
| 98 | } | ||
| @@ -22,14 +22,14 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #include "libavutil/attributes.h" | 23 | #include "libavutil/attributes.h" |
| 24 | #include "libavcodec/avcodec.h" | 24 | #include "libavcodec/avcodec.h" |
| 25 | #include "libavcodec/dsputil.h" | 25 | #include "libavcodec/idctdsp.h" |
| 26 | #include "dsputil_arm.h" | 26 | #include "idctdsp_arm.h" |
| 27 | 27 | ||
| 28 | void ff_simple_idct_armv5te(int16_t *data); | 28 | void ff_simple_idct_armv5te(int16_t *data); |
| 29 | void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, int16_t *data); | 29 | void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, int16_t *data); |
| 30 | void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, int16_t *data); | 30 | void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, int16_t *data); |
| 31 | 31 | ||
| 32 | av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx, | 32 | av_cold void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, |
| 33 | unsigned high_bit_depth) | 33 | unsigned high_bit_depth) |
| 34 | { | 34 | { |
| 35 | if (!avctx->lowres && !high_bit_depth && | 35 | if (!avctx->lowres && !high_bit_depth && |
| @@ -0,0 +1,48 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2009 Mans Rullgard <mans@mansr.com> | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <stdint.h> | ||
| 22 | |||
| 23 | #include "libavutil/attributes.h" | ||
| 24 | #include "libavcodec/avcodec.h" | ||
| 25 | #include "libavcodec/idctdsp.h" | ||
| 26 | #include "idctdsp_arm.h" | ||
| 27 | |||
| 28 | void ff_simple_idct_armv6(int16_t *data); | ||
| 29 | void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, int16_t *data); | ||
| 30 | void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, int16_t *data); | ||
| 31 | |||
| 32 | void ff_add_pixels_clamped_armv6(const int16_t *block, uint8_t *pixels, | ||
| 33 | int line_size); | ||
| 34 | |||
| 35 | av_cold void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 36 | unsigned high_bit_depth) | ||
| 37 | { | ||
| 38 | if (!avctx->lowres && !high_bit_depth) { | ||
| 39 | if (avctx->idct_algo == FF_IDCT_AUTO || | ||
| 40 | avctx->idct_algo == FF_IDCT_SIMPLEARMV6) { | ||
| 41 | c->idct_put = ff_simple_idct_put_armv6; | ||
| 42 | c->idct_add = ff_simple_idct_add_armv6; | ||
| 43 | c->idct = ff_simple_idct_armv6; | ||
| 44 | c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | c->add_pixels_clamped = ff_add_pixels_clamped_armv6; | ||
| 48 | } | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * ARM NEON optimised DSP functions | 2 | * ARM-NEON-optimized IDCT functions |
| 3 | * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> | 3 | * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> |
| 4 | * | 4 | * |
| 5 | * This file is part of FFmpeg. | 5 | * This file is part of FFmpeg. |
| @@ -23,8 +23,8 @@ · 17 unmodified lines | |||
| 23 | 23 | ||
| 24 | #include "libavutil/attributes.h" | 24 | #include "libavutil/attributes.h" |
| 25 | #include "libavcodec/avcodec.h" | 25 | #include "libavcodec/avcodec.h" |
| 26 | #include "libavcodec/dsputil.h" | 26 | #include "libavcodec/idctdsp.h" |
| 27 | #include "dsputil_arm.h" | 27 | #include "idctdsp_arm.h" |
| 28 | 28 | ||
| 29 | void ff_simple_idct_neon(int16_t *data); | 29 | void ff_simple_idct_neon(int16_t *data); |
| 30 | void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data); | 30 | void ff_simple_idct_put_neon(uint8_t *dest, int line_size, int16_t *data); |
| @@ -34,7 +34,7 @@ void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, int); · 3 unmodified lines | |||
| 34 | void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, int); | 34 | void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, int); |
| 35 | void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, int); | 35 | void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, int); |
| 36 | 36 | ||
| 37 | av_cold void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx, | 37 | av_cold void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, |
| 38 | unsigned high_bit_depth) | 38 | unsigned high_bit_depth) |
| 39 | { | 39 | { |
| 40 | if (!avctx->lowres && !high_bit_depth) { | 40 | if (!avctx->lowres && !high_bit_depth) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * ARM NEON optimised DSP functions | 2 | * ARM-NEON-optimized IDCT functions |
| 3 | * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> | 3 | * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> |
| 4 | * | 4 | * |
| 5 | * This file is part of FFmpeg. | 5 | * This file is part of FFmpeg. |
| @@ -84,7 +84,6 @@ av_cold void ff_asv_common_init(AVCodecContext *avctx) { · 83 unmodified lines | |||
| 84 | ASV1Context * const a = avctx->priv_data; | 84 | ASV1Context * const a = avctx->priv_data; |
| 85 | 85 | ||
| 86 | ff_bswapdsp_init(&a->bbdsp); | 86 | ff_bswapdsp_init(&a->bbdsp); |
| 87 | ff_dsputil_init(&a->dsp, avctx); | ||
| 88 | 87 | ||
| 89 | a->mb_width = (avctx->width + 15) / 16; | 88 | a->mb_width = (avctx->width + 15) / 16; |
| 90 | a->mb_height = (avctx->height + 15) / 16; | 89 | a->mb_height = (avctx->height + 15) / 16; |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include "blockdsp.h" | 34 | #include "blockdsp.h" |
| 35 | #include "bswapdsp.h" | 35 | #include "bswapdsp.h" |
| 36 | #include "dsputil.h" | 36 | #include "dsputil.h" |
| 37 | #include "idctdsp.h" | ||
| 37 | #include "get_bits.h" | 38 | #include "get_bits.h" |
| 38 | #include "put_bits.h" | 39 | #include "put_bits.h" |
| 39 | 40 | ||
| @@ -42,6 +43,7 @@ typedef struct ASV1Context{ · 2 unmodified lines | |||
| 42 | BlockDSPContext bdsp; | 43 | BlockDSPContext bdsp; |
| 43 | BswapDSPContext bbdsp; | 44 | BswapDSPContext bbdsp; |
| 44 | DSPContext dsp; | 45 | DSPContext dsp; |
| 46 | IDCTDSPContext idsp; | ||
| 45 | PutBitContext pb; | 47 | PutBitContext pb; |
| 46 | GetBitContext gb; | 48 | GetBitContext gb; |
| 47 | ScanTable scantable; | 49 | ScanTable scantable; |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "asv.h" | 29 | #include "asv.h" |
| 30 | #include "avcodec.h" | 30 | #include "avcodec.h" |
| 31 | #include "blockdsp.h" | 31 | #include "blockdsp.h" |
| 32 | #include "idctdsp.h" | ||
| 32 | #include "internal.h" | 33 | #include "internal.h" |
| 33 | #include "mathops.h" | 34 | #include "mathops.h" |
| 34 | #include "mpeg12data.h" | 35 | #include "mpeg12data.h" |
| @@ -189,14 +190,14 @@ static inline void idct_put(ASV1Context *a, AVFrame *frame, int mb_x, int mb_y) · 154 unmodified lines | |||
| 189 | uint8_t *dest_cb = frame->data[1] + (mb_y * 8 * frame->linesize[1]) + mb_x * 8; | 190 | uint8_t *dest_cb = frame->data[1] + (mb_y * 8 * frame->linesize[1]) + mb_x * 8; |
| 190 | uint8_t *dest_cr = frame->data[2] + (mb_y * 8 * frame->linesize[2]) + mb_x * 8; | 191 | uint8_t *dest_cr = frame->data[2] + (mb_y * 8 * frame->linesize[2]) + mb_x * 8; |
| 191 | 192 | ||
| 192 | a->dsp.idct_put(dest_y , linesize, block[0]); | 193 | a->idsp.idct_put(dest_y, linesize, block[0]); |
| 193 | a->dsp.idct_put(dest_y + 8, linesize, block[1]); | 194 | a->idsp.idct_put(dest_y + 8, linesize, block[1]); |
| 194 | a->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]); | 195 | a->idsp.idct_put(dest_y + 8 * linesize, linesize, block[2]); |
| 195 | a->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]); | 196 | a->idsp.idct_put(dest_y + 8 * linesize + 8, linesize, block[3]); |
| 196 | 197 | ||
| 197 | if (!(a->avctx->flags&CODEC_FLAG_GRAY)) { | 198 | if (!(a->avctx->flags&CODEC_FLAG_GRAY)) { |
| 198 | a->dsp.idct_put(dest_cb, frame->linesize[1], block[4]); | 199 | a->idsp.idct_put(dest_cb, frame->linesize[1], block[4]); |
| 199 | a->dsp.idct_put(dest_cr, frame->linesize[2], block[5]); | 200 | a->idsp.idct_put(dest_cr, frame->linesize[2], block[5]); |
| 200 | } | 201 | } |
| 201 | } | 202 | } |
| 202 | 203 | ||
| @@ -279,8 +280,9 @@ static av_cold int decode_init(AVCodecContext *avctx) · 76 unmodified lines | |||
| 279 | 280 | ||
| 280 | ff_asv_common_init(avctx); | 281 | ff_asv_common_init(avctx); |
| 281 | ff_blockdsp_init(&a->bdsp, avctx); | 282 | ff_blockdsp_init(&a->bdsp, avctx); |
| 283 | ff_idctdsp_init(&a->idsp, avctx); | ||
| 282 | init_vlcs(a); | 284 | init_vlcs(a); |
| 283 | ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_asv_scantab); | 285 | ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab); |
| 284 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; | 286 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| 285 | 287 | ||
| 286 | if (avctx->extradata_size < 1 || (a->inv_qscale = avctx->extradata[0]) == 0) { | 288 | if (avctx->extradata_size < 1 || (a->inv_qscale = avctx->extradata[0]) == 0) { |
| @@ -281,6 +281,7 @@ static av_cold int encode_init(AVCodecContext *avctx){ · 280 unmodified lines | |||
| 281 | const int scale= avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; | 281 | const int scale= avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2; |
| 282 | 282 | ||
| 283 | ff_asv_common_init(avctx); | 283 | ff_asv_common_init(avctx); |
| 284 | ff_dsputil_init(&a->dsp, avctx); | ||
| 284 | 285 | ||
| 285 | if(avctx->global_quality <= 0) avctx->global_quality= 4*FF_QUALITY_SCALE; | 286 | if(avctx->global_quality <= 0) avctx->global_quality= 4*FF_QUALITY_SCALE; |
| 286 | 287 | ||
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "get_bits.h" | 29 | #include "get_bits.h" |
| 30 | #include "golomb.h" | 30 | #include "golomb.h" |
| 31 | #include "h264chroma.h" | 31 | #include "h264chroma.h" |
| 32 | #include "idctdsp.h" | ||
| 32 | #include "mathops.h" | 33 | #include "mathops.h" |
| 33 | #include "qpeldsp.h" | 34 | #include "qpeldsp.h" |
| 34 | #include "cavs.h" | 35 | #include "cavs.h" |
| @@ -772,13 +773,13 @@ av_cold int ff_cavs_init(AVCodecContext *avctx) · 737 unmodified lines | |||
| 772 | AVSContext *h = avctx->priv_data; | 773 | AVSContext *h = avctx->priv_data; |
| 773 | 774 | ||
| 774 | ff_blockdsp_init(&h->bdsp, avctx); | 775 | ff_blockdsp_init(&h->bdsp, avctx); |
| 775 | ff_dsputil_init(&h->dsp, avctx); | ||
| 776 | ff_h264chroma_init(&h->h264chroma, 8); | 776 | ff_h264chroma_init(&h->h264chroma, 8); |
| 777 | ff_idctdsp_init(&h->idsp, avctx); | ||
| 777 | ff_videodsp_init(&h->vdsp, 8); | 778 | ff_videodsp_init(&h->vdsp, 8); |
| 778 | ff_cavsdsp_init(&h->cdsp, avctx); | 779 | ff_cavsdsp_init(&h->cdsp, avctx); |
| 779 | ff_init_scantable_permutation(h->dsp.idct_permutation, | 780 | ff_init_scantable_permutation(h->idsp.idct_permutation, |
| 780 | h->cdsp.idct_perm); | 781 | h->cdsp.idct_perm); |
| 781 | ff_init_scantable(h->dsp.idct_permutation, &h->scantable, ff_zigzag_direct); | 782 | ff_init_scantable(h->idsp.idct_permutation, &h->scantable, ff_zigzag_direct); |
| 782 | 783 | ||
| 783 | h->avctx = avctx; | 784 | h->avctx = avctx; |
| 784 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; | 785 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| @@ -24,8 +24,8 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include "cavsdsp.h" | 25 | #include "cavsdsp.h" |
| 26 | #include "blockdsp.h" | 26 | #include "blockdsp.h" |
| 27 | #include "dsputil.h" | ||
| 28 | #include "h264chroma.h" | 27 | #include "h264chroma.h" |
| 28 | #include "idctdsp.h" | ||
| 29 | #include "get_bits.h" | 29 | #include "get_bits.h" |
| 30 | #include "videodsp.h" | 30 | #include "videodsp.h" |
| 31 | 31 | ||
| @@ -162,9 +162,9 @@ typedef struct AVSFrame { · 130 unmodified lines | |||
| 162 | 162 | ||
| 163 | typedef struct AVSContext { | 163 | typedef struct AVSContext { |
| 164 | AVCodecContext *avctx; | 164 | AVCodecContext *avctx; |
| 165 | DSPContext dsp; | ||
| 166 | BlockDSPContext bdsp; | 165 | BlockDSPContext bdsp; |
| 167 | H264ChromaContext h264chroma; | 166 | H264ChromaContext h264chroma; |
| 167 | IDCTDSPContext idsp; | ||
| 168 | VideoDSPContext vdsp; | 168 | VideoDSPContext vdsp; |
| 169 | CAVSDSPContext cdsp; | 169 | CAVSDSPContext cdsp; |
| 170 | GetBitContext gb; | 170 | GetBitContext gb; |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | 26 | ||
| 27 | #include "dsputil.h" | 27 | #include "idctdsp.h" |
| 28 | #include "mathops.h" | 28 | #include "mathops.h" |
| 29 | #include "cavsdsp.h" | 29 | #include "cavsdsp.h" |
| 30 | #include "libavutil/common.h" | 30 | #include "libavutil/common.h" |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "blockdsp.h" | 28 | #include "blockdsp.h" |
| 29 | #include "get_bits.h" | 29 | #include "get_bits.h" |
| 30 | #include "dnxhddata.h" | 30 | #include "dnxhddata.h" |
| 31 | #include "dsputil.h" | 31 | #include "idctdsp.h" |
| 32 | #include "internal.h" | 32 | #include "internal.h" |
| 33 | #include "thread.h" | 33 | #include "thread.h" |
| 34 | 34 | ||
| @@ -43,7 +43,7 @@ typedef struct DNXHDContext { · 8 unmodified lines | |||
| 43 | int cur_field; ///< current interlaced field | 43 | int cur_field; ///< current interlaced field |
| 44 | VLC ac_vlc, dc_vlc, run_vlc; | 44 | VLC ac_vlc, dc_vlc, run_vlc; |
| 45 | int last_dc[3]; | 45 | int last_dc[3]; |
| 46 | DSPContext dsp; | 46 | IDCTDSPContext idsp; |
| 47 | DECLARE_ALIGNED(16, int16_t, blocks)[12][64]; | 47 | DECLARE_ALIGNED(16, int16_t, blocks)[12][64]; |
| 48 | ScanTable scantable; | 48 | ScanTable scantable; |
| 49 | const CIDEntry *cid_table; | 49 | const CIDEntry *cid_table; |
| @@ -104,7 +104,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid) · 54 unmodified lines | |||
| 104 | ctx->cid_table->run_bits, 1, 1, | 104 | ctx->cid_table->run_bits, 1, 1, |
| 105 | ctx->cid_table->run_codes, 2, 2, 0); | 105 | ctx->cid_table->run_codes, 2, 2, 0); |
| 106 | 106 | ||
| 107 | ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, | 107 | ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable, |
| 108 | ff_zigzag_direct); | 108 | ff_zigzag_direct); |
| 109 | ctx->cid = cid; | 109 | ctx->cid = cid; |
| 110 | } | 110 | } |
| @@ -145,7 +145,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 34 unmodified lines | |||
| 145 | ctx->avctx->bits_per_raw_sample = 10; | 145 | ctx->avctx->bits_per_raw_sample = 10; |
| 146 | if (ctx->bit_depth != 10) { | 146 | if (ctx->bit_depth != 10) { |
| 147 | ff_blockdsp_init(&ctx->bdsp, ctx->avctx); | 147 | ff_blockdsp_init(&ctx->bdsp, ctx->avctx); |
| 148 | ff_dsputil_init(&ctx->dsp, ctx->avctx); | 148 | ff_idctdsp_init(&ctx->idsp, ctx->avctx); |
| 149 | ctx->bit_depth = 10; | 149 | ctx->bit_depth = 10; |
| 150 | ctx->decode_dct_block = dnxhd_decode_dct_block_10_444; | 150 | ctx->decode_dct_block = dnxhd_decode_dct_block_10_444; |
| 151 | } | 151 | } |
| @@ -155,7 +155,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 3 unmodified lines | |||
| 155 | ctx->avctx->bits_per_raw_sample = 10; | 155 | ctx->avctx->bits_per_raw_sample = 10; |
| 156 | if (ctx->bit_depth != 10) { | 156 | if (ctx->bit_depth != 10) { |
| 157 | ff_blockdsp_init(&ctx->bdsp, ctx->avctx); | 157 | ff_blockdsp_init(&ctx->bdsp, ctx->avctx); |
| 158 | ff_dsputil_init(&ctx->dsp, ctx->avctx); | 158 | ff_idctdsp_init(&ctx->idsp, ctx->avctx); |
| 159 | ctx->bit_depth = 10; | 159 | ctx->bit_depth = 10; |
| 160 | ctx->decode_dct_block = dnxhd_decode_dct_block_10; | 160 | ctx->decode_dct_block = dnxhd_decode_dct_block_10; |
| 161 | } | 161 | } |
| @@ -164,7 +164,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 2 unmodified lines | |||
| 164 | ctx->avctx->bits_per_raw_sample = 8; | 164 | ctx->avctx->bits_per_raw_sample = 8; |
| 165 | if (ctx->bit_depth != 8) { | 165 | if (ctx->bit_depth != 8) { |
| 166 | ff_blockdsp_init(&ctx->bdsp, ctx->avctx); | 166 | ff_blockdsp_init(&ctx->bdsp, ctx->avctx); |
| 167 | ff_dsputil_init(&ctx->dsp, ctx->avctx); | 167 | ff_idctdsp_init(&ctx->idsp, ctx->avctx); |
| 168 | ctx->bit_depth = 8; | 168 | ctx->bit_depth = 8; |
| 169 | ctx->decode_dct_block = dnxhd_decode_dct_block_8; | 169 | ctx->decode_dct_block = dnxhd_decode_dct_block_8; |
| 170 | } | 170 | } |
| @@ -371,34 +371,34 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, AVFrame *frame, · 200 unmodified lines | |||
| 371 | dct_y_offset = dct_linesize_luma << 3; | 371 | dct_y_offset = dct_linesize_luma << 3; |
| 372 | dct_x_offset = 8 << shift1; | 372 | dct_x_offset = 8 << shift1; |
| 373 | if (!ctx->is_444) { | 373 | if (!ctx->is_444) { |
| 374 | ctx->dsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]); | 374 | ctx->idsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]); |
| 375 | ctx->dsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]); | 375 | ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]); |
| 376 | ctx->dsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[4]); | 376 | ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[4]); |
| 377 | ctx->dsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[5]); | 377 | ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[5]); |
| 378 | 378 | ||
| 379 | if (!(ctx->avctx->flags & CODEC_FLAG_GRAY)) { | 379 | if (!(ctx->avctx->flags & CODEC_FLAG_GRAY)) { |
| 380 | dct_y_offset = dct_linesize_chroma << 3; | 380 | dct_y_offset = dct_linesize_chroma << 3; |
| 381 | ctx->dsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]); | 381 | ctx->idsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]); |
| 382 | ctx->dsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[3]); | 382 | ctx->idsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[3]); |
| 383 | ctx->dsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[6]); | 383 | ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[6]); |
| 384 | ctx->dsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[7]); | 384 | ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[7]); |
| 385 | } | 385 | } |
| 386 | } else { | 386 | } else { |
| 387 | ctx->dsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]); | 387 | ctx->idsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]); |
| 388 | ctx->dsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]); | 388 | ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]); |
| 389 | ctx->dsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[6]); | 389 | ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[6]); |
| 390 | ctx->dsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[7]); | 390 | ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[7]); |
| 391 | 391 | ||
| 392 | if (!(ctx->avctx->flags & CODEC_FLAG_GRAY)) { | 392 | if (!(ctx->avctx->flags & CODEC_FLAG_GRAY)) { |
| 393 | dct_y_offset = dct_linesize_chroma << 3; | 393 | dct_y_offset = dct_linesize_chroma << 3; |
| 394 | ctx->dsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]); | 394 | ctx->idsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]); |
| 395 | ctx->dsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, ctx->blocks[3]); | 395 | ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, ctx->blocks[3]); |
| 396 | ctx->dsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[8]); | 396 | ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[8]); |
| 397 | ctx->dsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, ctx->blocks[9]); | 397 | ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, ctx->blocks[9]); |
| 398 | ctx->dsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[4]); | 398 | ctx->idsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[4]); |
| 399 | ctx->dsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, ctx->blocks[5]); | 399 | ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, ctx->blocks[5]); |
| 400 | ctx->dsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[10]); | 400 | ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[10]); |
| 401 | ctx->dsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, ctx->blocks[11]); | 401 | ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, ctx->blocks[11]); |
| 402 | } | 402 | } |
| 403 | } | 403 | } |
| 404 | 404 | ||
| @@ -209,14 +209,14 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) · 208 unmodified lines | |||
| 209 | 209 | ||
| 210 | if (ctx->cid_table->bit_depth == 8) { | 210 | if (ctx->cid_table->bit_depth == 8) { |
| 211 | for (i = 1; i < 64; i++) { | 211 | for (i = 1; i < 64; i++) { |
| 212 | int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]]; | 212 | int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 213 | weight_matrix[j] = ctx->cid_table->luma_weight[i]; | 213 | weight_matrix[j] = ctx->cid_table->luma_weight[i]; |
| 214 | } | 214 | } |
| 215 | ff_convert_matrix(&ctx->m, ctx->qmatrix_l, ctx->qmatrix_l16, | 215 | ff_convert_matrix(&ctx->m, ctx->qmatrix_l, ctx->qmatrix_l16, |
| 216 | weight_matrix, ctx->m.intra_quant_bias, 1, | 216 | weight_matrix, ctx->m.intra_quant_bias, 1, |
| 217 | ctx->m.avctx->qmax, 1); | 217 | ctx->m.avctx->qmax, 1); |
| 218 | for (i = 1; i < 64; i++) { | 218 | for (i = 1; i < 64; i++) { |
| 219 | int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]]; | 219 | int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 220 | weight_matrix[j] = ctx->cid_table->chroma_weight[i]; | 220 | weight_matrix[j] = ctx->cid_table->chroma_weight[i]; |
| 221 | } | 221 | } |
| 222 | ff_convert_matrix(&ctx->m, ctx->qmatrix_c, ctx->qmatrix_c16, | 222 | ff_convert_matrix(&ctx->m, ctx->qmatrix_c, ctx->qmatrix_c16, |
| @@ -237,7 +237,7 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) · 14 unmodified lines | |||
| 237 | // 10-bit | 237 | // 10-bit |
| 238 | for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) { | 238 | for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) { |
| 239 | for (i = 1; i < 64; i++) { | 239 | for (i = 1; i < 64; i++) { |
| 240 | int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]]; | 240 | int j = ctx->m.idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 241 | 241 | ||
| 242 | /* The quantization formula from the VC-3 standard is: | 242 | /* The quantization formula from the VC-3 standard is: |
| 243 | * quantized = sign(block[i]) * floor(abs(block[i]/s) * p / | 243 | * quantized = sign(block[i]) * floor(abs(block[i]/s) * p / |
| @@ -322,6 +322,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx) · 78 unmodified lines | |||
| 322 | avctx->bits_per_raw_sample = ctx->cid_table->bit_depth; | 322 | avctx->bits_per_raw_sample = ctx->cid_table->bit_depth; |
| 323 | 323 | ||
| 324 | ff_blockdsp_init(&ctx->bdsp, avctx); | 324 | ff_blockdsp_init(&ctx->bdsp, avctx); |
| 325 | ff_idctdsp_init(&ctx->m.idsp, avctx); | ||
| 325 | ff_dct_common_init(&ctx->m); | 326 | ff_dct_common_init(&ctx->m); |
| 326 | ff_dct_encode_init(&ctx->m); | 327 | ff_dct_encode_init(&ctx->m); |
| 327 | 328 | ||
| @@ -648,7 +649,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, · 320 unmodified lines | |||
| 648 | 649 | ||
| 649 | if (avctx->mb_decision == FF_MB_DECISION_RD || !RC_VARIANCE) { | 650 | if (avctx->mb_decision == FF_MB_DECISION_RD || !RC_VARIANCE) { |
| 650 | dnxhd_unquantize_c(ctx, block, i, qscale, last_index); | 651 | dnxhd_unquantize_c(ctx, block, i, qscale, last_index); |
| 651 | ctx->m.dsp.idct(block); | 652 | ctx->m.idsp.idct(block); |
| 652 | ssd += dnxhd_ssd_block(block, src_block); | 653 | ssd += dnxhd_ssd_block(block, src_block); |
| 653 | } | 654 | } |
| 654 | } | 655 | } |
| @@ -34,7 +34,6 @@ · 33 unmodified lines | |||
| 34 | #include "dsputil.h" | 34 | #include "dsputil.h" |
| 35 | #include "simple_idct.h" | 35 | #include "simple_idct.h" |
| 36 | #include "faandct.h" | 36 | #include "faandct.h" |
| 37 | #include "faanidct.h" | ||
| 38 | #include "imgconvert.h" | 37 | #include "imgconvert.h" |
| 39 | #include "mathops.h" | 38 | #include "mathops.h" |
| 40 | #include "mpegvideo.h" | 39 | #include "mpegvideo.h" |
| @@ -49,60 +48,6 @@ uint32_t ff_square_tab[512] = { 0, }; · 8 unmodified lines | |||
| 49 | #define BIT_DEPTH 8 | 48 | #define BIT_DEPTH 8 |
| 50 | #include "dsputilenc_template.c" | 49 | #include "dsputilenc_template.c" |
| 51 | 50 | ||
| 52 | av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, | ||
| 53 | const uint8_t *src_scantable) | ||
| 54 | { | ||
| 55 | int i, end; | ||
| 56 | |||
| 57 | st->scantable = src_scantable; | ||
| 58 | |||
| 59 | for (i = 0; i < 64; i++) { | ||
| 60 | int j = src_scantable[i]; | ||
| 61 | st->permutated[i] = permutation[j]; | ||
| 62 | } | ||
| 63 | |||
| 64 | end = -1; | ||
| 65 | for (i = 0; i < 64; i++) { | ||
| 66 | int j = st->permutated[i]; | ||
| 67 | if (j > end) | ||
| 68 | end = j; | ||
| 69 | st->raster_end[i] = end; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation, | ||
| 74 | int idct_permutation_type) | ||
| 75 | { | ||
| 76 | int i; | ||
| 77 | |||
| 78 | if (ARCH_X86) | ||
| 79 | if (ff_init_scantable_permutation_x86(idct_permutation, | ||
| 80 | idct_permutation_type)) | ||
| 81 | return; | ||
| 82 | |||
| 83 | switch (idct_permutation_type) { | ||
| 84 | case FF_NO_IDCT_PERM: | ||
| 85 | for (i = 0; i < 64; i++) | ||
| 86 | idct_permutation[i] = i; | ||
| 87 | break; | ||
| 88 | case FF_LIBMPEG2_IDCT_PERM: | ||
| 89 | for (i = 0; i < 64; i++) | ||
| 90 | idct_permutation[i] = (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2); | ||
| 91 | break; | ||
| 92 | case FF_TRANSPOSE_IDCT_PERM: | ||
| 93 | for (i = 0; i < 64; i++) | ||
| 94 | idct_permutation[i] = ((i & 7) << 3) | (i >> 3); | ||
| 95 | break; | ||
| 96 | case FF_PARTTRANS_IDCT_PERM: | ||
| 97 | for (i = 0; i < 64; i++) | ||
| 98 | idct_permutation[i] = (i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3); | ||
| 99 | break; | ||
| 100 | default: | ||
| 101 | av_log(NULL, AV_LOG_ERROR, | ||
| 102 | "Internal error, IDCT permutation not set\n"); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | static int pix_sum_c(uint8_t *pix, int line_size) | 51 | static int pix_sum_c(uint8_t *pix, int line_size) |
| 107 | { | 52 | { |
| 108 | int s = 0, i, j; | 53 | int s = 0, i, j; |
| @@ -260,130 +205,6 @@ static void diff_pixels_c(int16_t *av_restrict block, const uint8_t *s1, · 151 unmodified lines | |||
| 260 | } | 205 | } |
| 261 | } | 206 | } |
| 262 | 207 | ||
| 263 | static void put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 264 | int line_size) | ||
| 265 | { | ||
| 266 | int i; | ||
| 267 | |||
| 268 | /* read the pixels */ | ||
| 269 | for (i = 0; i < 8; i++) { | ||
| 270 | pixels[0] = av_clip_uint8(block[0]); | ||
| 271 | pixels[1] = av_clip_uint8(block[1]); | ||
| 272 | pixels[2] = av_clip_uint8(block[2]); | ||
| 273 | pixels[3] = av_clip_uint8(block[3]); | ||
| 274 | pixels[4] = av_clip_uint8(block[4]); | ||
| 275 | pixels[5] = av_clip_uint8(block[5]); | ||
| 276 | pixels[6] = av_clip_uint8(block[6]); | ||
| 277 | pixels[7] = av_clip_uint8(block[7]); | ||
| 278 | |||
| 279 | pixels += line_size; | ||
| 280 | block += 8; | ||
| 281 | } | ||
| 282 | } | ||
| 283 | |||
| 284 | static void put_pixels_clamped4_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 285 | int line_size) | ||
| 286 | { | ||
| 287 | int i; | ||
| 288 | |||
| 289 | /* read the pixels */ | ||
| 290 | for(i=0;i<4;i++) { | ||
| 291 | pixels[0] = av_clip_uint8(block[0]); | ||
| 292 | pixels[1] = av_clip_uint8(block[1]); | ||
| 293 | pixels[2] = av_clip_uint8(block[2]); | ||
| 294 | pixels[3] = av_clip_uint8(block[3]); | ||
| 295 | |||
| 296 | pixels += line_size; | ||
| 297 | block += 8; | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | static void put_pixels_clamped2_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 302 | int line_size) | ||
| 303 | { | ||
| 304 | int i; | ||
| 305 | |||
| 306 | /* read the pixels */ | ||
| 307 | for(i=0;i<2;i++) { | ||
| 308 | pixels[0] = av_clip_uint8(block[0]); | ||
| 309 | pixels[1] = av_clip_uint8(block[1]); | ||
| 310 | |||
| 311 | pixels += line_size; | ||
| 312 | block += 8; | ||
| 313 | } | ||
| 314 | } | ||
| 315 | |||
| 316 | static void put_signed_pixels_clamped_c(const int16_t *block, | ||
| 317 | uint8_t *av_restrict pixels, | ||
| 318 | int line_size) | ||
| 319 | { | ||
| 320 | int i, j; | ||
| 321 | |||
| 322 | for (i = 0; i < 8; i++) { | ||
| 323 | for (j = 0; j < 8; j++) { | ||
| 324 | if (*block < -128) | ||
| 325 | *pixels = 0; | ||
| 326 | else if (*block > 127) | ||
| 327 | *pixels = 255; | ||
| 328 | else | ||
| 329 | *pixels = (uint8_t) (*block + 128); | ||
| 330 | block++; | ||
| 331 | pixels++; | ||
| 332 | } | ||
| 333 | pixels += (line_size - 8); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 337 | static void add_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 338 | int line_size) | ||
| 339 | { | ||
| 340 | int i; | ||
| 341 | |||
| 342 | /* read the pixels */ | ||
| 343 | for (i = 0; i < 8; i++) { | ||
| 344 | pixels[0] = av_clip_uint8(pixels[0] + block[0]); | ||
| 345 | pixels[1] = av_clip_uint8(pixels[1] + block[1]); | ||
| 346 | pixels[2] = av_clip_uint8(pixels[2] + block[2]); | ||
| 347 | pixels[3] = av_clip_uint8(pixels[3] + block[3]); | ||
| 348 | pixels[4] = av_clip_uint8(pixels[4] + block[4]); | ||
| 349 | pixels[5] = av_clip_uint8(pixels[5] + block[5]); | ||
| 350 | pixels[6] = av_clip_uint8(pixels[6] + block[6]); | ||
| 351 | pixels[7] = av_clip_uint8(pixels[7] + block[7]); | ||
| 352 | pixels += line_size; | ||
| 353 | block += 8; | ||
| 354 | } | ||
| 355 | } | ||
| 356 | |||
| 357 | static void add_pixels_clamped4_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 358 | int line_size) | ||
| 359 | { | ||
| 360 | int i; | ||
| 361 | |||
| 362 | /* read the pixels */ | ||
| 363 | for(i=0;i<4;i++) { | ||
| 364 | pixels[0] = av_clip_uint8(pixels[0] + block[0]); | ||
| 365 | pixels[1] = av_clip_uint8(pixels[1] + block[1]); | ||
| 366 | pixels[2] = av_clip_uint8(pixels[2] + block[2]); | ||
| 367 | pixels[3] = av_clip_uint8(pixels[3] + block[3]); | ||
| 368 | pixels += line_size; | ||
| 369 | block += 8; | ||
| 370 | } | ||
| 371 | } | ||
| 372 | |||
| 373 | static void add_pixels_clamped2_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 374 | int line_size) | ||
| 375 | { | ||
| 376 | int i; | ||
| 377 | |||
| 378 | /* read the pixels */ | ||
| 379 | for(i=0;i<2;i++) { | ||
| 380 | pixels[0] = av_clip_uint8(pixels[0] + block[0]); | ||
| 381 | pixels[1] = av_clip_uint8(pixels[1] + block[1]); | ||
| 382 | pixels += line_size; | ||
| 383 | block += 8; | ||
| 384 | } | ||
| 385 | } | ||
| 386 | |||
| 387 | static int sum_abs_dctelem_c(int16_t *block) | 208 | static int sum_abs_dctelem_c(int16_t *block) |
| 388 | { | 209 | { |
| 389 | int sum = 0, i; | 210 | int sum = 0, i; |
| @@ -1038,7 +859,7 @@ static int rd8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, · 648 unmodified lines | |||
| 1038 | s->dct_unquantize_inter(s, temp, 0, s->qscale); | 859 | s->dct_unquantize_inter(s, temp, 0, s->qscale); |
| 1039 | } | 860 | } |
| 1040 | 861 | ||
| 1041 | s->dsp.idct_add(lsrc2, 8, temp); | 862 | s->idsp.idct_add(lsrc2, 8, temp); |
| 1042 | 863 | ||
| 1043 | distortion = s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8); | 864 | distortion = s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8); |
| 1044 | 865 | ||
| @@ -1216,49 +1037,6 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c) · 171 unmodified lines | |||
| 1216 | WRAPPER8_16_SQ(rd8x8_c, rd16_c) | 1037 | WRAPPER8_16_SQ(rd8x8_c, rd16_c) |
| 1217 | WRAPPER8_16_SQ(bit8x8_c, bit16_c) | 1038 | WRAPPER8_16_SQ(bit8x8_c, bit16_c) |
| 1218 | 1039 | ||
| 1219 | static void jref_idct_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 1220 | { | ||
| 1221 | ff_j_rev_dct(block); | ||
| 1222 | put_pixels_clamped_c(block, dest, line_size); | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | static void jref_idct_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 1226 | { | ||
| 1227 | ff_j_rev_dct(block); | ||
| 1228 | add_pixels_clamped_c(block, dest, line_size); | ||
| 1229 | } | ||
| 1230 | |||
| 1231 | static void ff_jref_idct4_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 1232 | { | ||
| 1233 | ff_j_rev_dct4 (block); | ||
| 1234 | put_pixels_clamped4_c(block, dest, line_size); | ||
| 1235 | } | ||
| 1236 | static void ff_jref_idct4_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 1237 | { | ||
| 1238 | ff_j_rev_dct4 (block); | ||
| 1239 | add_pixels_clamped4_c(block, dest, line_size); | ||
| 1240 | } | ||
| 1241 | |||
| 1242 | static void ff_jref_idct2_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 1243 | { | ||
| 1244 | ff_j_rev_dct2 (block); | ||
| 1245 | put_pixels_clamped2_c(block, dest, line_size); | ||
| 1246 | } | ||
| 1247 | static void ff_jref_idct2_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 1248 | { | ||
| 1249 | ff_j_rev_dct2 (block); | ||
| 1250 | add_pixels_clamped2_c(block, dest, line_size); | ||
| 1251 | } | ||
| 1252 | |||
| 1253 | static void ff_jref_idct1_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 1254 | { | ||
| 1255 | dest[0] = av_clip_uint8((block[0] + 4)>>3); | ||
| 1256 | } | ||
| 1257 | static void ff_jref_idct1_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 1258 | { | ||
| 1259 | dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3)); | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | /* draw the edges of width 'w' of an image of size width, height */ | 1040 | /* draw the edges of width 'w' of an image of size width, height */ |
| 1263 | // FIXME: Check that this is OK for MPEG-4 interlaced. | 1041 | // FIXME: Check that this is OK for MPEG-4 interlaced. |
| 1264 | static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, | 1042 | static void draw_edges_8_c(uint8_t *buf, int wrap, int width, int height, |
| @@ -1341,58 +1119,8 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx) · 76 unmodified lines | |||
| 1341 | } | 1119 | } |
| 1342 | #endif /* CONFIG_ENCODERS */ | 1120 | #endif /* CONFIG_ENCODERS */ |
| 1343 | 1121 | ||
| 1344 | if (avctx->lowres==1) { | ||
| 1345 | c->idct_put = ff_jref_idct4_put; | ||
| 1346 | c->idct_add = ff_jref_idct4_add; | ||
| 1347 | c->idct = ff_j_rev_dct4; | ||
| 1348 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1349 | } else if (avctx->lowres==2) { | ||
| 1350 | c->idct_put = ff_jref_idct2_put; | ||
| 1351 | c->idct_add = ff_jref_idct2_add; | ||
| 1352 | c->idct = ff_j_rev_dct2; | ||
| 1353 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1354 | } else if (avctx->lowres==3) { | ||
| 1355 | c->idct_put = ff_jref_idct1_put; | ||
| 1356 | c->idct_add = ff_jref_idct1_add; | ||
| 1357 | c->idct = ff_j_rev_dct1; | ||
| 1358 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1359 | } else { | ||
| 1360 | if (avctx->bits_per_raw_sample == 10) { | ||
| 1361 | c->idct_put = ff_simple_idct_put_10; | ||
| 1362 | c->idct_add = ff_simple_idct_add_10; | ||
| 1363 | c->idct = ff_simple_idct_10; | ||
| 1364 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1365 | } else if (avctx->bits_per_raw_sample == 12) { | ||
| 1366 | c->idct_put = ff_simple_idct_put_12; | ||
| 1367 | c->idct_add = ff_simple_idct_add_12; | ||
| 1368 | c->idct = ff_simple_idct_12; | ||
| 1369 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1370 | } else { | ||
| 1371 | if (avctx->idct_algo == FF_IDCT_INT) { | ||
| 1372 | c->idct_put = jref_idct_put; | ||
| 1373 | c->idct_add = jref_idct_add; | ||
| 1374 | c->idct = ff_j_rev_dct; | ||
| 1375 | c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; | ||
| 1376 | } else if (avctx->idct_algo == FF_IDCT_FAAN) { | ||
| 1377 | c->idct_put = ff_faanidct_put; | ||
| 1378 | c->idct_add = ff_faanidct_add; | ||
| 1379 | c->idct = ff_faanidct; | ||
| 1380 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1381 | } else { // accurate/default | ||
| 1382 | c->idct_put = ff_simple_idct_put_8; | ||
| 1383 | c->idct_add = ff_simple_idct_add_8; | ||
| 1384 | c->idct = ff_simple_idct_8; | ||
| 1385 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 1386 | } | ||
| 1387 | } | ||
| 1388 | } | ||
| 1389 | |||
| 1390 | c->diff_pixels = diff_pixels_c; | 1122 | c->diff_pixels = diff_pixels_c; |
| 1391 | 1123 | ||
| 1392 | c->put_pixels_clamped = put_pixels_clamped_c; | ||
| 1393 | c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; | ||
| 1394 | c->add_pixels_clamped = add_pixels_clamped_c; | ||
| 1395 | |||
| 1396 | c->sum_abs_dctelem = sum_abs_dctelem_c; | 1124 | c->sum_abs_dctelem = sum_abs_dctelem_c; |
| 1397 | 1125 | ||
| 1398 | c->pix_sum = pix_sum_c; | 1126 | c->pix_sum = pix_sum_c; |
| @@ -1475,9 +1203,6 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx) · 76 unmodified lines | |||
| 1475 | ff_dsputil_init_ppc(c, avctx, high_bit_depth); | 1203 | ff_dsputil_init_ppc(c, avctx, high_bit_depth); |
| 1476 | if (ARCH_X86) | 1204 | if (ARCH_X86) |
| 1477 | ff_dsputil_init_x86(c, avctx, high_bit_depth); | 1205 | ff_dsputil_init_x86(c, avctx, high_bit_depth); |
| 1478 | |||
| 1479 | ff_init_scantable_permutation(c->idct_permutation, | ||
| 1480 | c->idct_permutation_type); | ||
| 1481 | } | 1206 | } |
| 1482 | 1207 | ||
| 1483 | av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) | 1208 | av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) |
| @@ -58,22 +58,6 @@ typedef int (*me_cmp_func)(struct MpegEncContext *c, · 57 unmodified lines | |||
| 58 | uint8_t *blk1 /* align width (8 or 16) */, | 58 | uint8_t *blk1 /* align width (8 or 16) */, |
| 59 | uint8_t *blk2 /* align 1 */, int line_size, int h); | 59 | uint8_t *blk2 /* align 1 */, int line_size, int h); |
| 60 | 60 | ||
| 61 | /** | ||
| 62 | * Scantable. | ||
| 63 | */ | ||
| 64 | typedef struct ScanTable { | ||
| 65 | const uint8_t *scantable; | ||
| 66 | uint8_t permutated[64]; | ||
| 67 | uint8_t raster_end[64]; | ||
| 68 | } ScanTable; | ||
| 69 | |||
| 70 | void ff_init_scantable(uint8_t *permutation, ScanTable *st, | ||
| 71 | const uint8_t *src_scantable); | ||
| 72 | void ff_init_scantable_permutation(uint8_t *idct_permutation, | ||
| 73 | int idct_permutation_type); | ||
| 74 | int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, | ||
| 75 | int idct_permutation_type); | ||
| 76 | |||
| 77 | /** | 61 | /** |
| 78 | * DSPContext. | 62 | * DSPContext. |
| 79 | */ | 63 | */ |
| @@ -86,15 +70,6 @@ typedef struct DSPContext { · 6 unmodified lines | |||
| 86 | const uint8_t *s1 /* align 8 */, | 70 | const uint8_t *s1 /* align 8 */, |
| 87 | const uint8_t *s2 /* align 8 */, | 71 | const uint8_t *s2 /* align 8 */, |
| 88 | int stride); | 72 | int stride); |
| 89 | void (*put_pixels_clamped)(const int16_t *block /* align 16 */, | ||
| 90 | uint8_t *pixels /* align 8 */, | ||
| 91 | int line_size); | ||
| 92 | void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */, | ||
| 93 | uint8_t *pixels /* align 8 */, | ||
| 94 | int line_size); | ||
| 95 | void (*add_pixels_clamped)(const int16_t *block /* align 16 */, | ||
| 96 | uint8_t *pixels /* align 8 */, | ||
| 97 | int line_size); | ||
| 98 | int (*sum_abs_dctelem)(int16_t *block /* align 16 */); | 73 | int (*sum_abs_dctelem)(int16_t *block /* align 16 */); |
| 99 | 74 | ||
| 100 | int (*pix_sum)(uint8_t *pix, int line_size); | 75 | int (*pix_sum)(uint8_t *pix, int line_size); |
| @@ -128,47 +103,6 @@ typedef struct DSPContext { · 27 unmodified lines | |||
| 128 | void (*fdct)(int16_t *block /* align 16 */); | 103 | void (*fdct)(int16_t *block /* align 16 */); |
| 129 | void (*fdct248)(int16_t *block /* align 16 */); | 104 | void (*fdct248)(int16_t *block /* align 16 */); |
| 130 | 105 | ||
| 131 | /* IDCT really */ | ||
| 132 | void (*idct)(int16_t *block /* align 16 */); | ||
| 133 | |||
| 134 | /** | ||
| 135 | * block -> idct -> clip to unsigned 8 bit -> dest. | ||
| 136 | * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...) | ||
| 137 | * @param line_size size in bytes of a horizontal line of dest | ||
| 138 | */ | ||
| 139 | void (*idct_put)(uint8_t *dest /* align 8 */, | ||
| 140 | int line_size, int16_t *block /* align 16 */); | ||
| 141 | |||
| 142 | /** | ||
| 143 | * block -> idct -> add dest -> clip to unsigned 8 bit -> dest. | ||
| 144 | * @param line_size size in bytes of a horizontal line of dest | ||
| 145 | */ | ||
| 146 | void (*idct_add)(uint8_t *dest /* align 8 */, | ||
| 147 | int line_size, int16_t *block /* align 16 */); | ||
| 148 | |||
| 149 | /** | ||
| 150 | * IDCT input permutation. | ||
| 151 | * Several optimized IDCTs need a permutated input (relative to the | ||
| 152 | * normal order of the reference IDCT). | ||
| 153 | * This permutation must be performed before the idct_put/add. | ||
| 154 | * Note, normally this can be merged with the zigzag/alternate scan<br> | ||
| 155 | * An example to avoid confusion: | ||
| 156 | * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) | ||
| 157 | * - (x -> reference DCT -> reference IDCT -> x) | ||
| 158 | * - (x -> reference DCT -> simple_mmx_perm = idct_permutation | ||
| 159 | * -> simple_idct_mmx -> x) | ||
| 160 | * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant | ||
| 161 | * -> simple_idct_mmx -> ...) | ||
| 162 | */ | ||
| 163 | uint8_t idct_permutation[64]; | ||
| 164 | int idct_permutation_type; | ||
| 165 | #define FF_NO_IDCT_PERM 1 | ||
| 166 | #define FF_LIBMPEG2_IDCT_PERM 2 | ||
| 167 | #define FF_SIMPLE_IDCT_PERM 3 | ||
| 168 | #define FF_TRANSPOSE_IDCT_PERM 4 | ||
| 169 | #define FF_PARTTRANS_IDCT_PERM 5 | ||
| 170 | #define FF_SSE2_IDCT_PERM 6 | ||
| 171 | |||
| 172 | int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], | 106 | int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], |
| 173 | int16_t basis[64], int scale); | 107 | int16_t basis[64], int scale); |
| 174 | void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale); | 108 | void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale); |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | #include "libavutil/imgutils.h" | 40 | #include "libavutil/imgutils.h" |
| 41 | #include "libavutil/pixdesc.h" | 41 | #include "libavutil/pixdesc.h" |
| 42 | #include "avcodec.h" | 42 | #include "avcodec.h" |
| 43 | #include "idctdsp.h" | ||
| 43 | #include "internal.h" | 44 | #include "internal.h" |
| 44 | #include "get_bits.h" | 45 | #include "get_bits.h" |
| 45 | #include "put_bits.h" | 46 | #include "put_bits.h" |
| @@ -62,24 +63,24 @@ static const int dv_iweight_bits = 14; · 16 unmodified lines | |||
| 62 | static av_cold int dvvideo_decode_init(AVCodecContext *avctx) | 63 | static av_cold int dvvideo_decode_init(AVCodecContext *avctx) |
| 63 | { | 64 | { |
| 64 | DVVideoContext *s = avctx->priv_data; | 65 | DVVideoContext *s = avctx->priv_data; |
| 65 | DSPContext dsp; | 66 | IDCTDSPContext idsp; |
| 66 | int i; | 67 | int i; |
| 67 | 68 | ||
| 68 | memset(&dsp,0, sizeof(dsp)); | 69 | memset(&idsp,0, sizeof(idsp)); |
| 69 | ff_dsputil_init(&dsp, avctx); | 70 | ff_idctdsp_init(&idsp, avctx); |
| 70 | 71 | ||
| 71 | for (i = 0; i < 64; i++) | 72 | for (i = 0; i < 64; i++) |
| 72 | s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]]; | 73 | s->dv_zigzag[0][i] = idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 73 | 74 | ||
| 74 | if (avctx->lowres){ | 75 | if (avctx->lowres){ |
| 75 | for (i = 0; i < 64; i++){ | 76 | for (i = 0; i < 64; i++){ |
| 76 | int j = ff_dv_zigzag248_direct[i]; | 77 | int j = ff_dv_zigzag248_direct[i]; |
| 77 | s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2]; | 78 | s->dv_zigzag[1][i] = idsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2]; |
| 78 | } | 79 | } |
| 79 | }else | 80 | }else |
| 80 | memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, sizeof(s->dv_zigzag[1])); | 81 | memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, sizeof(s->dv_zigzag[1])); |
| 81 | 82 | ||
| 82 | s->idct_put[0] = dsp.idct_put; | 83 | s->idct_put[0] = idsp.idct_put; |
| 83 | s->idct_put[1] = ff_simple_idct248_put; | 84 | s->idct_put[1] = ff_simple_idct248_put; |
| 84 | 85 | ||
| 85 | return ff_dvvideo_init(avctx); | 86 | return ff_dvvideo_init(avctx); |
| @@ -110,7 +110,7 @@ static void fill_quantization_matrices(AVCodecContext *avctx, · 109 unmodified lines | |||
| 110 | for (i = 0; i < 4; i++) | 110 | for (i = 0; i < 4; i++) |
| 111 | qm->bNewQmatrix[i] = 1; | 111 | qm->bNewQmatrix[i] = 1; |
| 112 | for (i = 0; i < 64; i++) { | 112 | for (i = 0; i < 64; i++) { |
| 113 | int n = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 113 | int n = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 114 | qm->Qmatrix[0][i] = s->intra_matrix[n]; | 114 | qm->Qmatrix[0][i] = s->intra_matrix[n]; |
| 115 | qm->Qmatrix[1][i] = s->inter_matrix[n]; | 115 | qm->Qmatrix[1][i] = s->inter_matrix[n]; |
| 116 | qm->Qmatrix[2][i] = s->chroma_intra_matrix[n]; | 116 | qm->Qmatrix[2][i] = s->chroma_intra_matrix[n]; |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | |||
| 33 | #include "get_bits.h" | 33 | #include "get_bits.h" |
| 34 | #include "aandcttab.h" | 34 | #include "aandcttab.h" |
| 35 | #include "eaidct.h" | 35 | #include "eaidct.h" |
| 36 | #include "idctdsp.h" | ||
| 36 | #include "internal.h" | 37 | #include "internal.h" |
| 37 | #include "mpeg12.h" | 38 | #include "mpeg12.h" |
| 38 | #include "mpeg12data.h" | 39 | #include "mpeg12data.h" |
| @@ -47,7 +48,7 @@ typedef struct MadContext { · 8 unmodified lines | |||
| 47 | AVCodecContext *avctx; | 48 | AVCodecContext *avctx; |
| 48 | BlockDSPContext bdsp; | 49 | BlockDSPContext bdsp; |
| 49 | BswapDSPContext bbdsp; | 50 | BswapDSPContext bbdsp; |
| 50 | DSPContext dsp; | 51 | IDCTDSPContext idsp; |
| 51 | AVFrame *last_frame; | 52 | AVFrame *last_frame; |
| 52 | GetBitContext gb; | 53 | GetBitContext gb; |
| 53 | void *bitstream_buf; | 54 | void *bitstream_buf; |
| @@ -66,9 +67,9 @@ static av_cold int decode_init(AVCodecContext *avctx) · 12 unmodified lines | |||
| 66 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; | 67 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| 67 | ff_blockdsp_init(&s->bdsp, avctx); | 68 | ff_blockdsp_init(&s->bdsp, avctx); |
| 68 | ff_bswapdsp_init(&s->bbdsp); | 69 | ff_bswapdsp_init(&s->bbdsp); |
| 69 | ff_dsputil_init(&s->dsp, avctx); | 70 | ff_idctdsp_init(&s->idsp, avctx); |
| 70 | ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM); | 71 | ff_init_scantable_permutation(s->idsp.idct_permutation, FF_NO_IDCT_PERM); |
| 71 | ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); | 72 | ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct); |
| 72 | ff_mpeg12_init_vlcs(); | 73 | ff_mpeg12_init_vlcs(); |
| 73 | 74 | ||
| 74 | s->last_frame = av_frame_alloc(); | 75 | s->last_frame = av_frame_alloc(); |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | |||
| 32 | #define BITSTREAM_READER_LE | 32 | #define BITSTREAM_READER_LE |
| 33 | #include "get_bits.h" | 33 | #include "get_bits.h" |
| 34 | #include "bytestream.h" | 34 | #include "bytestream.h" |
| 35 | #include "dsputil.h" | 35 | #include "idctdsp.h" |
| 36 | #include "aandcttab.h" | 36 | #include "aandcttab.h" |
| 37 | #include "eaidct.h" | 37 | #include "eaidct.h" |
| 38 | #include "internal.h" | 38 | #include "internal.h" |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | #include "get_bits.h" | 32 | #include "get_bits.h" |
| 33 | #include "aandcttab.h" | 33 | #include "aandcttab.h" |
| 34 | #include "eaidct.h" | 34 | #include "eaidct.h" |
| 35 | #include "idctdsp.h" | ||
| 35 | #include "internal.h" | 36 | #include "internal.h" |
| 36 | #include "mpeg12.h" | 37 | #include "mpeg12.h" |
| 37 | #include "mpegvideo.h" | 38 | #include "mpegvideo.h" |
| @@ -51,9 +52,9 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx) · 13 unmodified lines | |||
| 51 | s->avctx = avctx; | 52 | s->avctx = avctx; |
| 52 | ff_blockdsp_init(&s->bdsp, avctx); | 53 | ff_blockdsp_init(&s->bdsp, avctx); |
| 53 | ff_bswapdsp_init(&t->bsdsp); | 54 | ff_bswapdsp_init(&t->bsdsp); |
| 54 | ff_dsputil_init(&s->dsp, avctx); | 55 | ff_idctdsp_init(&s->idsp, avctx); |
| 55 | ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM); | 56 | ff_init_scantable_permutation(s->idsp.idct_permutation, FF_NO_IDCT_PERM); |
| 56 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); | 57 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); |
| 57 | s->qscale = 1; | 58 | s->qscale = 1; |
| 58 | avctx->time_base = (AVRational){1, 15}; | 59 | avctx->time_base = (AVRational){1, 15}; |
| 59 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; | 60 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| @@ -31,7 +31,7 @@ · 30 unmodified lines | |||
| 31 | #include "avcodec.h" | 31 | #include "avcodec.h" |
| 32 | #include "blockdsp.h" | 32 | #include "blockdsp.h" |
| 33 | #include "bytestream.h" | 33 | #include "bytestream.h" |
| 34 | #include "dsputil.h" | 34 | #include "idctdsp.h" |
| 35 | #include "get_bits.h" | 35 | #include "get_bits.h" |
| 36 | #include "internal.h" | 36 | #include "internal.h" |
| 37 | #include "mjpeg.h" | 37 | #include "mjpeg.h" |
| @@ -74,7 +74,7 @@ static const uint8_t chroma_quant[64] = { · 36 unmodified lines | |||
| 74 | 74 | ||
| 75 | typedef struct JPGContext { | 75 | typedef struct JPGContext { |
| 76 | BlockDSPContext bdsp; | 76 | BlockDSPContext bdsp; |
| 77 | DSPContext dsp; | 77 | IDCTDSPContext idsp; |
| 78 | ScanTable scantable; | 78 | ScanTable scantable; |
| 79 | 79 | ||
| 80 | VLC dc_vlc[2], ac_vlc[2]; | 80 | VLC dc_vlc[2], ac_vlc[2]; |
| @@ -153,8 +153,8 @@ static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c) · 72 unmodified lines | |||
| 153 | return ret; | 153 | return ret; |
| 154 | 154 | ||
| 155 | ff_blockdsp_init(&c->bdsp, avctx); | 155 | ff_blockdsp_init(&c->bdsp, avctx); |
| 156 | ff_dsputil_init(&c->dsp, avctx); | 156 | ff_idctdsp_init(&c->idsp, avctx); |
| 157 | ff_init_scantable(c->dsp.idct_permutation, &c->scantable, | 157 | ff_init_scantable(c->idsp.idct_permutation, &c->scantable, |
| 158 | ff_zigzag_direct); | 158 | ff_zigzag_direct); |
| 159 | 159 | ||
| 160 | return 0; | 160 | return 0; |
| @@ -279,13 +279,13 @@ static int jpg_decode_data(JPGContext *c, int width, int height, · 118 unmodified lines | |||
| 279 | if ((ret = jpg_decode_block(c, &gb, 0, | 279 | if ((ret = jpg_decode_block(c, &gb, 0, |
| 280 | c->block[i + j * 2])) != 0) | 280 | c->block[i + j * 2])) != 0) |
| 281 | return ret; | 281 | return ret; |
| 282 | c->dsp.idct(c->block[i + j * 2]); | 282 | c->idsp.idct(c->block[i + j * 2]); |
| 283 | } | 283 | } |
| 284 | } | 284 | } |
| 285 | for (i = 1; i < 3; i++) { | 285 | for (i = 1; i < 3; i++) { |
| 286 | if ((ret = jpg_decode_block(c, &gb, i, c->block[i + 3])) != 0) | 286 | if ((ret = jpg_decode_block(c, &gb, i, c->block[i + 3])) != 0) |
| 287 | return ret; | 287 | return ret; |
| 288 | c->dsp.idct(c->block[i + 3]); | 288 | c->idsp.idct(c->block[i + 3]); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | for (j = 0; j < 16; j++) { | 291 | for (j = 0; j < 16; j++) { |
| @@ -267,7 +267,7 @@ void ff_h263_pred_acdc(MpegEncContext * s, int16_t *block, int n) · 266 unmodified lines | |||
| 267 | if (a != 1024) { | 267 | if (a != 1024) { |
| 268 | ac_val -= 16; | 268 | ac_val -= 16; |
| 269 | for(i=1;i<8;i++) { | 269 | for(i=1;i<8;i++) { |
| 270 | block[s->dsp.idct_permutation[i<<3]] += ac_val[i]; | 270 | block[s->idsp.idct_permutation[i << 3]] += ac_val[i]; |
| 271 | } | 271 | } |
| 272 | pred_dc = a; | 272 | pred_dc = a; |
| 273 | } | 273 | } |
| @@ -276,7 +276,7 @@ void ff_h263_pred_acdc(MpegEncContext * s, int16_t *block, int n) · 2 unmodified lines | |||
| 276 | if (c != 1024) { | 276 | if (c != 1024) { |
| 277 | ac_val -= 16 * wrap; | 277 | ac_val -= 16 * wrap; |
| 278 | for(i=1;i<8;i++) { | 278 | for(i=1;i<8;i++) { |
| 279 | block[s->dsp.idct_permutation[i ]] += ac_val[i + 8]; | 279 | block[s->idsp.idct_permutation[i]] += ac_val[i + 8]; |
| 280 | } | 280 | } |
| 281 | pred_dc = c; | 281 | pred_dc = c; |
| 282 | } | 282 | } |
| @@ -304,10 +304,10 @@ void ff_h263_pred_acdc(MpegEncContext * s, int16_t *block, int n) · 21 unmodified lines | |||
| 304 | 304 | ||
| 305 | /* left copy */ | 305 | /* left copy */ |
| 306 | for(i=1;i<8;i++) | 306 | for(i=1;i<8;i++) |
| 307 | ac_val1[i ] = block[s->dsp.idct_permutation[i<<3]]; | 307 | ac_val1[i] = block[s->idsp.idct_permutation[i << 3]]; |
| 308 | /* top copy */ | 308 | /* top copy */ |
| 309 | for(i=1;i<8;i++) | 309 | for(i=1;i<8;i++) |
| 310 | ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]]; | 310 | ac_val1[8 + i] = block[s->idsp.idct_permutation[i]]; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | int16_t *ff_h263_pred_motion(MpegEncContext * s, int block, int dir, | 313 | int16_t *ff_h263_pred_motion(MpegEncContext * s, int block, int dir, |
| @@ -0,0 +1,311 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg 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 | * FFmpeg 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 FFmpeg; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include "config.h" | ||
| 20 | #include "libavutil/attributes.h" | ||
| 21 | #include "libavutil/common.h" | ||
| 22 | #include "avcodec.h" | ||
| 23 | #include "dct.h" | ||
| 24 | #include "faanidct.h" | ||
| 25 | #include "idctdsp.h" | ||
| 26 | #include "simple_idct.h" | ||
| 27 | |||
| 28 | av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, | ||
| 29 | const uint8_t *src_scantable) | ||
| 30 | { | ||
| 31 | int i, end; | ||
| 32 | |||
| 33 | st->scantable = src_scantable; | ||
| 34 | |||
| 35 | for (i = 0; i < 64; i++) { | ||
| 36 | int j = src_scantable[i]; | ||
| 37 | st->permutated[i] = permutation[j]; | ||
| 38 | } | ||
| 39 | |||
| 40 | end = -1; | ||
| 41 | for (i = 0; i < 64; i++) { | ||
| 42 | int j = st->permutated[i]; | ||
| 43 | if (j > end) | ||
| 44 | end = j; | ||
| 45 | st->raster_end[i] = end; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation, | ||
| 50 | int idct_permutation_type) | ||
| 51 | { | ||
| 52 | int i; | ||
| 53 | |||
| 54 | if (ARCH_X86) | ||
| 55 | if (ff_init_scantable_permutation_x86(idct_permutation, | ||
| 56 | idct_permutation_type)) | ||
| 57 | return; | ||
| 58 | |||
| 59 | switch (idct_permutation_type) { | ||
| 60 | case FF_NO_IDCT_PERM: | ||
| 61 | for (i = 0; i < 64; i++) | ||
| 62 | idct_permutation[i] = i; | ||
| 63 | break; | ||
| 64 | case FF_LIBMPEG2_IDCT_PERM: | ||
| 65 | for (i = 0; i < 64; i++) | ||
| 66 | idct_permutation[i] = (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2); | ||
| 67 | break; | ||
| 68 | case FF_TRANSPOSE_IDCT_PERM: | ||
| 69 | for (i = 0; i < 64; i++) | ||
| 70 | idct_permutation[i] = ((i & 7) << 3) | (i >> 3); | ||
| 71 | break; | ||
| 72 | case FF_PARTTRANS_IDCT_PERM: | ||
| 73 | for (i = 0; i < 64; i++) | ||
| 74 | idct_permutation[i] = (i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3); | ||
| 75 | break; | ||
| 76 | default: | ||
| 77 | av_log(NULL, AV_LOG_ERROR, | ||
| 78 | "Internal error, IDCT permutation not set\n"); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | static void put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 83 | int line_size) | ||
| 84 | { | ||
| 85 | int i; | ||
| 86 | |||
| 87 | /* read the pixels */ | ||
| 88 | for (i = 0; i < 8; i++) { | ||
| 89 | pixels[0] = av_clip_uint8(block[0]); | ||
| 90 | pixels[1] = av_clip_uint8(block[1]); | ||
| 91 | pixels[2] = av_clip_uint8(block[2]); | ||
| 92 | pixels[3] = av_clip_uint8(block[3]); | ||
| 93 | pixels[4] = av_clip_uint8(block[4]); | ||
| 94 | pixels[5] = av_clip_uint8(block[5]); | ||
| 95 | pixels[6] = av_clip_uint8(block[6]); | ||
| 96 | pixels[7] = av_clip_uint8(block[7]); | ||
| 97 | |||
| 98 | pixels += line_size; | ||
| 99 | block += 8; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | static void put_pixels_clamped4_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 104 | int line_size) | ||
| 105 | { | ||
| 106 | int i; | ||
| 107 | |||
| 108 | /* read the pixels */ | ||
| 109 | for(i=0;i<4;i++) { | ||
| 110 | pixels[0] = av_clip_uint8(block[0]); | ||
| 111 | pixels[1] = av_clip_uint8(block[1]); | ||
| 112 | pixels[2] = av_clip_uint8(block[2]); | ||
| 113 | pixels[3] = av_clip_uint8(block[3]); | ||
| 114 | |||
| 115 | pixels += line_size; | ||
| 116 | block += 8; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | static void put_pixels_clamped2_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 121 | int line_size) | ||
| 122 | { | ||
| 123 | int i; | ||
| 124 | |||
| 125 | /* read the pixels */ | ||
| 126 | for(i=0;i<2;i++) { | ||
| 127 | pixels[0] = av_clip_uint8(block[0]); | ||
| 128 | pixels[1] = av_clip_uint8(block[1]); | ||
| 129 | |||
| 130 | pixels += line_size; | ||
| 131 | block += 8; | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | static void put_signed_pixels_clamped_c(const int16_t *block, | ||
| 136 | uint8_t *av_restrict pixels, | ||
| 137 | int line_size) | ||
| 138 | { | ||
| 139 | int i, j; | ||
| 140 | |||
| 141 | for (i = 0; i < 8; i++) { | ||
| 142 | for (j = 0; j < 8; j++) { | ||
| 143 | if (*block < -128) | ||
| 144 | *pixels = 0; | ||
| 145 | else if (*block > 127) | ||
| 146 | *pixels = 255; | ||
| 147 | else | ||
| 148 | *pixels = (uint8_t) (*block + 128); | ||
| 149 | block++; | ||
| 150 | pixels++; | ||
| 151 | } | ||
| 152 | pixels += (line_size - 8); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | static void add_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 157 | int line_size) | ||
| 158 | { | ||
| 159 | int i; | ||
| 160 | |||
| 161 | /* read the pixels */ | ||
| 162 | for (i = 0; i < 8; i++) { | ||
| 163 | pixels[0] = av_clip_uint8(pixels[0] + block[0]); | ||
| 164 | pixels[1] = av_clip_uint8(pixels[1] + block[1]); | ||
| 165 | pixels[2] = av_clip_uint8(pixels[2] + block[2]); | ||
| 166 | pixels[3] = av_clip_uint8(pixels[3] + block[3]); | ||
| 167 | pixels[4] = av_clip_uint8(pixels[4] + block[4]); | ||
| 168 | pixels[5] = av_clip_uint8(pixels[5] + block[5]); | ||
| 169 | pixels[6] = av_clip_uint8(pixels[6] + block[6]); | ||
| 170 | pixels[7] = av_clip_uint8(pixels[7] + block[7]); | ||
| 171 | pixels += line_size; | ||
| 172 | block += 8; | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | static void add_pixels_clamped4_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 177 | int line_size) | ||
| 178 | { | ||
| 179 | int i; | ||
| 180 | |||
| 181 | /* read the pixels */ | ||
| 182 | for(i=0;i<4;i++) { | ||
| 183 | pixels[0] = av_clip_uint8(pixels[0] + block[0]); | ||
| 184 | pixels[1] = av_clip_uint8(pixels[1] + block[1]); | ||
| 185 | pixels[2] = av_clip_uint8(pixels[2] + block[2]); | ||
| 186 | pixels[3] = av_clip_uint8(pixels[3] + block[3]); | ||
| 187 | pixels += line_size; | ||
| 188 | block += 8; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | static void add_pixels_clamped2_c(const int16_t *block, uint8_t *av_restrict pixels, | ||
| 193 | int line_size) | ||
| 194 | { | ||
| 195 | int i; | ||
| 196 | |||
| 197 | /* read the pixels */ | ||
| 198 | for(i=0;i<2;i++) { | ||
| 199 | pixels[0] = av_clip_uint8(pixels[0] + block[0]); | ||
| 200 | pixels[1] = av_clip_uint8(pixels[1] + block[1]); | ||
| 201 | pixels += line_size; | ||
| 202 | block += 8; | ||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 206 | static void jref_idct_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 207 | { | ||
| 208 | ff_j_rev_dct(block); | ||
| 209 | put_pixels_clamped_c(block, dest, line_size); | ||
| 210 | } | ||
| 211 | |||
| 212 | static void jref_idct_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 213 | { | ||
| 214 | ff_j_rev_dct(block); | ||
| 215 | add_pixels_clamped_c(block, dest, line_size); | ||
| 216 | } | ||
| 217 | static void ff_jref_idct4_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 218 | { | ||
| 219 | ff_j_rev_dct4 (block); | ||
| 220 | put_pixels_clamped4_c(block, dest, line_size); | ||
| 221 | } | ||
| 222 | static void ff_jref_idct4_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 223 | { | ||
| 224 | ff_j_rev_dct4 (block); | ||
| 225 | add_pixels_clamped4_c(block, dest, line_size); | ||
| 226 | } | ||
| 227 | |||
| 228 | static void ff_jref_idct2_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 229 | { | ||
| 230 | ff_j_rev_dct2 (block); | ||
| 231 | put_pixels_clamped2_c(block, dest, line_size); | ||
| 232 | } | ||
| 233 | static void ff_jref_idct2_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 234 | { | ||
| 235 | ff_j_rev_dct2 (block); | ||
| 236 | add_pixels_clamped2_c(block, dest, line_size); | ||
| 237 | } | ||
| 238 | |||
| 239 | static void ff_jref_idct1_put(uint8_t *dest, int line_size, int16_t *block) | ||
| 240 | { | ||
| 241 | dest[0] = av_clip_uint8((block[0] + 4)>>3); | ||
| 242 | } | ||
| 243 | static void ff_jref_idct1_add(uint8_t *dest, int line_size, int16_t *block) | ||
| 244 | { | ||
| 245 | dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3)); | ||
| 246 | } | ||
| 247 | |||
| 248 | av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) | ||
| 249 | { | ||
| 250 | const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8; | ||
| 251 | |||
| 252 | if (avctx->lowres==1) { | ||
| 253 | c->idct_put = ff_jref_idct4_put; | ||
| 254 | c->idct_add = ff_jref_idct4_add; | ||
| 255 | c->idct = ff_j_rev_dct4; | ||
| 256 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 257 | } else if (avctx->lowres==2) { | ||
| 258 | c->idct_put = ff_jref_idct2_put; | ||
| 259 | c->idct_add = ff_jref_idct2_add; | ||
| 260 | c->idct = ff_j_rev_dct2; | ||
| 261 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 262 | } else if (avctx->lowres==3) { | ||
| 263 | c->idct_put = ff_jref_idct1_put; | ||
| 264 | c->idct_add = ff_jref_idct1_add; | ||
| 265 | c->idct = ff_j_rev_dct1; | ||
| 266 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 267 | } else { | ||
| 268 | if (avctx->bits_per_raw_sample == 10) { | ||
| 269 | c->idct_put = ff_simple_idct_put_10; | ||
| 270 | c->idct_add = ff_simple_idct_add_10; | ||
| 271 | c->idct = ff_simple_idct_10; | ||
| 272 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 273 | } else if (avctx->bits_per_raw_sample == 12) { | ||
| 274 | c->idct_put = ff_simple_idct_put_12; | ||
| 275 | c->idct_add = ff_simple_idct_add_12; | ||
| 276 | c->idct = ff_simple_idct_12; | ||
| 277 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 278 | } else { | ||
| 279 | if (avctx->idct_algo == FF_IDCT_INT) { | ||
| 280 | c->idct_put = jref_idct_put; | ||
| 281 | c->idct_add = jref_idct_add; | ||
| 282 | c->idct = ff_j_rev_dct; | ||
| 283 | c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; | ||
| 284 | } else if (avctx->idct_algo == FF_IDCT_FAAN) { | ||
| 285 | c->idct_put = ff_faanidct_put; | ||
| 286 | c->idct_add = ff_faanidct_add; | ||
| 287 | c->idct = ff_faanidct; | ||
| 288 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 289 | } else { // accurate/default | ||
| 290 | c->idct_put = ff_simple_idct_put_8; | ||
| 291 | c->idct_add = ff_simple_idct_add_8; | ||
| 292 | c->idct = ff_simple_idct_8; | ||
| 293 | c->idct_permutation_type = FF_NO_IDCT_PERM; | ||
| 294 | } | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 298 | c->put_pixels_clamped = put_pixels_clamped_c; | ||
| 299 | c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; | ||
| 300 | c->add_pixels_clamped = add_pixels_clamped_c; | ||
| 301 | |||
| 302 | if (ARCH_ARM) | ||
| 303 | ff_idctdsp_init_arm(c, avctx, high_bit_depth); | ||
| 304 | if (ARCH_PPC) | ||
| 305 | ff_idctdsp_init_ppc(c, avctx, high_bit_depth); | ||
| 306 | if (ARCH_X86) | ||
| 307 | ff_idctdsp_init_x86(c, avctx, high_bit_depth); | ||
| 308 | |||
| 309 | ff_init_scantable_permutation(c->idct_permutation, | ||
| 310 | c->idct_permutation_type); | ||
| 311 | } | ||
| @@ -0,0 +1,104 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg 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 | * FFmpeg 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 FFmpeg; 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_IDCTDSP_H | ||
| 20 | #define AVCODEC_IDCTDSP_H | ||
| 21 | |||
| 22 | #include <stdint.h> | ||
| 23 | |||
| 24 | #include "avcodec.h" | ||
| 25 | |||
| 26 | /** | ||
| 27 | * Scantable. | ||
| 28 | */ | ||
| 29 | typedef struct ScanTable { | ||
| 30 | const uint8_t *scantable; | ||
| 31 | uint8_t permutated[64]; | ||
| 32 | uint8_t raster_end[64]; | ||
| 33 | } ScanTable; | ||
| 34 | |||
| 35 | void ff_init_scantable(uint8_t *permutation, ScanTable *st, | ||
| 36 | const uint8_t *src_scantable); | ||
| 37 | void ff_init_scantable_permutation(uint8_t *idct_permutation, | ||
| 38 | int idct_permutation_type); | ||
| 39 | int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, | ||
| 40 | int idct_permutation_type); | ||
| 41 | |||
| 42 | typedef struct IDCTDSPContext { | ||
| 43 | /* pixel ops : interface with DCT */ | ||
| 44 | void (*put_pixels_clamped)(const int16_t *block /* align 16 */, | ||
| 45 | uint8_t *pixels /* align 8 */, | ||
| 46 | int line_size); | ||
| 47 | void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */, | ||
| 48 | uint8_t *pixels /* align 8 */, | ||
| 49 | int line_size); | ||
| 50 | void (*add_pixels_clamped)(const int16_t *block /* align 16 */, | ||
| 51 | uint8_t *pixels /* align 8 */, | ||
| 52 | int line_size); | ||
| 53 | |||
| 54 | void (*idct)(int16_t *block /* align 16 */); | ||
| 55 | |||
| 56 | /** | ||
| 57 | * block -> idct -> clip to unsigned 8 bit -> dest. | ||
| 58 | * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...) | ||
| 59 | * @param line_size size in bytes of a horizontal line of dest | ||
| 60 | */ | ||
| 61 | void (*idct_put)(uint8_t *dest /* align 8 */, | ||
| 62 | int line_size, int16_t *block /* align 16 */); | ||
| 63 | |||
| 64 | /** | ||
| 65 | * block -> idct -> add dest -> clip to unsigned 8 bit -> dest. | ||
| 66 | * @param line_size size in bytes of a horizontal line of dest | ||
| 67 | */ | ||
| 68 | void (*idct_add)(uint8_t *dest /* align 8 */, | ||
| 69 | int line_size, int16_t *block /* align 16 */); | ||
| 70 | |||
| 71 | /** | ||
| 72 | * IDCT input permutation. | ||
| 73 | * Several optimized IDCTs need a permutated input (relative to the | ||
| 74 | * normal order of the reference IDCT). | ||
| 75 | * This permutation must be performed before the idct_put/add. | ||
| 76 | * Note, normally this can be merged with the zigzag/alternate scan<br> | ||
| 77 | * An example to avoid confusion: | ||
| 78 | * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) | ||
| 79 | * - (x -> reference DCT -> reference IDCT -> x) | ||
| 80 | * - (x -> reference DCT -> simple_mmx_perm = idct_permutation | ||
| 81 | * -> simple_idct_mmx -> x) | ||
| 82 | * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant | ||
| 83 | * -> simple_idct_mmx -> ...) | ||
| 84 | */ | ||
| 85 | uint8_t idct_permutation[64]; | ||
| 86 | int idct_permutation_type; | ||
| 87 | #define FF_NO_IDCT_PERM 1 | ||
| 88 | #define FF_LIBMPEG2_IDCT_PERM 2 | ||
| 89 | #define FF_SIMPLE_IDCT_PERM 3 | ||
| 90 | #define FF_TRANSPOSE_IDCT_PERM 4 | ||
| 91 | #define FF_PARTTRANS_IDCT_PERM 5 | ||
| 92 | #define FF_SSE2_IDCT_PERM 6 | ||
| 93 | } IDCTDSPContext; | ||
| 94 | |||
| 95 | void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx); | ||
| 96 | |||
| 97 | void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 98 | unsigned high_bit_depth); | ||
| 99 | void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 100 | unsigned high_bit_depth); | ||
| 101 | void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 102 | unsigned high_bit_depth); | ||
| 103 | |||
| 104 | #endif /* AVCODEC_IDCTDSP_H */ | ||
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include "avcodec.h" | 25 | #include "avcodec.h" |
| 26 | #include "error_resilience.h" | 26 | #include "error_resilience.h" |
| 27 | #include "get_bits.h" | 27 | #include "get_bits.h" |
| 28 | #include "idctdsp.h" | ||
| 28 | #include "mpegvideo.h" | 29 | #include "mpegvideo.h" |
| 29 | #include "msmpeg4data.h" | 30 | #include "msmpeg4data.h" |
| 30 | #include "intrax8huf.h" | 31 | #include "intrax8huf.h" |
| @@ -643,9 +644,9 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){ · 612 unmodified lines | |||
| 643 | s->current_picture.f->linesize[!!chroma] ); | 644 | s->current_picture.f->linesize[!!chroma] ); |
| 644 | } | 645 | } |
| 645 | if(!zeros_only) | 646 | if(!zeros_only) |
| 646 | w->wdsp.idct_add (s->dest[chroma], | 647 | w->wdsp.idct_add(s->dest[chroma], |
| 647 | s->current_picture.f->linesize[!!chroma], | 648 | s->current_picture.f->linesize[!!chroma], |
| 648 | s->block[0] ); | 649 | s->block[0]); |
| 649 | 650 | ||
| 650 | block_placed: | 651 | block_placed: |
| 651 | 652 | ||
| @@ -27,5 +27,6 @@ LIBAVCODEC_$MAJOR { · 26 unmodified lines | |||
| 27 | ff_jpeg_fdct*; | 27 | ff_jpeg_fdct*; |
| 28 | ff_dnxhd_get_cid_table; | 28 | ff_dnxhd_get_cid_table; |
| 29 | ff_dnxhd_cid_table; | 29 | ff_dnxhd_cid_table; |
| 30 | ff_idctdsp_init; | ||
| 30 | local: *; | 31 | local: *; |
| 31 | }; | 32 | }; |
| @@ -35,7 +35,7 @@ · 34 unmodified lines | |||
| 35 | #include "libavutil/pixdesc.h" | 35 | #include "libavutil/pixdesc.h" |
| 36 | 36 | ||
| 37 | #include "avcodec.h" | 37 | #include "avcodec.h" |
| 38 | #include "dsputil.h" | 38 | #include "idctdsp.h" |
| 39 | #include "internal.h" | 39 | #include "internal.h" |
| 40 | #include "mjpegenc_common.h" | 40 | #include "mjpegenc_common.h" |
| 41 | #include "mpegvideo.h" | 41 | #include "mpegvideo.h" |
| @@ -43,7 +43,7 @@ · 1 unmodified line | |||
| 43 | #include "mjpegenc.h" | 43 | #include "mjpegenc.h" |
| 44 | 44 | ||
| 45 | typedef struct LJpegEncContext { | 45 | typedef struct LJpegEncContext { |
| 46 | DSPContext dsp; | 46 | IDCTDSPContext idsp; |
| 47 | ScanTable scantable; | 47 | ScanTable scantable; |
| 48 | uint16_t matrix[64]; | 48 | uint16_t matrix[64]; |
| 49 | 49 | ||
| @@ -294,8 +294,9 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx) · 244 unmodified lines | |||
| 294 | 294 | ||
| 295 | s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch)); | 295 | s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch)); |
| 296 | 296 | ||
| 297 | ff_dsputil_init(&s->dsp, avctx); | 297 | ff_idctdsp_init(&s->idsp, avctx); |
| 298 | ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); | 298 | ff_init_scantable(s->idsp.idct_permutation, &s->scantable, |
| 299 | ff_zigzag_direct); | ||
| 299 | 300 | ||
| 300 | ff_mjpeg_init_hvsample(avctx, s->hsample, s->vsample); | 301 | ff_mjpeg_init_hvsample(avctx, s->hsample, s->vsample); |
| 301 | 302 | ||
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "avcodec.h" | 30 | #include "avcodec.h" |
| 31 | #include "blockdsp.h" | 31 | #include "blockdsp.h" |
| 32 | #include "bswapdsp.h" | 32 | #include "bswapdsp.h" |
| 33 | #include "idctdsp.h" | ||
| 33 | #include "mpegvideo.h" | 34 | #include "mpegvideo.h" |
| 34 | #include "mpeg12.h" | 35 | #include "mpeg12.h" |
| 35 | #include "thread.h" | 36 | #include "thread.h" |
| @@ -38,7 +39,7 @@ typedef struct MDECContext { · 2 unmodified lines | |||
| 38 | AVCodecContext *avctx; | 39 | AVCodecContext *avctx; |
| 39 | BlockDSPContext bdsp; | 40 | BlockDSPContext bdsp; |
| 40 | BswapDSPContext bbdsp; | 41 | BswapDSPContext bbdsp; |
| 41 | DSPContext dsp; | 42 | IDCTDSPContext idsp; |
| 42 | ThreadFrame frame; | 43 | ThreadFrame frame; |
| 43 | GetBitContext gb; | 44 | GetBitContext gb; |
| 44 | ScanTable scantable; | 45 | ScanTable scantable; |
| @@ -148,14 +149,14 @@ static inline void idct_put(MDECContext *a, AVFrame *frame, int mb_x, int mb_y) · 103 unmodified lines | |||
| 148 | uint8_t *dest_cb = frame->data[1] + (mb_y * 8 * frame->linesize[1]) + mb_x * 8; | 149 | uint8_t *dest_cb = frame->data[1] + (mb_y * 8 * frame->linesize[1]) + mb_x * 8; |
| 149 | uint8_t *dest_cr = frame->data[2] + (mb_y * 8 * frame->linesize[2]) + mb_x * 8; | 150 | uint8_t *dest_cr = frame->data[2] + (mb_y * 8 * frame->linesize[2]) + mb_x * 8; |
| 150 | 151 | ||
| 151 | a->dsp.idct_put(dest_y, linesize, block[0]); | 152 | a->idsp.idct_put(dest_y, linesize, block[0]); |
| 152 | a->dsp.idct_put(dest_y + 8, linesize, block[1]); | 153 | a->idsp.idct_put(dest_y + 8, linesize, block[1]); |
| 153 | a->dsp.idct_put(dest_y + 8 * linesize, linesize, block[2]); | 154 | a->idsp.idct_put(dest_y + 8 * linesize, linesize, block[2]); |
| 154 | a->dsp.idct_put(dest_y + 8 * linesize + 8, linesize, block[3]); | 155 | a->idsp.idct_put(dest_y + 8 * linesize + 8, linesize, block[3]); |
| 155 | 156 | ||
| 156 | if (!(a->avctx->flags & CODEC_FLAG_GRAY)) { | 157 | if (!(a->avctx->flags & CODEC_FLAG_GRAY)) { |
| 157 | a->dsp.idct_put(dest_cb, frame->linesize[1], block[4]); | 158 | a->idsp.idct_put(dest_cb, frame->linesize[1], block[4]); |
| 158 | a->dsp.idct_put(dest_cr, frame->linesize[2], block[5]); | 159 | a->idsp.idct_put(dest_cr, frame->linesize[2], block[5]); |
| 159 | } | 160 | } |
| 160 | } | 161 | } |
| 161 | 162 | ||
| @@ -214,9 +215,10 @@ static av_cold int decode_init(AVCodecContext *avctx) · 52 unmodified lines | |||
| 214 | 215 | ||
| 215 | ff_blockdsp_init(&a->bdsp, avctx); | 216 | ff_blockdsp_init(&a->bdsp, avctx); |
| 216 | ff_bswapdsp_init(&a->bbdsp); | 217 | ff_bswapdsp_init(&a->bbdsp); |
| 217 | ff_dsputil_init(&a->dsp, avctx); | 218 | ff_idctdsp_init(&a->idsp, avctx); |
| 218 | ff_mpeg12_init_vlcs(); | 219 | ff_mpeg12_init_vlcs(); |
| 219 | ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_zigzag_direct); | 220 | ff_init_scantable(a->idsp.idct_permutation, &a->scantable, |
| 221 | ff_zigzag_direct); | ||
| 220 | 222 | ||
| 221 | if (avctx->idct_algo == FF_IDCT_AUTO) | 223 | if (avctx->idct_algo == FF_IDCT_AUTO) |
| 222 | avctx->idct_algo = FF_IDCT_SIMPLE; | 224 | avctx->idct_algo = FF_IDCT_SIMPLE; |
| @@ -29,8 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include "get_bits.h" | 29 | #include "get_bits.h" |
| 30 | #include "bytestream.h" | 30 | #include "bytestream.h" |
| 31 | #include "bswapdsp.h" | 31 | #include "bswapdsp.h" |
| 32 | #include "dsputil.h" | ||
| 33 | #include "hpeldsp.h" | 32 | #include "hpeldsp.h" |
| 33 | #include "idctdsp.h" | ||
| 34 | #include "thread.h" | 34 | #include "thread.h" |
| 35 | 35 | ||
| 36 | #define MIMIC_HEADER_SIZE 20 | 36 | #define MIMIC_HEADER_SIZE 20 |
| @@ -56,8 +56,8 @@ typedef struct { · 19 unmodified lines | |||
| 56 | ScanTable scantable; | 56 | ScanTable scantable; |
| 57 | BlockDSPContext bdsp; | 57 | BlockDSPContext bdsp; |
| 58 | BswapDSPContext bbdsp; | 58 | BswapDSPContext bbdsp; |
| 59 | DSPContext dsp; | ||
| 60 | HpelDSPContext hdsp; | 59 | HpelDSPContext hdsp; |
| 60 | IDCTDSPContext idsp; | ||
| 61 | VLC vlc; | 61 | VLC vlc; |
| 62 | 62 | ||
| 63 | /* Kept in the context so multithreading can have a constant to read from */ | 63 | /* Kept in the context so multithreading can have a constant to read from */ |
| @@ -152,9 +152,9 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) · 88 unmodified lines | |||
| 152 | } | 152 | } |
| 153 | ff_blockdsp_init(&ctx->bdsp, avctx); | 153 | ff_blockdsp_init(&ctx->bdsp, avctx); |
| 154 | ff_bswapdsp_init(&ctx->bbdsp); | 154 | ff_bswapdsp_init(&ctx->bbdsp); |
| 155 | ff_dsputil_init(&ctx->dsp, avctx); | ||
| 156 | ff_hpeldsp_init(&ctx->hdsp, avctx->flags); | 155 | ff_hpeldsp_init(&ctx->hdsp, avctx->flags); |
| 157 | ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag); | 156 | ff_idctdsp_init(&ctx->idsp, avctx); |
| 157 | ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable, col_zag); | ||
| 158 | 158 | ||
| 159 | for (i = 0; i < FF_ARRAY_ELEMS(ctx->frames); i++) { | 159 | for (i = 0; i < FF_ARRAY_ELEMS(ctx->frames); i++) { |
| 160 | ctx->frames[i].f = av_frame_alloc(); | 160 | ctx->frames[i].f = av_frame_alloc(); |
| @@ -303,7 +303,7 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs, · 142 unmodified lines | |||
| 303 | "block.\n"); | 303 | "block.\n"); |
| 304 | return ret; | 304 | return ret; |
| 305 | } | 305 | } |
| 306 | ctx->dsp.idct_put(dst, stride, ctx->dct_block); | 306 | ctx->idsp.idct_put(dst, stride, ctx->dct_block); |
| 307 | } else { | 307 | } else { |
| 308 | unsigned int backref = get_bits(&ctx->gb, 4); | 308 | unsigned int backref = get_bits(&ctx->gb, 4); |
| 309 | int index = (ctx->cur_index + backref) & 15; | 309 | int index = (ctx->cur_index + backref) & 15; |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | |||
| 36 | #include "avcodec.h" | 36 | #include "avcodec.h" |
| 37 | #include "blockdsp.h" | 37 | #include "blockdsp.h" |
| 38 | #include "copy_block.h" | 38 | #include "copy_block.h" |
| 39 | #include "idctdsp.h" | ||
| 39 | #include "internal.h" | 40 | #include "internal.h" |
| 40 | #include "mjpeg.h" | 41 | #include "mjpeg.h" |
| 41 | #include "mjpegdec.h" | 42 | #include "mjpegdec.h" |
| @@ -109,8 +110,9 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) · 67 unmodified lines | |||
| 109 | s->avctx = avctx; | 110 | s->avctx = avctx; |
| 110 | ff_blockdsp_init(&s->bdsp, avctx); | 111 | ff_blockdsp_init(&s->bdsp, avctx); |
| 111 | ff_hpeldsp_init(&s->hdsp, avctx->flags); | 112 | ff_hpeldsp_init(&s->hdsp, avctx->flags); |
| 112 | ff_dsputil_init(&s->dsp, avctx); | 113 | ff_idctdsp_init(&s->idsp, avctx); |
| 113 | ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); | 114 | ff_init_scantable(s->idsp.idct_permutation, &s->scantable, |
| 115 | ff_zigzag_direct); | ||
| 114 | s->buffer_size = 0; | 116 | s->buffer_size = 0; |
| 115 | s->buffer = NULL; | 117 | s->buffer = NULL; |
| 116 | s->start_code = -1; | 118 | s->start_code = -1; |
| @@ -1228,7 +1230,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, · 1111 unmodified lines | |||
| 1228 | "error y=%d x=%d\n", mb_y, mb_x); | 1230 | "error y=%d x=%d\n", mb_y, mb_x); |
| 1229 | return AVERROR_INVALIDDATA; | 1231 | return AVERROR_INVALIDDATA; |
| 1230 | } | 1232 | } |
| 1231 | s->dsp.idct_put(ptr, linesize[c], s->block); | 1233 | s->idsp.idct_put(ptr, linesize[c], s->block); |
| 1232 | if (s->bits & 7) | 1234 | if (s->bits & 7) |
| 1233 | shift_output(s, ptr, linesize[c]); | 1235 | shift_output(s, ptr, linesize[c]); |
| 1234 | } | 1236 | } |
| @@ -1315,7 +1317,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, · 80 unmodified lines | |||
| 1315 | } | 1317 | } |
| 1316 | 1318 | ||
| 1317 | if (last_scan) { | 1319 | if (last_scan) { |
| 1318 | s->dsp.idct_put(ptr, linesize, *block); | 1320 | s->idsp.idct_put(ptr, linesize, *block); |
| 1319 | if (s->bits & 7) | 1321 | if (s->bits & 7) |
| 1320 | shift_output(s, ptr, linesize); | 1322 | shift_output(s, ptr, linesize); |
| 1321 | ptr += bytes_per_pixel*8 >> s->avctx->lowres; | 1323 | ptr += bytes_per_pixel*8 >> s->avctx->lowres; |
| @@ -36,8 +36,8 @@ · 35 unmodified lines | |||
| 36 | #include "avcodec.h" | 36 | #include "avcodec.h" |
| 37 | #include "blockdsp.h" | 37 | #include "blockdsp.h" |
| 38 | #include "get_bits.h" | 38 | #include "get_bits.h" |
| 39 | #include "dsputil.h" | ||
| 40 | #include "hpeldsp.h" | 39 | #include "hpeldsp.h" |
| 40 | #include "idctdsp.h" | ||
| 41 | 41 | ||
| 42 | #define MAX_COMPONENTS 4 | 42 | #define MAX_COMPONENTS 4 |
| 43 | 43 | ||
| @@ -106,8 +106,8 @@ typedef struct MJpegDecodeContext { · 62 unmodified lines | |||
| 106 | int palette_index; | 106 | int palette_index; |
| 107 | ScanTable scantable; | 107 | ScanTable scantable; |
| 108 | BlockDSPContext bdsp; | 108 | BlockDSPContext bdsp; |
| 109 | DSPContext dsp; | ||
| 110 | HpelDSPContext hdsp; | 109 | HpelDSPContext hdsp; |
| 110 | IDCTDSPContext idsp; | ||
| 111 | 111 | ||
| 112 | int restart_interval; | 112 | int restart_interval; |
| 113 | int restart_count; | 113 | int restart_count; |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include "libavutil/pixfmt.h" | 26 | #include "libavutil/pixfmt.h" |
| 27 | 27 | ||
| 28 | #include "avcodec.h" | 28 | #include "avcodec.h" |
| 29 | #include "dsputil.h" | 29 | #include "idctdsp.h" |
| 30 | #include "put_bits.h" | 30 | #include "put_bits.h" |
| 31 | #include "mjpegenc_common.h" | 31 | #include "mjpegenc_common.h" |
| 32 | #include "mjpeg.h" | 32 | #include "mjpeg.h" |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | #include <stdint.h> | 24 | #include <stdint.h> |
| 25 | 25 | ||
| 26 | #include "avcodec.h" | 26 | #include "avcodec.h" |
| 27 | #include "dsputil.h" | 27 | #include "idctdsp.h" |
| 28 | #include "mpegvideo.h" | 28 | #include "mpegvideo.h" |
| 29 | #include "put_bits.h" | 29 | #include "put_bits.h" |
| 30 | 30 | ||
| @@ -34,8 +34,8 @@ · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | #include "avcodec.h" | 35 | #include "avcodec.h" |
| 36 | #include "bytestream.h" | 36 | #include "bytestream.h" |
| 37 | #include "dsputil.h" | ||
| 38 | #include "error_resilience.h" | 37 | #include "error_resilience.h" |
| 38 | #include "idctdsp.h" | ||
| 39 | #include "internal.h" | 39 | #include "internal.h" |
| 40 | #include "mpeg_er.h" | 40 | #include "mpeg_er.h" |
| 41 | #include "mpeg12.h" | 41 | #include "mpeg12.h" |
| @@ -1121,7 +1121,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) · 1079 unmodified lines | |||
| 1121 | /* we need some permutation to store matrices, | 1121 | /* we need some permutation to store matrices, |
| 1122 | * until MPV_common_init() sets the real permutation. */ | 1122 | * until MPV_common_init() sets the real permutation. */ |
| 1123 | for (i = 0; i < 64; i++) | 1123 | for (i = 0; i < 64; i++) |
| 1124 | s2->dsp.idct_permutation[i] = i; | 1124 | s2->idsp.idct_permutation[i] = i; |
| 1125 | 1125 | ||
| 1126 | ff_MPV_decode_defaults(s2); | 1126 | ff_MPV_decode_defaults(s2); |
| 1127 | 1127 | ||
| @@ -1355,15 +1355,15 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 227 unmodified lines | |||
| 1355 | 1355 | ||
| 1356 | /* Quantization matrices may need reordering | 1356 | /* Quantization matrices may need reordering |
| 1357 | * if DCT permutation is changed. */ | 1357 | * if DCT permutation is changed. */ |
| 1358 | memcpy(old_permutation, s->dsp.idct_permutation, 64 * sizeof(uint8_t)); | 1358 | memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t)); |
| 1359 | 1359 | ||
| 1360 | if (ff_MPV_common_init(s) < 0) | 1360 | if (ff_MPV_common_init(s) < 0) |
| 1361 | return -2; | 1361 | return -2; |
| 1362 | 1362 | ||
| 1363 | quant_matrix_rebuild(s->intra_matrix, old_permutation, s->dsp.idct_permutation); | 1363 | quant_matrix_rebuild(s->intra_matrix, old_permutation, s->idsp.idct_permutation); |
| 1364 | quant_matrix_rebuild(s->inter_matrix, old_permutation, s->dsp.idct_permutation); | 1364 | quant_matrix_rebuild(s->inter_matrix, old_permutation, s->idsp.idct_permutation); |
| 1365 | quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->dsp.idct_permutation); | 1365 | quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->idsp.idct_permutation); |
| 1366 | quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->dsp.idct_permutation); | 1366 | quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->idsp.idct_permutation); |
| 1367 | 1367 | ||
| 1368 | s1->mpeg_enc_ctx_allocated = 1; | 1368 | s1->mpeg_enc_ctx_allocated = 1; |
| 1369 | } | 1369 | } |
| @@ -1518,7 +1518,7 @@ static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], · 148 unmodified lines | |||
| 1518 | int i; | 1518 | int i; |
| 1519 | 1519 | ||
| 1520 | for (i = 0; i < 64; i++) { | 1520 | for (i = 0; i < 64; i++) { |
| 1521 | int j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 1521 | int j = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 1522 | int v = get_bits(&s->gb, 8); | 1522 | int v = get_bits(&s->gb, 8); |
| 1523 | if (v == 0) { | 1523 | if (v == 0) { |
| 1524 | av_log(s->avctx, AV_LOG_ERROR, "matrix damaged\n"); | 1524 | av_log(s->avctx, AV_LOG_ERROR, "matrix damaged\n"); |
| @@ -1589,11 +1589,11 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1) · 64 unmodified lines | |||
| 1589 | s->progressive_frame = get_bits1(&s->gb); | 1589 | s->progressive_frame = get_bits1(&s->gb); |
| 1590 | 1590 | ||
| 1591 | if (s->alternate_scan) { | 1591 | if (s->alternate_scan) { |
| 1592 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan); | 1592 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan); |
| 1593 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); | 1593 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); |
| 1594 | } else { | 1594 | } else { |
| 1595 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct); | 1595 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct); |
| 1596 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); | 1596 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); |
| 1597 | } | 1597 | } |
| 1598 | 1598 | ||
| 1599 | /* composite display not parsed */ | 1599 | /* composite display not parsed */ |
| @@ -2096,7 +2096,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, · 496 unmodified lines | |||
| 2096 | load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1); | 2096 | load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1); |
| 2097 | } else { | 2097 | } else { |
| 2098 | for (i = 0; i < 64; i++) { | 2098 | for (i = 0; i < 64; i++) { |
| 2099 | j = s->dsp.idct_permutation[i]; | 2099 | j = s->idsp.idct_permutation[i]; |
| 2100 | v = ff_mpeg1_default_intra_matrix[i]; | 2100 | v = ff_mpeg1_default_intra_matrix[i]; |
| 2101 | s->intra_matrix[j] = v; | 2101 | s->intra_matrix[j] = v; |
| 2102 | s->chroma_intra_matrix[j] = v; | 2102 | s->chroma_intra_matrix[j] = v; |
| @@ -2106,7 +2106,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, · 3 unmodified lines | |||
| 2106 | load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0); | 2106 | load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0); |
| 2107 | } else { | 2107 | } else { |
| 2108 | for (i = 0; i < 64; i++) { | 2108 | for (i = 0; i < 64; i++) { |
| 2109 | int j = s->dsp.idct_permutation[i]; | 2109 | int j = s->idsp.idct_permutation[i]; |
| 2110 | v = ff_mpeg1_default_non_intra_matrix[i]; | 2110 | v = ff_mpeg1_default_non_intra_matrix[i]; |
| 2111 | s->inter_matrix[j] = v; | 2111 | s->inter_matrix[j] = v; |
| 2112 | s->chroma_inter_matrix[j] = v; | 2112 | s->chroma_inter_matrix[j] = v; |
| @@ -2164,7 +2164,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx) · 51 unmodified lines | |||
| 2164 | s1->mpeg_enc_ctx_allocated = 1; | 2164 | s1->mpeg_enc_ctx_allocated = 1; |
| 2165 | 2165 | ||
| 2166 | for (i = 0; i < 64; i++) { | 2166 | for (i = 0; i < 64; i++) { |
| 2167 | int j = s->dsp.idct_permutation[i]; | 2167 | int j = s->idsp.idct_permutation[i]; |
| 2168 | v = ff_mpeg1_default_intra_matrix[i]; | 2168 | v = ff_mpeg1_default_intra_matrix[i]; |
| 2169 | s->intra_matrix[j] = v; | 2169 | s->intra_matrix[j] = v; |
| 2170 | s->chroma_intra_matrix[j] = v; | 2170 | s->chroma_intra_matrix[j] = v; |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include "libavutil/opt.h" | 25 | #include "libavutil/opt.h" |
| 26 | #include "error_resilience.h" | 26 | #include "error_resilience.h" |
| 27 | #include "idctdsp.h" | ||
| 27 | #include "internal.h" | 28 | #include "internal.h" |
| 28 | #include "mpegutils.h" | 29 | #include "mpegutils.h" |
| 29 | #include "mpegvideo.h" | 30 | #include "mpegvideo.h" |
| @@ -74,11 +75,11 @@ void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir) · 44 unmodified lines | |||
| 74 | n == 1 || n == 3) { | 75 | n == 1 || n == 3) { |
| 75 | /* same qscale */ | 76 | /* same qscale */ |
| 76 | for (i = 1; i < 8; i++) | 77 | for (i = 1; i < 8; i++) |
| 77 | block[s->dsp.idct_permutation[i << 3]] += ac_val[i]; | 78 | block[s->idsp.idct_permutation[i << 3]] += ac_val[i]; |
| 78 | } else { | 79 | } else { |
| 79 | /* different qscale, we must rescale */ | 80 | /* different qscale, we must rescale */ |
| 80 | for (i = 1; i < 8; i++) | 81 | for (i = 1; i < 8; i++) |
| 81 | block[s->dsp.idct_permutation[i << 3]] += ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale); | 82 | block[s->idsp.idct_permutation[i << 3]] += ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale); |
| 82 | } | 83 | } |
| 83 | } else { | 84 | } else { |
| 84 | const int xy = s->mb_x + s->mb_y * s->mb_stride - s->mb_stride; | 85 | const int xy = s->mb_x + s->mb_y * s->mb_stride - s->mb_stride; |
| @@ -89,21 +90,21 @@ void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir) · 4 unmodified lines | |||
| 89 | n == 2 || n == 3) { | 90 | n == 2 || n == 3) { |
| 90 | /* same qscale */ | 91 | /* same qscale */ |
| 91 | for (i = 1; i < 8; i++) | 92 | for (i = 1; i < 8; i++) |
| 92 | block[s->dsp.idct_permutation[i]] += ac_val[i + 8]; | 93 | block[s->idsp.idct_permutation[i]] += ac_val[i + 8]; |
| 93 | } else { | 94 | } else { |
| 94 | /* different qscale, we must rescale */ | 95 | /* different qscale, we must rescale */ |
| 95 | for (i = 1; i < 8; i++) | 96 | for (i = 1; i < 8; i++) |
| 96 | block[s->dsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale); | 97 | block[s->idsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale); |
| 97 | } | 98 | } |
| 98 | } | 99 | } |
| 99 | } | 100 | } |
| 100 | /* left copy */ | 101 | /* left copy */ |
| 101 | for (i = 1; i < 8; i++) | 102 | for (i = 1; i < 8; i++) |
| 102 | ac_val1[i] = block[s->dsp.idct_permutation[i << 3]]; | 103 | ac_val1[i] = block[s->idsp.idct_permutation[i << 3]]; |
| 103 | 104 | ||
| 104 | /* top copy */ | 105 | /* top copy */ |
| 105 | for (i = 1; i < 8; i++) | 106 | for (i = 1; i < 8; i++) |
| 106 | ac_val1[8 + i] = block[s->dsp.idct_permutation[i]]; | 107 | ac_val1[8 + i] = block[s->idsp.idct_permutation[i]]; |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 109 | /** | 110 | /** |
| @@ -1856,7 +1857,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) · 1746 unmodified lines | |||
| 1856 | 1857 | ||
| 1857 | /* load default matrixes */ | 1858 | /* load default matrixes */ |
| 1858 | for (i = 0; i < 64; i++) { | 1859 | for (i = 0; i < 64; i++) { |
| 1859 | int j = s->dsp.idct_permutation[i]; | 1860 | int j = s->idsp.idct_permutation[i]; |
| 1860 | v = ff_mpeg4_default_intra_matrix[i]; | 1861 | v = ff_mpeg4_default_intra_matrix[i]; |
| 1861 | s->intra_matrix[j] = v; | 1862 | s->intra_matrix[j] = v; |
| 1862 | s->chroma_intra_matrix[j] = v; | 1863 | s->chroma_intra_matrix[j] = v; |
| @@ -1876,14 +1877,14 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) · 13 unmodified lines | |||
| 1876 | break; | 1877 | break; |
| 1877 | 1878 | ||
| 1878 | last = v; | 1879 | last = v; |
| 1879 | j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 1880 | j = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 1880 | s->intra_matrix[j] = last; | 1881 | s->intra_matrix[j] = last; |
| 1881 | s->chroma_intra_matrix[j] = last; | 1882 | s->chroma_intra_matrix[j] = last; |
| 1882 | } | 1883 | } |
| 1883 | 1884 | ||
| 1884 | /* replicate last value */ | 1885 | /* replicate last value */ |
| 1885 | for (; i < 64; i++) { | 1886 | for (; i < 64; i++) { |
| 1886 | int j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 1887 | int j = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 1887 | s->intra_matrix[j] = last; | 1888 | s->intra_matrix[j] = last; |
| 1888 | s->chroma_intra_matrix[j] = last; | 1889 | s->chroma_intra_matrix[j] = last; |
| 1889 | } | 1890 | } |
| @@ -1899,14 +1900,14 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) · 9 unmodified lines | |||
| 1899 | break; | 1900 | break; |
| 1900 | 1901 | ||
| 1901 | last = v; | 1902 | last = v; |
| 1902 | j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 1903 | j = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 1903 | s->inter_matrix[j] = v; | 1904 | s->inter_matrix[j] = v; |
| 1904 | s->chroma_inter_matrix[j] = v; | 1905 | s->chroma_inter_matrix[j] = v; |
| 1905 | } | 1906 | } |
| 1906 | 1907 | ||
| 1907 | /* replicate last value */ | 1908 | /* replicate last value */ |
| 1908 | for (; i < 64; i++) { | 1909 | for (; i < 64; i++) { |
| 1909 | int j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 1910 | int j = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 1910 | s->inter_matrix[j] = last; | 1911 | s->inter_matrix[j] = last; |
| 1911 | s->chroma_inter_matrix[j] = last; | 1912 | s->chroma_inter_matrix[j] = last; |
| 1912 | } | 1913 | } |
| @@ -2382,15 +2383,15 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) · 469 unmodified lines | |||
| 2382 | } | 2383 | } |
| 2383 | 2384 | ||
| 2384 | if (s->alternate_scan) { | 2385 | if (s->alternate_scan) { |
| 2385 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan); | 2386 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan); |
| 2386 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); | 2387 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); |
| 2387 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan); | 2388 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan); |
| 2388 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); | 2389 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); |
| 2389 | } else { | 2390 | } else { |
| 2390 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct); | 2391 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct); |
| 2391 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); | 2392 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); |
| 2392 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); | 2393 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); |
| 2393 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); | 2394 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); |
| 2394 | } | 2395 | } |
| 2395 | 2396 | ||
| 2396 | if (s->pict_type == AV_PICTURE_TYPE_S && | 2397 | if (s->pict_type == AV_PICTURE_TYPE_S && |
| @@ -110,11 +110,11 @@ static inline void restore_ac_coeffs(MpegEncContext *s, int16_t block[6][64], · 109 unmodified lines | |||
| 110 | if (dir[n]) { | 110 | if (dir[n]) { |
| 111 | /* top prediction */ | 111 | /* top prediction */ |
| 112 | for (i = 1; i < 8; i++) | 112 | for (i = 1; i < 8; i++) |
| 113 | block[n][s->dsp.idct_permutation[i]] = ac_val[i + 8]; | 113 | block[n][s->idsp.idct_permutation[i]] = ac_val[i + 8]; |
| 114 | } else { | 114 | } else { |
| 115 | /* left prediction */ | 115 | /* left prediction */ |
| 116 | for (i = 1; i < 8; i++) | 116 | for (i = 1; i < 8; i++) |
| 117 | block[n][s->dsp.idct_permutation[i << 3]] = ac_val[i]; | 117 | block[n][s->idsp.idct_permutation[i << 3]] = ac_val[i]; |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| @@ -152,17 +152,17 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], · 31 unmodified lines | |||
| 152 | if (s->mb_y == 0 || s->qscale == qscale_table[xy] || n == 2 || n == 3) { | 152 | if (s->mb_y == 0 || s->qscale == qscale_table[xy] || n == 2 || n == 3) { |
| 153 | /* same qscale */ | 153 | /* same qscale */ |
| 154 | for (i = 1; i < 8; i++) { | 154 | for (i = 1; i < 8; i++) { |
| 155 | const int level = block[n][s->dsp.idct_permutation[i]]; | 155 | const int level = block[n][s->idsp.idct_permutation[i]]; |
| 156 | block[n][s->dsp.idct_permutation[i]] = level - ac_val[i + 8]; | 156 | block[n][s->idsp.idct_permutation[i]] = level - ac_val[i + 8]; |
| 157 | ac_val1[i] = block[n][s->dsp.idct_permutation[i << 3]]; | 157 | ac_val1[i] = block[n][s->idsp.idct_permutation[i << 3]]; |
| 158 | ac_val1[i + 8] = level; | 158 | ac_val1[i + 8] = level; |
| 159 | } | 159 | } |
| 160 | } else { | 160 | } else { |
| 161 | /* different qscale, we must rescale */ | 161 | /* different qscale, we must rescale */ |
| 162 | for (i = 1; i < 8; i++) { | 162 | for (i = 1; i < 8; i++) { |
| 163 | const int level = block[n][s->dsp.idct_permutation[i]]; | 163 | const int level = block[n][s->idsp.idct_permutation[i]]; |
| 164 | block[n][s->dsp.idct_permutation[i]] = level - ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale); | 164 | block[n][s->idsp.idct_permutation[i]] = level - ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale); |
| 165 | ac_val1[i] = block[n][s->dsp.idct_permutation[i << 3]]; | 165 | ac_val1[i] = block[n][s->idsp.idct_permutation[i << 3]]; |
| 166 | ac_val1[i + 8] = level; | 166 | ac_val1[i + 8] = level; |
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| @@ -174,18 +174,18 @@ static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], · 5 unmodified lines | |||
| 174 | if (s->mb_x == 0 || s->qscale == qscale_table[xy] || n == 1 || n == 3) { | 174 | if (s->mb_x == 0 || s->qscale == qscale_table[xy] || n == 1 || n == 3) { |
| 175 | /* same qscale */ | 175 | /* same qscale */ |
| 176 | for (i = 1; i < 8; i++) { | 176 | for (i = 1; i < 8; i++) { |
| 177 | const int level = block[n][s->dsp.idct_permutation[i << 3]]; | 177 | const int level = block[n][s->idsp.idct_permutation[i << 3]]; |
| 178 | block[n][s->dsp.idct_permutation[i << 3]] = level - ac_val[i]; | 178 | block[n][s->idsp.idct_permutation[i << 3]] = level - ac_val[i]; |
| 179 | ac_val1[i] = level; | 179 | ac_val1[i] = level; |
| 180 | ac_val1[i + 8] = block[n][s->dsp.idct_permutation[i]]; | 180 | ac_val1[i + 8] = block[n][s->idsp.idct_permutation[i]]; |
| 181 | } | 181 | } |
| 182 | } else { | 182 | } else { |
| 183 | /* different qscale, we must rescale */ | 183 | /* different qscale, we must rescale */ |
| 184 | for (i = 1; i < 8; i++) { | 184 | for (i = 1; i < 8; i++) { |
| 185 | const int level = block[n][s->dsp.idct_permutation[i << 3]]; | 185 | const int level = block[n][s->idsp.idct_permutation[i << 3]]; |
| 186 | block[n][s->dsp.idct_permutation[i << 3]] = level - ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale); | 186 | block[n][s->idsp.idct_permutation[i << 3]] = level - ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale); |
| 187 | ac_val1[i] = level; | 187 | ac_val1[i] = level; |
| 188 | ac_val1[i + 8] = block[n][s->dsp.idct_permutation[i]]; | 188 | ac_val1[i + 8] = block[n][s->idsp.idct_permutation[i]]; |
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| 191 | st[n] = s->intra_v_scantable.permutated; | 191 | st[n] = s->intra_v_scantable.permutated; |
| @@ -34,8 +34,8 @@ · 33 unmodified lines | |||
| 34 | #include "libavutil/timer.h" | 34 | #include "libavutil/timer.h" |
| 35 | #include "avcodec.h" | 35 | #include "avcodec.h" |
| 36 | #include "blockdsp.h" | 36 | #include "blockdsp.h" |
| 37 | #include "dsputil.h" | ||
| 38 | #include "h264chroma.h" | 37 | #include "h264chroma.h" |
| 38 | #include "idctdsp.h" | ||
| 39 | #include "internal.h" | 39 | #include "internal.h" |
| 40 | #include "mathops.h" | 40 | #include "mathops.h" |
| 41 | #include "mpegutils.h" | 41 | #include "mpegutils.h" |
| @@ -383,6 +383,7 @@ av_cold int ff_dct_common_init(MpegEncContext *s) · 341 unmodified lines | |||
| 383 | ff_dsputil_init(&s->dsp, s->avctx); | 383 | ff_dsputil_init(&s->dsp, s->avctx); |
| 384 | ff_h264chroma_init(&s->h264chroma, 8); //for lowres | 384 | ff_h264chroma_init(&s->h264chroma, 8); //for lowres |
| 385 | ff_hpeldsp_init(&s->hdsp, s->avctx->flags); | 385 | ff_hpeldsp_init(&s->hdsp, s->avctx->flags); |
| 386 | ff_idctdsp_init(&s->idsp, s->avctx); | ||
| 386 | ff_mpegvideodsp_init(&s->mdsp); | 387 | ff_mpegvideodsp_init(&s->mdsp); |
| 387 | ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); | 388 | ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); |
| 388 | 389 | ||
| @@ -421,14 +422,14 @@ av_cold int ff_dct_common_init(MpegEncContext *s) · 32 unmodified lines | |||
| 421 | * note: only wmv uses different ones | 422 | * note: only wmv uses different ones |
| 422 | */ | 423 | */ |
| 423 | if (s->alternate_scan) { | 424 | if (s->alternate_scan) { |
| 424 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_alternate_vertical_scan); | 425 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan); |
| 425 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_alternate_vertical_scan); | 426 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan); |
| 426 | } else { | 427 | } else { |
| 427 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_zigzag_direct); | 428 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct); |
| 428 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_zigzag_direct); | 429 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); |
| 429 | } | 430 | } |
| 430 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); | 431 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); |
| 431 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); | 432 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); |
| 432 | 433 | ||
| 433 | return 0; | 434 | return 0; |
| 434 | } | 435 | } |
| @@ -2797,7 +2798,7 @@ static inline void put_dct(MpegEncContext *s, · 2362 unmodified lines | |||
| 2797 | int16_t *block, int i, uint8_t *dest, int line_size, int qscale) | 2798 | int16_t *block, int i, uint8_t *dest, int line_size, int qscale) |
| 2798 | { | 2799 | { |
| 2799 | s->dct_unquantize_intra(s, block, i, qscale); | 2800 | s->dct_unquantize_intra(s, block, i, qscale); |
| 2800 | s->dsp.idct_put (dest, line_size, block); | 2801 | s->idsp.idct_put(dest, line_size, block); |
| 2801 | } | 2802 | } |
| 2802 | 2803 | ||
| 2803 | /* add block[] to dest[] */ | 2804 | /* add block[] to dest[] */ |
| @@ -2805,7 +2806,7 @@ static inline void add_dct(MpegEncContext *s, · 1 unmodified line | |||
| 2805 | int16_t *block, int i, uint8_t *dest, int line_size) | 2806 | int16_t *block, int i, uint8_t *dest, int line_size) |
| 2806 | { | 2807 | { |
| 2807 | if (s->block_last_index[i] >= 0) { | 2808 | if (s->block_last_index[i] >= 0) { |
| 2808 | s->dsp.idct_add (dest, line_size, block); | 2809 | s->idsp.idct_add(dest, line_size, block); |
| 2809 | } | 2810 | } |
| 2810 | } | 2811 | } |
| 2811 | 2812 | ||
| @@ -2815,7 +2816,7 @@ static inline void add_dequant_dct(MpegEncContext *s, · 3 unmodified lines | |||
| 2815 | if (s->block_last_index[i] >= 0) { | 2816 | if (s->block_last_index[i] >= 0) { |
| 2816 | s->dct_unquantize_inter(s, block, i, qscale); | 2817 | s->dct_unquantize_inter(s, block, i, qscale); |
| 2817 | 2818 | ||
| 2818 | s->dsp.idct_add (dest, line_size, block); | 2819 | s->idsp.idct_add(dest, line_size, block); |
| 2819 | } | 2820 | } |
| 2820 | } | 2821 | } |
| 2821 | 2822 | ||
| @@ -2880,7 +2881,8 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], · 58 unmodified lines | |||
| 2880 | av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y); | 2881 | av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y); |
| 2881 | for(i=0; i<6; i++){ | 2882 | for(i=0; i<6; i++){ |
| 2882 | for(j=0; j<64; j++){ | 2883 | for(j=0; j<64; j++){ |
| 2883 | av_log(s->avctx, AV_LOG_DEBUG, "%5d", block[i][s->dsp.idct_permutation[j]]); | 2884 | av_log(s->avctx, AV_LOG_DEBUG, "%5d", |
| 2885 | block[i][s->idsp.idct_permutation[j]]); | ||
| 2884 | } | 2886 | } |
| 2885 | av_log(s->avctx, AV_LOG_DEBUG, "\n"); | 2887 | av_log(s->avctx, AV_LOG_DEBUG, "\n"); |
| 2886 | } | 2888 | } |
| @@ -3071,29 +3073,29 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], · 184 unmodified lines | |||
| 3071 | } | 3073 | } |
| 3072 | } | 3074 | } |
| 3073 | }else{ | 3075 | }else{ |
| 3074 | s->dsp.idct_put(dest_y , dct_linesize, block[0]); | 3076 | s->idsp.idct_put(dest_y, dct_linesize, block[0]); |
| 3075 | s->dsp.idct_put(dest_y + block_size, dct_linesize, block[1]); | 3077 | s->idsp.idct_put(dest_y + block_size, dct_linesize, block[1]); |
| 3076 | s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]); | 3078 | s->idsp.idct_put(dest_y + dct_offset, dct_linesize, block[2]); |
| 3077 | s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); | 3079 | s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); |
| 3078 | 3080 | ||
| 3079 | if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ | 3081 | if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
| 3080 | if(s->chroma_y_shift){ | 3082 | if(s->chroma_y_shift){ |
| 3081 | s->dsp.idct_put(dest_cb, uvlinesize, block[4]); | 3083 | s->idsp.idct_put(dest_cb, uvlinesize, block[4]); |
| 3082 | s->dsp.idct_put(dest_cr, uvlinesize, block[5]); | 3084 | s->idsp.idct_put(dest_cr, uvlinesize, block[5]); |
| 3083 | }else{ | 3085 | }else{ |
| 3084 | 3086 | ||
| 3085 | dct_linesize = uvlinesize << s->interlaced_dct; | 3087 | dct_linesize = uvlinesize << s->interlaced_dct; |
| 3086 | dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize*block_size; | 3088 | dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize*block_size; |
| 3087 | 3089 | ||
| 3088 | s->dsp.idct_put(dest_cb, dct_linesize, block[4]); | 3090 | s->idsp.idct_put(dest_cb, dct_linesize, block[4]); |
| 3089 | s->dsp.idct_put(dest_cr, dct_linesize, block[5]); | 3091 | s->idsp.idct_put(dest_cr, dct_linesize, block[5]); |
| 3090 | s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]); | 3092 | s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]); |
| 3091 | s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]); | 3093 | s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]); |
| 3092 | if(!s->chroma_x_shift){//Chroma444 | 3094 | if(!s->chroma_x_shift){//Chroma444 |
| 3093 | s->dsp.idct_put(dest_cb + block_size, dct_linesize, block[8]); | 3095 | s->idsp.idct_put(dest_cb + block_size, dct_linesize, block[8]); |
| 3094 | s->dsp.idct_put(dest_cr + block_size, dct_linesize, block[9]); | 3096 | s->idsp.idct_put(dest_cr + block_size, dct_linesize, block[9]); |
| 3095 | s->dsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize, block[10]); | 3097 | s->idsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize, block[10]); |
| 3096 | s->dsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize, block[11]); | 3098 | s->idsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize, block[11]); |
| 3097 | } | 3099 | } |
| 3098 | } | 3100 | } |
| 3099 | }//gray | 3101 | }//gray |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | |||
| 36 | #include "h264chroma.h" | 36 | #include "h264chroma.h" |
| 37 | #include "h263dsp.h" | 37 | #include "h263dsp.h" |
| 38 | #include "hpeldsp.h" | 38 | #include "hpeldsp.h" |
| 39 | #include "idctdsp.h" | ||
| 39 | #include "mpegvideodsp.h" | 40 | #include "mpegvideodsp.h" |
| 40 | #include "put_bits.h" | 41 | #include "put_bits.h" |
| 41 | #include "ratecontrol.h" | 42 | #include "ratecontrol.h" |
| @@ -362,6 +363,7 @@ typedef struct MpegEncContext { · 320 unmodified lines | |||
| 362 | DSPContext dsp; ///< pointers for accelerated dsp functions | 363 | DSPContext dsp; ///< pointers for accelerated dsp functions |
| 363 | H264ChromaContext h264chroma; | 364 | H264ChromaContext h264chroma; |
| 364 | HpelDSPContext hdsp; | 365 | HpelDSPContext hdsp; |
| 366 | IDCTDSPContext idsp; | ||
| 365 | MpegVideoDSPContext mdsp; | 367 | MpegVideoDSPContext mdsp; |
| 366 | QpelDSPContext qdsp; | 368 | QpelDSPContext qdsp; |
| 367 | VideoDSPContext vdsp; | 369 | VideoDSPContext vdsp; |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | |||
| 38 | #include "avcodec.h" | 38 | #include "avcodec.h" |
| 39 | #include "dct.h" | 39 | #include "dct.h" |
| 40 | #include "dsputil.h" | 40 | #include "dsputil.h" |
| 41 | #include "idctdsp.h" | ||
| 41 | #include "mpeg12.h" | 42 | #include "mpeg12.h" |
| 42 | #include "mpegvideo.h" | 43 | #include "mpegvideo.h" |
| 43 | #include "h261.h" | 44 | #include "h261.h" |
| @@ -87,7 +88,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], · 43 unmodified lines | |||
| 87 | dsp->fdct == ff_jpeg_fdct_islow_10 || | 88 | dsp->fdct == ff_jpeg_fdct_islow_10 || |
| 88 | dsp->fdct == ff_faandct) { | 89 | dsp->fdct == ff_faandct) { |
| 89 | for (i = 0; i < 64; i++) { | 90 | for (i = 0; i < 64; i++) { |
| 90 | const int j = dsp->idct_permutation[i]; | 91 | const int j = s->idsp.idct_permutation[i]; |
| 91 | /* 16 <= qscale * quant_matrix[i] <= 7905 | 92 | /* 16 <= qscale * quant_matrix[i] <= 7905 |
| 92 | * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] | 93 | * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] |
| 93 | * 19952 <= x <= 249205026 | 94 | * 19952 <= x <= 249205026 |
| @@ -99,7 +100,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], · 5 unmodified lines | |||
| 99 | } | 100 | } |
| 100 | } else if (dsp->fdct == ff_fdct_ifast) { | 101 | } else if (dsp->fdct == ff_fdct_ifast) { |
| 101 | for (i = 0; i < 64; i++) { | 102 | for (i = 0; i < 64; i++) { |
| 102 | const int j = dsp->idct_permutation[i]; | 103 | const int j = s->idsp.idct_permutation[i]; |
| 103 | /* 16 <= qscale * quant_matrix[i] <= 7905 | 104 | /* 16 <= qscale * quant_matrix[i] <= 7905 |
| 104 | * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] | 105 | * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] |
| 105 | * 19952 <= x <= 249205026 | 106 | * 19952 <= x <= 249205026 |
| @@ -111,7 +112,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], · 5 unmodified lines | |||
| 111 | } | 112 | } |
| 112 | } else { | 113 | } else { |
| 113 | for (i = 0; i < 64; i++) { | 114 | for (i = 0; i < 64; i++) { |
| 114 | const int j = dsp->idct_permutation[i]; | 115 | const int j = s->idsp.idct_permutation[i]; |
| 115 | /* We can safely suppose that 16 <= quant_matrix[i] <= 255 | 116 | /* We can safely suppose that 16 <= quant_matrix[i] <= 255 |
| 116 | * Assume x = qscale * quant_matrix[i] | 117 | * Assume x = qscale * quant_matrix[i] |
| 117 | * So 16 <= x <= 7905 | 118 | * So 16 <= x <= 7905 |
| @@ -866,7 +867,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) · 748 unmodified lines | |||
| 866 | 867 | ||
| 867 | /* init q matrix */ | 868 | /* init q matrix */ |
| 868 | for (i = 0; i < 64; i++) { | 869 | for (i = 0; i < 64; i++) { |
| 869 | int j = s->dsp.idct_permutation[i]; | 870 | int j = s->idsp.idct_permutation[i]; |
| 870 | if (CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4 && | 871 | if (CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4 && |
| 871 | s->mpeg_quant) { | 872 | s->mpeg_quant) { |
| 872 | s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; | 873 | s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; |
| @@ -3553,7 +3554,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) · 2680 unmodified lines | |||
| 3553 | 3554 | ||
| 3554 | /* for mjpeg, we do include qscale in the matrix */ | 3555 | /* for mjpeg, we do include qscale in the matrix */ |
| 3555 | for(i=1;i<64;i++){ | 3556 | for(i=1;i<64;i++){ |
| 3556 | int j= s->dsp.idct_permutation[i]; | 3557 | int j = s->idsp.idct_permutation[i]; |
| 3557 | 3558 | ||
| 3558 | s->chroma_intra_matrix[j] = av_clip_uint8((chroma_matrix[i] * s->qscale) >> 3); | 3559 | s->chroma_intra_matrix[j] = av_clip_uint8((chroma_matrix[i] * s->qscale) >> 3); |
| 3559 | s-> intra_matrix[j] = av_clip_uint8(( luma_matrix[i] * s->qscale) >> 3); | 3560 | s-> intra_matrix[j] = av_clip_uint8(( luma_matrix[i] * s->qscale) >> 3); |
| @@ -3572,7 +3573,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) · 12 unmodified lines | |||
| 3572 | static const uint8_t y[32]={13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}; | 3573 | static const uint8_t y[32]={13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}; |
| 3573 | static const uint8_t c[32]={14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14}; | 3574 | static const uint8_t c[32]={14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14}; |
| 3574 | for(i=1;i<64;i++){ | 3575 | for(i=1;i<64;i++){ |
| 3575 | int j= s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 3576 | int j= s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 3576 | 3577 | ||
| 3577 | s->intra_matrix[j] = sp5x_quant_table[5*2+0][i]; | 3578 | s->intra_matrix[j] = sp5x_quant_table[5*2+0][i]; |
| 3578 | s->chroma_intra_matrix[j] = sp5x_quant_table[5*2+1][i]; | 3579 | s->chroma_intra_matrix[j] = sp5x_quant_table[5*2+1][i]; |
| @@ -3806,7 +3807,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, · 227 unmodified lines | |||
| 3806 | if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ | 3807 | if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ |
| 3807 | unquant_coeff= alevel*qmul + qadd; | 3808 | unquant_coeff= alevel*qmul + qadd; |
| 3808 | }else{ //MPEG1 | 3809 | }else{ //MPEG1 |
| 3809 | j= s->dsp.idct_permutation[ scantable[i] ]; //FIXME optimize | 3810 | j = s->idsp.idct_permutation[scantable[i]]; // FIXME: optimize |
| 3810 | if(s->mb_intra){ | 3811 | if(s->mb_intra){ |
| 3811 | unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; | 3812 | unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; |
| 3812 | unquant_coeff = (unquant_coeff - 1) | 1; | 3813 | unquant_coeff = (unquant_coeff - 1) | 1; |
| @@ -4012,7 +4013,7 @@ static int messed_sign=0; · 199 unmodified lines | |||
| 4012 | #endif | 4013 | #endif |
| 4013 | 4014 | ||
| 4014 | if(basis[0][0] == 0) | 4015 | if(basis[0][0] == 0) |
| 4015 | build_basis(s->dsp.idct_permutation); | 4016 | build_basis(s->idsp.idct_permutation); |
| 4016 | 4017 | ||
| 4017 | qmul= qscale*2; | 4018 | qmul= qscale*2; |
| 4018 | qadd= (qscale-1)|1; | 4019 | qadd= (qscale-1)|1; |
| @@ -4431,8 +4432,9 @@ int ff_dct_quantize_c(MpegEncContext *s, · 412 unmodified lines | |||
| 4431 | *overflow= s->max_qcoeff < max; //overflow might have happened | 4432 | *overflow= s->max_qcoeff < max; //overflow might have happened |
| 4432 | 4433 | ||
| 4433 | /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */ | 4434 | /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */ |
| 4434 | if (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM) | 4435 | if (s->idsp.idct_permutation_type != FF_NO_IDCT_PERM) |
| 4435 | ff_block_permute(block, s->dsp.idct_permutation, scantable, last_non_zero); | 4436 | ff_block_permute(block, s->idsp.idct_permutation, |
| 4437 | scantable, last_non_zero); | ||
| 4436 | 4438 | ||
| 4437 | return last_non_zero; | 4439 | return last_non_zero; |
| 4438 | } | 4440 | } |
| @@ -320,7 +320,7 @@ static void ff_xvmc_decode_mb(struct MpegEncContext *s) · 319 unmodified lines | |||
| 320 | if (s->mb_intra && (render->idct || !render->unsigned_intra)) | 320 | if (s->mb_intra && (render->idct || !render->unsigned_intra)) |
| 321 | *s->pblocks[i][0] -= 1 << 10; | 321 | *s->pblocks[i][0] -= 1 << 10; |
| 322 | if (!render->idct) { | 322 | if (!render->idct) { |
| 323 | s->dsp.idct(*s->pblocks[i]); | 323 | s->idsp.idct(*s->pblocks[i]); |
| 324 | /* It is unclear if MC hardware requires pixel diff values to be | 324 | /* It is unclear if MC hardware requires pixel diff values to be |
| 325 | * in the range [-255;255]. TODO: Clipping if such hardware is | 325 | * in the range [-255;255]. TODO: Clipping if such hardware is |
| 326 | * ever found. As of now it would only be an unnecessary | 326 | * ever found. As of now it would only be an unnecessary |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "avcodec.h" | 30 | #include "avcodec.h" |
| 31 | #include "dsputil.h" | 31 | #include "idctdsp.h" |
| 32 | #include "mpegvideo.h" | 32 | #include "mpegvideo.h" |
| 33 | #include "msmpeg4.h" | 33 | #include "msmpeg4.h" |
| 34 | #include "libavutil/x86/asm.h" | 34 | #include "libavutil/x86/asm.h" |
| @@ -138,10 +138,10 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s) · 103 unmodified lines | |||
| 138 | 138 | ||
| 139 | 139 | ||
| 140 | if(s->msmpeg4_version>=4){ | 140 | if(s->msmpeg4_version>=4){ |
| 141 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_wmv1_scantable[1]); | 141 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]); |
| 142 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]); | 142 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]); |
| 143 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]); | 143 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]); |
| 144 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_wmv1_scantable[0]); | 144 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]); |
| 145 | } | 145 | } |
| 146 | //Note the default tables are set in common_init in mpegvideo.c | 146 | //Note the default tables are set in common_init in mpegvideo.c |
| 147 | 147 | ||
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "libavutil/lzo.h" | 29 | #include "libavutil/lzo.h" |
| 30 | #include "libavutil/imgutils.h" | 30 | #include "libavutil/imgutils.h" |
| 31 | #include "avcodec.h" | 31 | #include "avcodec.h" |
| 32 | #include "idctdsp.h" | ||
| 32 | #include "internal.h" | 33 | #include "internal.h" |
| 33 | #include "rtjpeg.h" | 34 | #include "rtjpeg.h" |
| 34 | 35 | ||
| @@ -9,6 +9,7 @@ OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o ppc/hpeldsp_altivec.o · 8 unmodified lines | |||
| 9 | OBJS-$(CONFIG_H264QPEL) += ppc/h264qpel.o | 9 | OBJS-$(CONFIG_H264QPEL) += ppc/h264qpel.o |
| 10 | OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o | 10 | OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o |
| 11 | OBJS-$(CONFIG_HUFFYUVDSP) += ppc/huffyuvdsp_altivec.o | 11 | OBJS-$(CONFIG_HUFFYUVDSP) += ppc/huffyuvdsp_altivec.o |
| 12 | OBJS-$(CONFIG_IDCTDSP) += ppc/idctdsp.o | ||
| 12 | OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o | 13 | OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o |
| 13 | OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \ | 14 | OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \ |
| 14 | ppc/mpegvideodsp.o | 15 | ppc/mpegvideodsp.o |
| @@ -24,7 +25,6 @@ OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o · 9 unmodified lines | |||
| 24 | 25 | ||
| 25 | ALTIVEC-OBJS-$(CONFIG_DSPUTIL) += ppc/dsputil_altivec.o \ | 26 | ALTIVEC-OBJS-$(CONFIG_DSPUTIL) += ppc/dsputil_altivec.o \ |
| 26 | ppc/fdct_altivec.o \ | 27 | ppc/fdct_altivec.o \ |
| 27 | ppc/idct_altivec.o \ | ||
| 28 | 28 | ||
| 29 | FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o | 29 | FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o |
| 30 | FFT-OBJS-$(HAVE_VSX) += ppc/fft_vsx.o | 30 | FFT-OBJS-$(HAVE_VSX) += ppc/fft_vsx.o |
| @@ -29,10 +29,6 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | void ff_fdct_altivec(int16_t *block); | 30 | void ff_fdct_altivec(int16_t *block); |
| 31 | 31 | ||
| 32 | void ff_idct_altivec(int16_t *block); | ||
| 33 | void ff_idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); | ||
| 34 | void ff_idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); | ||
| 35 | |||
| 36 | void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx, | 32 | void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx, |
| 37 | unsigned high_bit_depth); | 33 | unsigned high_bit_depth); |
| 38 | 34 | ||
| @@ -43,15 +43,6 @@ av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx, · 42 unmodified lines | |||
| 43 | c->fdct = ff_fdct_altivec; | 43 | c->fdct = ff_fdct_altivec; |
| 44 | } | 44 | } |
| 45 | #endif //CONFIG_ENCODERS | 45 | #endif //CONFIG_ENCODERS |
| 46 | if (avctx->lowres == 0) { | ||
| 47 | if ((avctx->idct_algo == FF_IDCT_AUTO) || | ||
| 48 | (avctx->idct_algo == FF_IDCT_ALTIVEC)) { | ||
| 49 | c->idct = ff_idct_altivec; | ||
| 50 | c->idct_put = ff_idct_put_altivec; | ||
| 51 | c->idct_add = ff_idct_add_altivec; | ||
| 52 | c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | 46 | } |
| 56 | } | 47 | } |
| 57 | } | 48 | } |
| @@ -37,8 +37,13 @@ · 36 unmodified lines | |||
| 37 | #include <altivec.h> | 37 | #include <altivec.h> |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #include "libavutil/attributes.h" | ||
| 41 | #include "libavutil/cpu.h" | ||
| 42 | #include "libavutil/ppc/cpu.h" | ||
| 40 | #include "libavutil/ppc/types_altivec.h" | 43 | #include "libavutil/ppc/types_altivec.h" |
| 41 | #include "dsputil_altivec.h" | 44 | #include "libavcodec/idctdsp.h" |
| 45 | |||
| 46 | #if HAVE_ALTIVEC | ||
| 42 | 47 | ||
| 43 | #define IDCT_HALF \ | 48 | #define IDCT_HALF \ |
| 44 | /* 1st stage */ \ | 49 | /* 1st stage */ \ |
| @@ -148,7 +153,7 @@ static const vec_s16 constants[5] = { · 103 unmodified lines | |||
| 148 | { 19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722 } | 153 | { 19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722 } |
| 149 | }; | 154 | }; |
| 150 | 155 | ||
| 151 | void ff_idct_altivec(int16_t *blk) | 156 | static void idct_altivec(int16_t *blk) |
| 152 | { | 157 | { |
| 153 | vec_s16 *block = (vec_s16 *) blk; | 158 | vec_s16 *block = (vec_s16 *) blk; |
| 154 | 159 | ||
| @@ -164,7 +169,7 @@ void ff_idct_altivec(int16_t *blk) · 9 unmodified lines | |||
| 164 | block[7] = vx7; | 169 | block[7] = vx7; |
| 165 | } | 170 | } |
| 166 | 171 | ||
| 167 | void ff_idct_put_altivec(uint8_t *dest, int stride, int16_t *blk) | 172 | static void idct_put_altivec(uint8_t *dest, int stride, int16_t *blk) |
| 168 | { | 173 | { |
| 169 | vec_s16 *block = (vec_s16 *) blk; | 174 | vec_s16 *block = (vec_s16 *) blk; |
| 170 | vec_u8 tmp; | 175 | vec_u8 tmp; |
| @@ -193,7 +198,7 @@ void ff_idct_put_altivec(uint8_t *dest, int stride, int16_t *blk) · 22 unmodified lines | |||
| 193 | COPY(dest, vx7); | 198 | COPY(dest, vx7); |
| 194 | } | 199 | } |
| 195 | 200 | ||
| 196 | void ff_idct_add_altivec(uint8_t *dest, int stride, int16_t *blk) | 201 | static void idct_add_altivec(uint8_t *dest, int stride, int16_t *blk) |
| 197 | { | 202 | { |
| 198 | vec_s16 *block = (vec_s16 *) blk; | 203 | vec_s16 *block = (vec_s16 *) blk; |
| 199 | vec_u8 tmp; | 204 | vec_u8 tmp; |
| @@ -235,3 +240,23 @@ void ff_idct_add_altivec(uint8_t *dest, int stride, int16_t *blk) · 35 unmodified lines | |||
| 235 | dest += stride; | 240 | dest += stride; |
| 236 | ADD(dest, vx7, perm1); | 241 | ADD(dest, vx7, perm1); |
| 237 | } | 242 | } |
| 243 | |||
| 244 | #endif /* HAVE_ALTIVEC */ | ||
| 245 | |||
| 246 | av_cold void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 247 | unsigned high_bit_depth) | ||
| 248 | { | ||
| 249 | #if HAVE_ALTIVEC | ||
| 250 | if (PPC_ALTIVEC(av_get_cpu_flags())) { | ||
| 251 | if (!high_bit_depth && avctx->lowres == 0) { | ||
| 252 | if ((avctx->idct_algo == FF_IDCT_AUTO) || | ||
| 253 | (avctx->idct_algo == FF_IDCT_ALTIVEC)) { | ||
| 254 | c->idct = idct_altivec; | ||
| 255 | c->idct_add = idct_add_altivec; | ||
| 256 | c->idct_put = idct_put_altivec; | ||
| 257 | c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; | ||
| 258 | } | ||
| 259 | } | ||
| 260 | } | ||
| 261 | #endif /* HAVE_ALTIVEC */ | ||
| 262 | } | ||
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | 30 | ||
| 31 | #include "avcodec.h" | 31 | #include "avcodec.h" |
| 32 | #include "get_bits.h" | 32 | #include "get_bits.h" |
| 33 | #include "idctdsp.h" | ||
| 33 | #include "internal.h" | 34 | #include "internal.h" |
| 34 | #include "simple_idct.h" | 35 | #include "simple_idct.h" |
| 35 | #include "proresdec.h" | 36 | #include "proresdec.h" |
| @@ -34,7 +34,7 @@ · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | #include "libavutil/intmath.h" | 35 | #include "libavutil/intmath.h" |
| 36 | #include "avcodec.h" | 36 | #include "avcodec.h" |
| 37 | #include "dsputil.h" | 37 | #include "idctdsp.h" |
| 38 | #include "internal.h" | 38 | #include "internal.h" |
| 39 | #include "proresdata.h" | 39 | #include "proresdata.h" |
| 40 | #include "proresdsp.h" | 40 | #include "proresdsp.h" |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | #include "config.h" | 23 | #include "config.h" |
| 24 | #include "libavutil/attributes.h" | 24 | #include "libavutil/attributes.h" |
| 25 | #include "libavutil/common.h" | 25 | #include "libavutil/common.h" |
| 26 | #include "dsputil.h" | 26 | #include "idctdsp.h" |
| 27 | #include "proresdsp.h" | 27 | #include "proresdsp.h" |
| 28 | #include "simple_idct.h" | 28 | #include "simple_idct.h" |
| 29 | 29 | ||
| @@ -121,7 +121,7 @@ int ff_rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f, · 120 unmodified lines | |||
| 121 | if (res < 0) \ | 121 | if (res < 0) \ |
| 122 | return res; \ | 122 | return res; \ |
| 123 | if (res > 0) \ | 123 | if (res > 0) \ |
| 124 | c->dsp.idct_put(dst, stride, block); \ | 124 | c->idsp.idct_put(dst, stride, block); \ |
| 125 | } while (0) | 125 | } while (0) |
| 126 | int16_t *block = c->block; | 126 | int16_t *block = c->block; |
| 127 | BLOCK(c->lquant, y1, f->linesize[0]); | 127 | BLOCK(c->lquant, y1, f->linesize[0]); |
| @@ -159,7 +159,7 @@ void ff_rtjpeg_decode_init(RTJpegContext *c, int width, int height, · 31 unmodified lines | |||
| 159 | const uint32_t *lquant, const uint32_t *cquant) { | 159 | const uint32_t *lquant, const uint32_t *cquant) { |
| 160 | int i; | 160 | int i; |
| 161 | for (i = 0; i < 64; i++) { | 161 | for (i = 0; i < 64; i++) { |
| 162 | int p = c->dsp.idct_permutation[i]; | 162 | int p = c->idsp.idct_permutation[i]; |
| 163 | c->lquant[p] = lquant[i]; | 163 | c->lquant[p] = lquant[i]; |
| 164 | c->cquant[p] = cquant[i]; | 164 | c->cquant[p] = cquant[i]; |
| 165 | } | 165 | } |
| @@ -171,13 +171,13 @@ void ff_rtjpeg_init(RTJpegContext *c, AVCodecContext *avctx) · 5 unmodified lines | |||
| 171 | { | 171 | { |
| 172 | int i; | 172 | int i; |
| 173 | 173 | ||
| 174 | ff_dsputil_init(&c->dsp, avctx); | 174 | ff_idctdsp_init(&c->idsp, avctx); |
| 175 | 175 | ||
| 176 | for (i = 0; i < 64; i++) { | 176 | for (i = 0; i < 64; i++) { |
| 177 | int z = ff_zigzag_direct[i]; | 177 | int z = ff_zigzag_direct[i]; |
| 178 | z = ((z << 3) | (z >> 3)) & 63; // rtjpeg uses a transposed variant | 178 | z = ((z << 3) | (z >> 3)) & 63; // rtjpeg uses a transposed variant |
| 179 | 179 | ||
| 180 | // permute the scan and quantization tables for the chosen idct | 180 | // permute the scan and quantization tables for the chosen idct |
| 181 | c->scan[i] = c->dsp.idct_permutation[z]; | 181 | c->scan[i] = c->idsp.idct_permutation[z]; |
| 182 | } | 182 | } |
| 183 | } | 183 | } |
| @@ -23,15 +23,16 @@ · 22 unmodified lines | |||
| 23 | #define AVCODEC_RTJPEG_H | 23 | #define AVCODEC_RTJPEG_H |
| 24 | 24 | ||
| 25 | #include <stdint.h> | 25 | #include <stdint.h> |
| 26 | #include "dsputil.h" | 26 | |
| 27 | #include "libavutil/mem.h" | 27 | #include "libavutil/mem.h" |
| 28 | #include "idctdsp.h" | ||
| 28 | 29 | ||
| 29 | #define RTJPEG_FILE_VERSION 0 | 30 | #define RTJPEG_FILE_VERSION 0 |
| 30 | #define RTJPEG_HEADER_SIZE 12 | 31 | #define RTJPEG_HEADER_SIZE 12 |
| 31 | 32 | ||
| 32 | typedef struct RTJpegContext { | 33 | typedef struct RTJpegContext { |
| 33 | int w, h; | 34 | int w, h; |
| 34 | DSPContext dsp; | 35 | IDCTDSPContext idsp; |
| 35 | uint8_t scan[64]; | 36 | uint8_t scan[64]; |
| 36 | uint32_t lquant[64]; | 37 | uint32_t lquant[64]; |
| 37 | uint32_t cquant[64]; | 38 | uint32_t cquant[64]; |
| @@ -90,7 +90,7 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_ · 89 unmodified lines | |||
| 90 | iq_matrix->load_chroma_non_intra_quantiser_matrix = 1; | 90 | iq_matrix->load_chroma_non_intra_quantiser_matrix = 1; |
| 91 | 91 | ||
| 92 | for (i = 0; i < 64; i++) { | 92 | for (i = 0; i < 64; i++) { |
| 93 | int n = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 93 | int n = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 94 | iq_matrix->intra_quantiser_matrix[i] = s->intra_matrix[n]; | 94 | iq_matrix->intra_quantiser_matrix[i] = s->intra_matrix[n]; |
| 95 | iq_matrix->non_intra_quantiser_matrix[i] = s->inter_matrix[n]; | 95 | iq_matrix->non_intra_quantiser_matrix[i] = s->inter_matrix[n]; |
| 96 | iq_matrix->chroma_intra_quantiser_matrix[i] = s->chroma_intra_matrix[n]; | 96 | iq_matrix->chroma_intra_quantiser_matrix[i] = s->chroma_intra_matrix[n]; |
| @@ -109,7 +109,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ · 108 unmodified lines | |||
| 109 | iq_matrix->load_non_intra_quant_mat = 1; | 109 | iq_matrix->load_non_intra_quant_mat = 1; |
| 110 | 110 | ||
| 111 | for (i = 0; i < 64; i++) { | 111 | for (i = 0; i < 64; i++) { |
| 112 | int n = s->dsp.idct_permutation[ff_zigzag_direct[i]]; | 112 | int n = s->idsp.idct_permutation[ff_zigzag_direct[i]]; |
| 113 | iq_matrix->intra_quant_mat[i] = s->intra_matrix[n]; | 113 | iq_matrix->intra_quant_mat[i] = s->intra_matrix[n]; |
| 114 | iq_matrix->non_intra_quant_mat[i] = s->inter_matrix[n]; | 114 | iq_matrix->non_intra_quant_mat[i] = s->inter_matrix[n]; |
| 115 | } | 115 | } |
| @@ -97,24 +97,24 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v) · 96 unmodified lines | |||
| 97 | fieldtx = v->fieldtx_plane[topleft_mb_pos]; | 97 | fieldtx = v->fieldtx_plane[topleft_mb_pos]; |
| 98 | stride_y = s->linesize << fieldtx; | 98 | stride_y = s->linesize << fieldtx; |
| 99 | v_dist = (16 - fieldtx) >> (fieldtx == 0); | 99 | v_dist = (16 - fieldtx) >> (fieldtx == 0); |
| 100 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][0], | 100 | s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][0], |
| 101 | s->dest[0] - 16 * s->linesize - 16, | 101 | s->dest[0] - 16 * s->linesize - 16, |
| 102 | stride_y); | 102 | stride_y); |
| 103 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][1], | 103 | s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][1], |
| 104 | s->dest[0] - 16 * s->linesize - 8, | 104 | s->dest[0] - 16 * s->linesize - 8, |
| 105 | stride_y); | 105 | stride_y); |
| 106 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][2], | 106 | s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][2], |
| 107 | s->dest[0] - v_dist * s->linesize - 16, | 107 | s->dest[0] - v_dist * s->linesize - 16, |
| 108 | stride_y); | 108 | stride_y); |
| 109 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][3], | 109 | s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][3], |
| 110 | s->dest[0] - v_dist * s->linesize - 8, | 110 | s->dest[0] - v_dist * s->linesize - 8, |
| 111 | stride_y); | 111 | stride_y); |
| 112 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][4], | 112 | s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][4], |
| 113 | s->dest[1] - 8 * s->uvlinesize - 8, | 113 | s->dest[1] - 8 * s->uvlinesize - 8, |
| 114 | s->uvlinesize); | 114 | s->uvlinesize); |
| 115 | s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][5], | 115 | s->idsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][5], |
| 116 | s->dest[2] - 8 * s->uvlinesize - 8, | 116 | s->dest[2] - 8 * s->uvlinesize - 8, |
| 117 | s->uvlinesize); | 117 | s->uvlinesize); |
| 118 | } | 118 | } |
| 119 | if (s->mb_x == s->mb_width - 1) { | 119 | if (s->mb_x == s->mb_width - 1) { |
| 120 | top_mb_pos = (s->mb_y - 1) * s->mb_stride + s->mb_x; | 120 | top_mb_pos = (s->mb_y - 1) * s->mb_stride + s->mb_x; |
| @@ -122,24 +122,24 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v) · 1 unmodified line | |||
| 122 | fieldtx = v->fieldtx_plane[top_mb_pos]; | 122 | fieldtx = v->fieldtx_plane[top_mb_pos]; |
| 123 | stride_y = s->linesize << fieldtx; | 123 | stride_y = s->linesize << fieldtx; |
| 124 | v_dist = fieldtx ? 15 : 8; | 124 | v_dist = fieldtx ? 15 : 8; |
| 125 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][0], | 125 | s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][0], |
| 126 | s->dest[0] - 16 * s->linesize, | 126 | s->dest[0] - 16 * s->linesize, |
| 127 | stride_y); | 127 | stride_y); |
| 128 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][1], | 128 | s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][1], |
| 129 | s->dest[0] - 16 * s->linesize + 8, | 129 | s->dest[0] - 16 * s->linesize + 8, |
| 130 | stride_y); | 130 | stride_y); |
| 131 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][2], | 131 | s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][2], |
| 132 | s->dest[0] - v_dist * s->linesize, | 132 | s->dest[0] - v_dist * s->linesize, |
| 133 | stride_y); | 133 | stride_y); |
| 134 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][3], | 134 | s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][3], |
| 135 | s->dest[0] - v_dist * s->linesize + 8, | 135 | s->dest[0] - v_dist * s->linesize + 8, |
| 136 | stride_y); | 136 | stride_y); |
| 137 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][4], | 137 | s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][4], |
| 138 | s->dest[1] - 8 * s->uvlinesize, | 138 | s->dest[1] - 8 * s->uvlinesize, |
| 139 | s->uvlinesize); | 139 | s->uvlinesize); |
| 140 | s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][5], | 140 | s->idsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][5], |
| 141 | s->dest[2] - 8 * s->uvlinesize, | 141 | s->dest[2] - 8 * s->uvlinesize, |
| 142 | s->uvlinesize); | 142 | s->uvlinesize); |
| 143 | } | 143 | } |
| 144 | } | 144 | } |
| 145 | 145 | ||
| @@ -3277,7 +3277,7 @@ static int vc1_decode_p_block(VC1Context *v, int16_t block[64], int n, · 3131 unmodified lines | |||
| 3277 | v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); | 3277 | v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); |
| 3278 | else { | 3278 | else { |
| 3279 | v->vc1dsp.vc1_inv_trans_8x8(block); | 3279 | v->vc1dsp.vc1_inv_trans_8x8(block); |
| 3280 | s->dsp.add_pixels_clamped(block, dst, linesize); | 3280 | s->idsp.add_pixels_clamped(block, dst, linesize); |
| 3281 | } | 3281 | } |
| 3282 | } | 3282 | } |
| 3283 | break; | 3283 | break; |
| @@ -3608,7 +3608,10 @@ static int vc1_decode_p_mb(VC1Context *v) · 324 unmodified lines | |||
| 3608 | if (v->rangeredfrm) | 3608 | if (v->rangeredfrm) |
| 3609 | for (j = 0; j < 64; j++) | 3609 | for (j = 0; j < 64; j++) |
| 3610 | s->block[i][j] <<= 1; | 3610 | s->block[i][j] <<= 1; |
| 3611 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | 3611 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 3612 | s->dest[dst_idx] + off, | ||
| 3613 | i & 4 ? s->uvlinesize | ||
| 3614 | : s->linesize); | ||
| 3612 | if (v->pq >= 9 && v->overlap) { | 3615 | if (v->pq >= 9 && v->overlap) { |
| 3613 | if (v->c_avail) | 3616 | if (v->c_avail) |
| 3614 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | 3617 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
| @@ -3716,8 +3719,10 @@ static int vc1_decode_p_mb(VC1Context *v) · 101 unmodified lines | |||
| 3716 | if (v->rangeredfrm) | 3719 | if (v->rangeredfrm) |
| 3717 | for (j = 0; j < 64; j++) | 3720 | for (j = 0; j < 64; j++) |
| 3718 | s->block[i][j] <<= 1; | 3721 | s->block[i][j] <<= 1; |
| 3719 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, | 3722 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 3720 | (i & 4) ? s->uvlinesize : s->linesize); | 3723 | s->dest[dst_idx] + off, |
| 3724 | (i & 4) ? s->uvlinesize | ||
| 3725 | : s->linesize); | ||
| 3721 | if (v->pq >= 9 && v->overlap) { | 3726 | if (v->pq >= 9 && v->overlap) { |
| 3722 | if (v->c_avail) | 3727 | if (v->c_avail) |
| 3723 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | 3728 | v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); |
| @@ -3866,7 +3871,9 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) · 142 unmodified lines | |||
| 3866 | stride_y = s->uvlinesize; | 3871 | stride_y = s->uvlinesize; |
| 3867 | off = 0; | 3872 | off = 0; |
| 3868 | } | 3873 | } |
| 3869 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, stride_y); | 3874 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 3875 | s->dest[dst_idx] + off, | ||
| 3876 | stride_y); | ||
| 3870 | //TODO: loop filter | 3877 | //TODO: loop filter |
| 3871 | } | 3878 | } |
| 3872 | 3879 | ||
| @@ -4028,7 +4035,10 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) · 155 unmodified lines | |||
| 4028 | continue; | 4035 | continue; |
| 4029 | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); | 4036 | v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); |
| 4030 | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); | 4037 | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); |
| 4031 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); | 4038 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 4039 | s->dest[dst_idx] + off, | ||
| 4040 | (i & 4) ? s->uvlinesize | ||
| 4041 | : s->linesize); | ||
| 4032 | // TODO: loop filter | 4042 | // TODO: loop filter |
| 4033 | } | 4043 | } |
| 4034 | } else { | 4044 | } else { |
| @@ -4230,7 +4240,10 @@ static void vc1_decode_b_mb(VC1Context *v) · 195 unmodified lines | |||
| 4230 | if (v->rangeredfrm) | 4240 | if (v->rangeredfrm) |
| 4231 | for (j = 0; j < 64; j++) | 4241 | for (j = 0; j < 64; j++) |
| 4232 | s->block[i][j] <<= 1; | 4242 | s->block[i][j] <<= 1; |
| 4233 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); | 4243 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 4244 | s->dest[dst_idx] + off, | ||
| 4245 | i & 4 ? s->uvlinesize | ||
| 4246 | : s->linesize); | ||
| 4234 | } else if (val) { | 4247 | } else if (val) { |
| 4235 | vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, | 4248 | vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, |
| 4236 | first_block, s->dest[dst_idx] + off, | 4249 | first_block, s->dest[dst_idx] + off, |
| @@ -4302,7 +4315,10 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) · 65 unmodified lines | |||
| 4302 | for (j = 0; j < 64; j++) | 4315 | for (j = 0; j < 64; j++) |
| 4303 | s->block[i][j] <<= 1; | 4316 | s->block[i][j] <<= 1; |
| 4304 | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); | 4317 | off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); |
| 4305 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); | 4318 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 4319 | s->dest[dst_idx] + off, | ||
| 4320 | (i & 4) ? s->uvlinesize | ||
| 4321 | : s->linesize); | ||
| 4306 | // TODO: yet to perform loop filter | 4322 | // TODO: yet to perform loop filter |
| 4307 | } | 4323 | } |
| 4308 | } else { | 4324 | } else { |
| @@ -4528,7 +4544,9 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) · 219 unmodified lines | |||
| 4528 | stride_y = s->uvlinesize; | 4544 | stride_y = s->uvlinesize; |
| 4529 | off = 0; | 4545 | off = 0; |
| 4530 | } | 4546 | } |
| 4531 | s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, stride_y); | 4547 | s->idsp.put_signed_pixels_clamped(s->block[i], |
| 4548 | s->dest[dst_idx] + off, | ||
| 4549 | stride_y); | ||
| 4532 | } | 4550 | } |
| 4533 | } else { | 4551 | } else { |
| 4534 | s->mb_intra = v->is_intra[s->mb_x] = 0; | 4552 | s->mb_intra = v->is_intra[s->mb_x] = 0; |
| @@ -4832,12 +4850,16 @@ static void vc1_decode_i_blocks(VC1Context *v) · 297 unmodified lines | |||
| 4832 | if (v->rangeredfrm) | 4850 | if (v->rangeredfrm) |
| 4833 | for (j = 0; j < 64; j++) | 4851 | for (j = 0; j < 64; j++) |
| 4834 | s->block[k][j] <<= 1; | 4852 | s->block[k][j] <<= 1; |
| 4835 | s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); | 4853 | s->idsp.put_signed_pixels_clamped(s->block[k], dst[k], |
| 4854 | k & 4 ? s->uvlinesize | ||
| 4855 | : s->linesize); | ||
| 4836 | } else { | 4856 | } else { |
| 4837 | if (v->rangeredfrm) | 4857 | if (v->rangeredfrm) |
| 4838 | for (j = 0; j < 64; j++) | 4858 | for (j = 0; j < 64; j++) |
| 4839 | s->block[k][j] = (s->block[k][j] - 64) << 1; | 4859 | s->block[k][j] = (s->block[k][j] - 64) << 1; |
| 4840 | s->dsp.put_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); | 4860 | s->idsp.put_pixels_clamped(s->block[k], dst[k], |
| 4861 | k & 4 ? s->uvlinesize | ||
| 4862 | : s->linesize); | ||
| 4841 | } | 4863 | } |
| 4842 | } | 4864 | } |
| 4843 | 4865 | ||
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include "avcodec.h" | 21 | #include "avcodec.h" |
| 22 | #include "idctdsp.h" | ||
| 22 | #include "mpegvideo.h" | 23 | #include "mpegvideo.h" |
| 23 | #include "msmpeg4data.h" | 24 | #include "msmpeg4data.h" |
| 24 | #include "simple_idct.h" | 25 | #include "simple_idct.h" |
| @@ -30,24 +31,24 @@ av_cold void ff_wmv2_common_init(Wmv2Context * w){ · 5 unmodified lines | |||
| 30 | 31 | ||
| 31 | ff_blockdsp_init(&s->bdsp, s->avctx); | 32 | ff_blockdsp_init(&s->bdsp, s->avctx); |
| 32 | ff_wmv2dsp_init(&w->wdsp); | 33 | ff_wmv2dsp_init(&w->wdsp); |
| 33 | s->dsp.idct_permutation_type = w->wdsp.idct_perm; | 34 | s->idsp.idct_permutation_type = w->wdsp.idct_perm; |
| 34 | ff_init_scantable_permutation(s->dsp.idct_permutation, | 35 | ff_init_scantable_permutation(s->idsp.idct_permutation, |
| 35 | w->wdsp.idct_perm); | 36 | w->wdsp.idct_perm); |
| 36 | ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[0], | 37 | ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0], |
| 37 | ff_wmv2_scantableA); | 38 | ff_wmv2_scantableA); |
| 38 | ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[1], | 39 | ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1], |
| 39 | ff_wmv2_scantableB); | 40 | ff_wmv2_scantableB); |
| 40 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, | 41 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, |
| 41 | ff_wmv1_scantable[1]); | 42 | ff_wmv1_scantable[1]); |
| 42 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, | 43 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, |
| 43 | ff_wmv1_scantable[2]); | 44 | ff_wmv1_scantable[2]); |
| 44 | ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, | 45 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, |
| 45 | ff_wmv1_scantable[3]); | 46 | ff_wmv1_scantable[3]); |
| 46 | ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable, | 47 | ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, |
| 47 | ff_wmv1_scantable[0]); | 48 | ff_wmv1_scantable[0]); |
| 48 | s->dsp.idct_put = w->wdsp.idct_put; | 49 | s->idsp.idct_put = w->wdsp.idct_put; |
| 49 | s->dsp.idct_add = w->wdsp.idct_add; | 50 | s->idsp.idct_add = w->wdsp.idct_add; |
| 50 | s->dsp.idct = NULL; | 51 | s->idsp.idct = NULL; |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | static void wmv2_add_block(Wmv2Context *w, int16_t *block1, uint8_t *dst, int stride, int n){ | 54 | static void wmv2_add_block(Wmv2Context *w, int16_t *block1, uint8_t *dst, int stride, int n){ |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | |||
| 19 | #include "libavutil/attributes.h" | 19 | #include "libavutil/attributes.h" |
| 20 | #include "libavutil/common.h" | 20 | #include "libavutil/common.h" |
| 21 | #include "avcodec.h" | 21 | #include "avcodec.h" |
| 22 | #include "dsputil.h" | 22 | #include "idctdsp.h" |
| 23 | #include "mathops.h" | 23 | #include "mathops.h" |
| 24 | #include "wmv2dsp.h" | 24 | #include "wmv2dsp.h" |
| 25 | 25 | ||
| @@ -24,6 +24,7 @@ OBJS-$(CONFIG_LLAUDDSP) += x86/lossless_audiodsp_init.o · 23 unmodified lines | |||
| 24 | OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp_init.o | 24 | OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp_init.o |
| 25 | OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_init.o | 25 | OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_init.o |
| 26 | OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o | 26 | OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o |
| 27 | OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp_init.o | ||
| 27 | OBJS-$(CONFIG_LPC) += x86/lpc.o | 28 | OBJS-$(CONFIG_LPC) += x86/lpc.o |
| 28 | OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o | 29 | OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o |
| 29 | OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \ | 30 | OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \ |
| @@ -57,12 +58,13 @@ OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp_init.o · 27 unmodified lines | |||
| 57 | OBJS-$(CONFIG_VP9_DECODER) += x86/vp9dsp_init.o | 58 | OBJS-$(CONFIG_VP9_DECODER) += x86/vp9dsp_init.o |
| 58 | OBJS-$(CONFIG_WEBP_DECODER) += x86/vp8dsp_init.o | 59 | OBJS-$(CONFIG_WEBP_DECODER) += x86/vp8dsp_init.o |
| 59 | 60 | ||
| 60 | MMX-OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_mmx.o \ | 61 | MMX-OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_mmx.o |
| 62 | MMX-OBJS-$(CONFIG_DIRAC_DECODER) += x86/dirac_dwt.o | ||
| 63 | MMX-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_mmx.o | ||
| 64 | MMX-OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp_mmx.o \ | ||
| 61 | x86/idct_mmx_xvid.o \ | 65 | x86/idct_mmx_xvid.o \ |
| 62 | x86/idct_sse2_xvid.o \ | 66 | x86/idct_sse2_xvid.o \ |
| 63 | x86/simple_idct.o | 67 | x86/simple_idct.o |
| 64 | MMX-OBJS-$(CONFIG_DIRAC_DECODER) += x86/dirac_dwt.o | ||
| 65 | MMX-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_mmx.o | ||
| 66 | 68 | ||
| 67 | MMX-OBJS-$(CONFIG_SNOW_DECODER) += x86/snowdsp.o | 69 | MMX-OBJS-$(CONFIG_SNOW_DECODER) += x86/snowdsp.o |
| 68 | MMX-OBJS-$(CONFIG_SNOW_ENCODER) += x86/snowdsp.o | 70 | MMX-OBJS-$(CONFIG_SNOW_ENCODER) += x86/snowdsp.o |
| @@ -28,9 +28,10 @@ · 27 unmodified lines | |||
| 28 | #include "libavutil/x86/asm.h" | 28 | #include "libavutil/x86/asm.h" |
| 29 | #include "libavutil/x86/cpu.h" | 29 | #include "libavutil/x86/cpu.h" |
| 30 | #include "libavcodec/cavsdsp.h" | 30 | #include "libavcodec/cavsdsp.h" |
| 31 | #include "libavcodec/idctdsp.h" | ||
| 31 | #include "constants.h" | 32 | #include "constants.h" |
| 32 | #include "dsputil_x86.h" | ||
| 33 | #include "fpel.h" | 33 | #include "fpel.h" |
| 34 | #include "idctdsp.h" | ||
| 34 | #include "config.h" | 35 | #include "config.h" |
| 35 | 36 | ||
| 36 | #if HAVE_MMX_INLINE | 37 | #if HAVE_MMX_INLINE |
| @@ -25,106 +25,17 @@ · 24 unmodified lines | |||
| 25 | #include "libavutil/x86/cpu.h" | 25 | #include "libavutil/x86/cpu.h" |
| 26 | #include "libavcodec/avcodec.h" | 26 | #include "libavcodec/avcodec.h" |
| 27 | #include "libavcodec/dsputil.h" | 27 | #include "libavcodec/dsputil.h" |
| 28 | #include "libavcodec/simple_idct.h" | ||
| 29 | #include "dsputil_x86.h" | 28 | #include "dsputil_x86.h" |
| 30 | #include "idct_xvid.h" | ||
| 31 | |||
| 32 | /* Input permutation for the simple_idct_mmx */ | ||
| 33 | static const uint8_t simple_mmx_permutation[64] = { | ||
| 34 | 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, | ||
| 35 | 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | ||
| 36 | 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | ||
| 37 | 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | ||
| 38 | 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | ||
| 39 | 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | ||
| 40 | 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | ||
| 41 | 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, | ||
| 42 | }; | ||
| 43 | |||
| 44 | static const uint8_t idct_sse2_row_perm[8] = { 0, 4, 1, 5, 2, 6, 3, 7 }; | ||
| 45 | |||
| 46 | av_cold int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, | ||
| 47 | int idct_permutation_type) | ||
| 48 | { | ||
| 49 | int i; | ||
| 50 | |||
| 51 | switch (idct_permutation_type) { | ||
| 52 | case FF_SIMPLE_IDCT_PERM: | ||
| 53 | for (i = 0; i < 64; i++) | ||
| 54 | idct_permutation[i] = simple_mmx_permutation[i]; | ||
| 55 | return 1; | ||
| 56 | case FF_SSE2_IDCT_PERM: | ||
| 57 | for (i = 0; i < 64; i++) | ||
| 58 | idct_permutation[i] = (i & 0x38) | idct_sse2_row_perm[i & 7]; | ||
| 59 | return 1; | ||
| 60 | } | ||
| 61 | |||
| 62 | return 0; | ||
| 63 | } | ||
| 64 | 29 | ||
| 65 | static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, | 30 | static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, |
| 66 | int cpu_flags, unsigned high_bit_depth) | 31 | int cpu_flags, unsigned high_bit_depth) |
| 67 | { | 32 | { |
| 68 | #if HAVE_MMX_INLINE | 33 | #if HAVE_MMX_INLINE |
| 69 | c->put_pixels_clamped = ff_put_pixels_clamped_mmx; | ||
| 70 | c->add_pixels_clamped = ff_add_pixels_clamped_mmx; | ||
| 71 | |||
| 72 | if (!high_bit_depth) { | 34 | if (!high_bit_depth) { |
| 73 | c->draw_edges = ff_draw_edges_mmx; | 35 | c->draw_edges = ff_draw_edges_mmx; |
| 74 | } | 36 | } |
| 75 | 37 | ||
| 76 | if (avctx->lowres == 0 && !high_bit_depth) { | ||
| 77 | switch (avctx->idct_algo) { | ||
| 78 | case FF_IDCT_AUTO: | ||
| 79 | case FF_IDCT_SIMPLEAUTO: | ||
| 80 | case FF_IDCT_SIMPLEMMX: | ||
| 81 | c->idct_put = ff_simple_idct_put_mmx; | ||
| 82 | c->idct_add = ff_simple_idct_add_mmx; | ||
| 83 | c->idct = ff_simple_idct_mmx; | ||
| 84 | c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; | ||
| 85 | break; | ||
| 86 | case FF_IDCT_XVIDMMX: | ||
| 87 | c->idct_put = ff_idct_xvid_mmx_put; | ||
| 88 | c->idct_add = ff_idct_xvid_mmx_add; | ||
| 89 | c->idct = ff_idct_xvid_mmx; | ||
| 90 | break; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | #endif /* HAVE_MMX_INLINE */ | 38 | #endif /* HAVE_MMX_INLINE */ |
| 95 | |||
| 96 | #if HAVE_MMX_EXTERNAL | ||
| 97 | c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; | ||
| 98 | #endif /* HAVE_MMX_EXTERNAL */ | ||
| 99 | } | ||
| 100 | |||
| 101 | static av_cold void dsputil_init_mmxext(DSPContext *c, AVCodecContext *avctx, | ||
| 102 | int cpu_flags, unsigned high_bit_depth) | ||
| 103 | { | ||
| 104 | #if HAVE_MMXEXT_INLINE | ||
| 105 | if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX && avctx->lowres == 0) { | ||
| 106 | c->idct_put = ff_idct_xvid_mmxext_put; | ||
| 107 | c->idct_add = ff_idct_xvid_mmxext_add; | ||
| 108 | c->idct = ff_idct_xvid_mmxext; | ||
| 109 | } | ||
| 110 | #endif /* HAVE_MMXEXT_INLINE */ | ||
| 111 | } | ||
| 112 | |||
| 113 | static av_cold void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx, | ||
| 114 | int cpu_flags, unsigned high_bit_depth) | ||
| 115 | { | ||
| 116 | #if HAVE_SSE2_INLINE | ||
| 117 | if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX && avctx->lowres == 0) { | ||
| 118 | c->idct_put = ff_idct_xvid_sse2_put; | ||
| 119 | c->idct_add = ff_idct_xvid_sse2_add; | ||
| 120 | c->idct = ff_idct_xvid_sse2; | ||
| 121 | c->idct_permutation_type = FF_SSE2_IDCT_PERM; | ||
| 122 | } | ||
| 123 | #endif /* HAVE_SSE2_INLINE */ | ||
| 124 | |||
| 125 | #if HAVE_SSE2_EXTERNAL | ||
| 126 | c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_sse2; | ||
| 127 | #endif /* HAVE_SSE2_EXTERNAL */ | ||
| 128 | } | 39 | } |
| 129 | 40 | ||
| 130 | av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx, | 41 | av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx, |
| @@ -135,12 +46,6 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx, · 4 unmodified lines | |||
| 135 | if (X86_MMX(cpu_flags)) | 46 | if (X86_MMX(cpu_flags)) |
| 136 | dsputil_init_mmx(c, avctx, cpu_flags, high_bit_depth); | 47 | dsputil_init_mmx(c, avctx, cpu_flags, high_bit_depth); |
| 137 | 48 | ||
| 138 | if (X86_MMXEXT(cpu_flags)) | ||
| 139 | dsputil_init_mmxext(c, avctx, cpu_flags, high_bit_depth); | ||
| 140 | |||
| 141 | if (X86_SSE2(cpu_flags)) | ||
| 142 | dsputil_init_sse2(c, avctx, cpu_flags, high_bit_depth); | ||
| 143 | |||
| 144 | if (CONFIG_ENCODERS) | 49 | if (CONFIG_ENCODERS) |
| 145 | ff_dsputilenc_init_mmx(c, avctx, high_bit_depth); | 50 | ff_dsputilenc_init_mmx(c, avctx, high_bit_depth); |
| 146 | } | 51 | } |
| @@ -33,106 +33,6 @@ · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | #if HAVE_INLINE_ASM | 34 | #if HAVE_INLINE_ASM |
| 35 | 35 | ||
| 36 | void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 37 | int line_size) | ||
| 38 | { | ||
| 39 | const int16_t *p; | ||
| 40 | uint8_t *pix; | ||
| 41 | |||
| 42 | /* read the pixels */ | ||
| 43 | p = block; | ||
| 44 | pix = pixels; | ||
| 45 | /* unrolled loop */ | ||
| 46 | __asm__ volatile ( | ||
| 47 | "movq (%3), %%mm0 \n\t" | ||
| 48 | "movq 8(%3), %%mm1 \n\t" | ||
| 49 | "movq 16(%3), %%mm2 \n\t" | ||
| 50 | "movq 24(%3), %%mm3 \n\t" | ||
| 51 | "movq 32(%3), %%mm4 \n\t" | ||
| 52 | "movq 40(%3), %%mm5 \n\t" | ||
| 53 | "movq 48(%3), %%mm6 \n\t" | ||
| 54 | "movq 56(%3), %%mm7 \n\t" | ||
| 55 | "packuswb %%mm1, %%mm0 \n\t" | ||
| 56 | "packuswb %%mm3, %%mm2 \n\t" | ||
| 57 | "packuswb %%mm5, %%mm4 \n\t" | ||
| 58 | "packuswb %%mm7, %%mm6 \n\t" | ||
| 59 | "movq %%mm0, (%0) \n\t" | ||
| 60 | "movq %%mm2, (%0, %1) \n\t" | ||
| 61 | "movq %%mm4, (%0, %1, 2) \n\t" | ||
| 62 | "movq %%mm6, (%0, %2) \n\t" | ||
| 63 | :: "r" (pix), "r" ((x86_reg) line_size), "r" ((x86_reg) line_size * 3), | ||
| 64 | "r" (p) | ||
| 65 | : "memory"); | ||
| 66 | pix += line_size * 4; | ||
| 67 | p += 32; | ||
| 68 | |||
| 69 | // if here would be an exact copy of the code above | ||
| 70 | // compiler would generate some very strange code | ||
| 71 | // thus using "r" | ||
| 72 | __asm__ volatile ( | ||
| 73 | "movq (%3), %%mm0 \n\t" | ||
| 74 | "movq 8(%3), %%mm1 \n\t" | ||
| 75 | "movq 16(%3), %%mm2 \n\t" | ||
| 76 | "movq 24(%3), %%mm3 \n\t" | ||
| 77 | "movq 32(%3), %%mm4 \n\t" | ||
| 78 | "movq 40(%3), %%mm5 \n\t" | ||
| 79 | "movq 48(%3), %%mm6 \n\t" | ||
| 80 | "movq 56(%3), %%mm7 \n\t" | ||
| 81 | "packuswb %%mm1, %%mm0 \n\t" | ||
| 82 | "packuswb %%mm3, %%mm2 \n\t" | ||
| 83 | "packuswb %%mm5, %%mm4 \n\t" | ||
| 84 | "packuswb %%mm7, %%mm6 \n\t" | ||
| 85 | "movq %%mm0, (%0) \n\t" | ||
| 86 | "movq %%mm2, (%0, %1) \n\t" | ||
| 87 | "movq %%mm4, (%0, %1, 2) \n\t" | ||
| 88 | "movq %%mm6, (%0, %2) \n\t" | ||
| 89 | :: "r" (pix), "r" ((x86_reg) line_size), "r" ((x86_reg) line_size * 3), | ||
| 90 | "r" (p) | ||
| 91 | : "memory"); | ||
| 92 | } | ||
| 93 | |||
| 94 | void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 95 | int line_size) | ||
| 96 | { | ||
| 97 | const int16_t *p; | ||
| 98 | uint8_t *pix; | ||
| 99 | int i; | ||
| 100 | |||
| 101 | /* read the pixels */ | ||
| 102 | p = block; | ||
| 103 | pix = pixels; | ||
| 104 | MOVQ_ZERO(mm7); | ||
| 105 | i = 4; | ||
| 106 | do { | ||
| 107 | __asm__ volatile ( | ||
| 108 | "movq (%2), %%mm0 \n\t" | ||
| 109 | "movq 8(%2), %%mm1 \n\t" | ||
| 110 | "movq 16(%2), %%mm2 \n\t" | ||
| 111 | "movq 24(%2), %%mm3 \n\t" | ||
| 112 | "movq %0, %%mm4 \n\t" | ||
| 113 | "movq %1, %%mm6 \n\t" | ||
| 114 | "movq %%mm4, %%mm5 \n\t" | ||
| 115 | "punpcklbw %%mm7, %%mm4 \n\t" | ||
| 116 | "punpckhbw %%mm7, %%mm5 \n\t" | ||
| 117 | "paddsw %%mm4, %%mm0 \n\t" | ||
| 118 | "paddsw %%mm5, %%mm1 \n\t" | ||
| 119 | "movq %%mm6, %%mm5 \n\t" | ||
| 120 | "punpcklbw %%mm7, %%mm6 \n\t" | ||
| 121 | "punpckhbw %%mm7, %%mm5 \n\t" | ||
| 122 | "paddsw %%mm6, %%mm2 \n\t" | ||
| 123 | "paddsw %%mm5, %%mm3 \n\t" | ||
| 124 | "packuswb %%mm1, %%mm0 \n\t" | ||
| 125 | "packuswb %%mm3, %%mm2 \n\t" | ||
| 126 | "movq %%mm0, %0 \n\t" | ||
| 127 | "movq %%mm2, %1 \n\t" | ||
| 128 | : "+m" (*pix), "+m" (*(pix + line_size)) | ||
| 129 | : "r" (p) | ||
| 130 | : "memory"); | ||
| 131 | pix += line_size * 2; | ||
| 132 | p += 16; | ||
| 133 | } while (--i); | ||
| 134 | } | ||
| 135 | |||
| 136 | /* Draw the edges of width 'w' of an image of size width, height | 36 | /* Draw the edges of width 'w' of an image of size width, height |
| 137 | * this MMX version can only handle w == 8 || w == 16. */ | 37 | * this MMX version can only handle w == 8 || w == 16. */ |
| 138 | void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, | 38 | void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
| @@ -31,15 +31,6 @@ void ff_dsputilenc_init_mmx(DSPContext *c, AVCodecContext *avctx, · 30 unmodified lines | |||
| 31 | unsigned high_bit_depth); | 31 | unsigned high_bit_depth); |
| 32 | void ff_dsputil_init_pix_mmx(DSPContext *c, AVCodecContext *avctx); | 32 | void ff_dsputil_init_pix_mmx(DSPContext *c, AVCodecContext *avctx); |
| 33 | 33 | ||
| 34 | void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 35 | int line_size); | ||
| 36 | void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 37 | int line_size); | ||
| 38 | void ff_put_signed_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 39 | int line_size); | ||
| 40 | void ff_put_signed_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels, | ||
| 41 | int line_size); | ||
| 42 | |||
| 43 | void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, | 34 | void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, |
| 44 | int w, int h, int sides); | 35 | int w, int h, int sides); |
| 45 | 36 | ||
| @@ -44,8 +44,8 @@ · 43 unmodified lines | |||
| 44 | #include "config.h" | 44 | #include "config.h" |
| 45 | #include "libavcodec/avcodec.h" | 45 | #include "libavcodec/avcodec.h" |
| 46 | #include "libavutil/mem.h" | 46 | #include "libavutil/mem.h" |
| 47 | #include "dsputil_x86.h" | ||
| 48 | #include "idct_xvid.h" | 47 | #include "idct_xvid.h" |
| 48 | #include "idctdsp.h" | ||
| 49 | 49 | ||
| 50 | #if HAVE_MMX_INLINE | 50 | #if HAVE_MMX_INLINE |
| 51 | 51 | ||
| @@ -41,7 +41,7 @@ · 40 unmodified lines | |||
| 41 | #include "libavutil/mem.h" | 41 | #include "libavutil/mem.h" |
| 42 | #include "libavutil/x86/asm.h" | 42 | #include "libavutil/x86/asm.h" |
| 43 | #include "idct_xvid.h" | 43 | #include "idct_xvid.h" |
| 44 | #include "dsputil_x86.h" | 44 | #include "idctdsp.h" |
| 45 | 45 | ||
| 46 | #if HAVE_SSE2_INLINE | 46 | #if HAVE_SSE2_INLINE |
| 47 | 47 | ||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg 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 | * FFmpeg 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 FFmpeg; 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_X86_IDCTDSP_H | ||
| 20 | #define AVCODEC_X86_IDCTDSP_H | ||
| 21 | |||
| 22 | #include <stdint.h> | ||
| 23 | |||
| 24 | void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 25 | int line_size); | ||
| 26 | void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 27 | int line_size); | ||
| 28 | void ff_put_signed_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 29 | int line_size); | ||
| 30 | void ff_put_signed_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels, | ||
| 31 | int line_size); | ||
| 32 | |||
| 33 | #endif /* AVCODEC_X86_IDCTDSP_H */ | ||
| @@ -0,0 +1,112 @@ | |||
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg 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 | * FFmpeg 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 FFmpeg; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include "config.h" | ||
| 20 | #include "libavutil/attributes.h" | ||
| 21 | #include "libavutil/cpu.h" | ||
| 22 | #include "libavutil/x86/cpu.h" | ||
| 23 | #include "libavcodec/avcodec.h" | ||
| 24 | #include "libavcodec/idctdsp.h" | ||
| 25 | #include "libavcodec/simple_idct.h" | ||
| 26 | #include "idct_xvid.h" | ||
| 27 | #include "idctdsp.h" | ||
| 28 | |||
| 29 | /* Input permutation for the simple_idct_mmx */ | ||
| 30 | static const uint8_t simple_mmx_permutation[64] = { | ||
| 31 | 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, | ||
| 32 | 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | ||
| 33 | 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | ||
| 34 | 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | ||
| 35 | 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | ||
| 36 | 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | ||
| 37 | 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | ||
| 38 | 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, | ||
| 39 | }; | ||
| 40 | |||
| 41 | static const uint8_t idct_sse2_row_perm[8] = { 0, 4, 1, 5, 2, 6, 3, 7 }; | ||
| 42 | |||
| 43 | av_cold int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, | ||
| 44 | int idct_permutation_type) | ||
| 45 | { | ||
| 46 | int i; | ||
| 47 | |||
| 48 | switch (idct_permutation_type) { | ||
| 49 | case FF_SIMPLE_IDCT_PERM: | ||
| 50 | for (i = 0; i < 64; i++) | ||
| 51 | idct_permutation[i] = simple_mmx_permutation[i]; | ||
| 52 | return 1; | ||
| 53 | case FF_SSE2_IDCT_PERM: | ||
| 54 | for (i = 0; i < 64; i++) | ||
| 55 | idct_permutation[i] = (i & 0x38) | idct_sse2_row_perm[i & 7]; | ||
| 56 | return 1; | ||
| 57 | } | ||
| 58 | |||
| 59 | return 0; | ||
| 60 | } | ||
| 61 | |||
| 62 | av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx, | ||
| 63 | unsigned high_bit_depth) | ||
| 64 | { | ||
| 65 | int cpu_flags = av_get_cpu_flags(); | ||
| 66 | |||
| 67 | if (INLINE_MMX(cpu_flags)) { | ||
| 68 | c->put_pixels_clamped = ff_put_pixels_clamped_mmx; | ||
| 69 | c->add_pixels_clamped = ff_add_pixels_clamped_mmx; | ||
| 70 | |||
| 71 | if (avctx->lowres == 0 && !high_bit_depth) { | ||
| 72 | switch (avctx->idct_algo) { | ||
| 73 | case FF_IDCT_AUTO: | ||
| 74 | case FF_IDCT_SIMPLEAUTO: | ||
| 75 | case FF_IDCT_SIMPLEMMX: | ||
| 76 | c->idct_put = ff_simple_idct_put_mmx; | ||
| 77 | c->idct_add = ff_simple_idct_add_mmx; | ||
| 78 | c->idct = ff_simple_idct_mmx; | ||
| 79 | c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; | ||
| 80 | break; | ||
| 81 | case FF_IDCT_XVIDMMX: | ||
| 82 | c->idct_put = ff_idct_xvid_mmx_put; | ||
| 83 | c->idct_add = ff_idct_xvid_mmx_add; | ||
| 84 | c->idct = ff_idct_xvid_mmx; | ||
| 85 | break; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } | ||
| 89 | if (EXTERNAL_MMX(cpu_flags)) { | ||
| 90 | c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; | ||
| 91 | } | ||
| 92 | |||
| 93 | if (INLINE_MMXEXT(cpu_flags)) { | ||
| 94 | if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX && avctx->lowres == 0) { | ||
| 95 | c->idct_put = ff_idct_xvid_mmxext_put; | ||
| 96 | c->idct_add = ff_idct_xvid_mmxext_add; | ||
| 97 | c->idct = ff_idct_xvid_mmxext; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | if (INLINE_SSE2(cpu_flags)) { | ||
| 102 | if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX && avctx->lowres == 0) { | ||
| 103 | c->idct_put = ff_idct_xvid_sse2_put; | ||
| 104 | c->idct_add = ff_idct_xvid_sse2_add; | ||
| 105 | c->idct = ff_idct_xvid_sse2; | ||
| 106 | c->idct_permutation_type = FF_SSE2_IDCT_PERM; | ||
| 107 | } | ||
| 108 | } | ||
| 109 | if (EXTERNAL_SSE2(cpu_flags)) { | ||
| 110 | c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_sse2; | ||
| 111 | } | ||
| 112 | } | ||
| @@ -0,0 +1,133 @@ | |||
| 1 | /* | ||
| 2 | * SIMD-optimized IDCT-related routines | ||
| 3 | * Copyright (c) 2000, 2001 Fabrice Bellard | ||
| 4 | * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> | ||
| 5 | * | ||
| 6 | * MMX optimization by Nick Kurshev <nickols_k@mail.ru> | ||
| 7 | * | ||
| 8 | * This file is part of FFmpeg. | ||
| 9 | * | ||
| 10 | * FFmpeg is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU Lesser General Public | ||
| 12 | * License as published by the Free Software Foundation; either | ||
| 13 | * version 2.1 of the License, or (at your option) any later version. | ||
| 14 | * | ||
| 15 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 18 | * Lesser General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU Lesser General Public | ||
| 21 | * License along with FFmpeg; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include "config.h" | ||
| 26 | #include "libavutil/cpu.h" | ||
| 27 | #include "libavutil/x86/asm.h" | ||
| 28 | #include "idctdsp.h" | ||
| 29 | #include "inline_asm.h" | ||
| 30 | |||
| 31 | #if HAVE_INLINE_ASM | ||
| 32 | |||
| 33 | void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 34 | int line_size) | ||
| 35 | { | ||
| 36 | const int16_t *p; | ||
| 37 | uint8_t *pix; | ||
| 38 | |||
| 39 | /* read the pixels */ | ||
| 40 | p = block; | ||
| 41 | pix = pixels; | ||
| 42 | /* unrolled loop */ | ||
| 43 | __asm__ volatile ( | ||
| 44 | "movq (%3), %%mm0 \n\t" | ||
| 45 | "movq 8(%3), %%mm1 \n\t" | ||
| 46 | "movq 16(%3), %%mm2 \n\t" | ||
| 47 | "movq 24(%3), %%mm3 \n\t" | ||
| 48 | "movq 32(%3), %%mm4 \n\t" | ||
| 49 | "movq 40(%3), %%mm5 \n\t" | ||
| 50 | "movq 48(%3), %%mm6 \n\t" | ||
| 51 | "movq 56(%3), %%mm7 \n\t" | ||
| 52 | "packuswb %%mm1, %%mm0 \n\t" | ||
| 53 | "packuswb %%mm3, %%mm2 \n\t" | ||
| 54 | "packuswb %%mm5, %%mm4 \n\t" | ||
| 55 | "packuswb %%mm7, %%mm6 \n\t" | ||
| 56 | "movq %%mm0, (%0) \n\t" | ||
| 57 | "movq %%mm2, (%0, %1) \n\t" | ||
| 58 | "movq %%mm4, (%0, %1, 2) \n\t" | ||
| 59 | "movq %%mm6, (%0, %2) \n\t" | ||
| 60 | :: "r" (pix), "r" ((x86_reg) line_size), "r" ((x86_reg) line_size * 3), | ||
| 61 | "r" (p) | ||
| 62 | : "memory"); | ||
| 63 | pix += line_size * 4; | ||
| 64 | p += 32; | ||
| 65 | |||
| 66 | // if here would be an exact copy of the code above | ||
| 67 | // compiler would generate some very strange code | ||
| 68 | // thus using "r" | ||
| 69 | __asm__ volatile ( | ||
| 70 | "movq (%3), %%mm0 \n\t" | ||
| 71 | "movq 8(%3), %%mm1 \n\t" | ||
| 72 | "movq 16(%3), %%mm2 \n\t" | ||
| 73 | "movq 24(%3), %%mm3 \n\t" | ||
| 74 | "movq 32(%3), %%mm4 \n\t" | ||
| 75 | "movq 40(%3), %%mm5 \n\t" | ||
| 76 | "movq 48(%3), %%mm6 \n\t" | ||
| 77 | "movq 56(%3), %%mm7 \n\t" | ||
| 78 | "packuswb %%mm1, %%mm0 \n\t" | ||
| 79 | "packuswb %%mm3, %%mm2 \n\t" | ||
| 80 | "packuswb %%mm5, %%mm4 \n\t" | ||
| 81 | "packuswb %%mm7, %%mm6 \n\t" | ||
| 82 | "movq %%mm0, (%0) \n\t" | ||
| 83 | "movq %%mm2, (%0, %1) \n\t" | ||
| 84 | "movq %%mm4, (%0, %1, 2) \n\t" | ||
| 85 | "movq %%mm6, (%0, %2) \n\t" | ||
| 86 | :: "r" (pix), "r" ((x86_reg) line_size), "r" ((x86_reg) line_size * 3), | ||
| 87 | "r" (p) | ||
| 88 | : "memory"); | ||
| 89 | } | ||
| 90 | |||
| 91 | void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, | ||
| 92 | int line_size) | ||
| 93 | { | ||
| 94 | const int16_t *p; | ||
| 95 | uint8_t *pix; | ||
| 96 | int i; | ||
| 97 | |||
| 98 | /* read the pixels */ | ||
| 99 | p = block; | ||
| 100 | pix = pixels; | ||
| 101 | MOVQ_ZERO(mm7); | ||
| 102 | i = 4; | ||
| 103 | do { | ||
| 104 | __asm__ volatile ( | ||
| 105 | "movq (%2), %%mm0 \n\t" | ||
| 106 | "movq 8(%2), %%mm1 \n\t" | ||
| 107 | "movq 16(%2), %%mm2 \n\t" | ||
| 108 | "movq 24(%2), %%mm3 \n\t" | ||
| 109 | "movq %0, %%mm4 \n\t" | ||
| 110 | "movq %1, %%mm6 \n\t" | ||
| 111 | "movq %%mm4, %%mm5 \n\t" | ||
| 112 | "punpcklbw %%mm7, %%mm4 \n\t" | ||
| 113 | "punpckhbw %%mm7, %%mm5 \n\t" | ||
| 114 | "paddsw %%mm4, %%mm0 \n\t" | ||
| 115 | "paddsw %%mm5, %%mm1 \n\t" | ||
| 116 | "movq %%mm6, %%mm5 \n\t" | ||
| 117 | "punpcklbw %%mm7, %%mm6 \n\t" | ||
| 118 | "punpckhbw %%mm7, %%mm5 \n\t" | ||
| 119 | "paddsw %%mm6, %%mm2 \n\t" | ||
| 120 | "paddsw %%mm5, %%mm3 \n\t" | ||
| 121 | "packuswb %%mm1, %%mm0 \n\t" | ||
| 122 | "packuswb %%mm3, %%mm2 \n\t" | ||
| 123 | "movq %%mm0, %0 \n\t" | ||
| 124 | "movq %%mm2, %1 \n\t" | ||
| 125 | : "+m" (*pix), "+m" (*(pix + line_size)) | ||
| 126 | : "r" (p) | ||
| 127 | : "memory"); | ||
| 128 | pix += line_size * 2; | ||
| 129 | p += 16; | ||
| 130 | } while (--i); | ||
| 131 | } | ||
| 132 | |||
| 133 | #endif /* HAVE_INLINE_ASM */ | ||
| @@ -232,7 +232,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, · 231 unmodified lines | |||
| 232 | if(s->mb_intra) block[0]= level; | 232 | if(s->mb_intra) block[0]= level; |
| 233 | else block[0]= temp_block[0]; | 233 | else block[0]= temp_block[0]; |
| 234 | 234 | ||
| 235 | if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ | 235 | if (s->idsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM) { |
| 236 | if(last_non_zero_p1 <= 1) goto end; | 236 | if(last_non_zero_p1 <= 1) goto end; |
| 237 | block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; | 237 | block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; |
| 238 | block[0x20] = temp_block[0x10]; | 238 | block[0x20] = temp_block[0x10]; |
| @@ -276,7 +276,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, · 37 unmodified lines | |||
| 276 | block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; | 276 | block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; |
| 277 | block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; | 277 | block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; |
| 278 | block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; | 278 | block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; |
| 279 | }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ | 279 | }else if(s->idsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ |
| 280 | if(last_non_zero_p1 <= 1) goto end; | 280 | if(last_non_zero_p1 <= 1) goto end; |
| 281 | block[0x04] = temp_block[0x01]; | 281 | block[0x04] = temp_block[0x01]; |
| 282 | block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; | 282 | block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #include "libavutil/attributes.h" | 23 | #include "libavutil/attributes.h" |
| 24 | #include "libavutil/x86/cpu.h" | 24 | #include "libavutil/x86/cpu.h" |
| 25 | #include "libavcodec/dsputil.h" | 25 | #include "libavcodec/idctdsp.h" |
| 26 | #include "libavcodec/proresdsp.h" | 26 | #include "libavcodec/proresdsp.h" |
| 27 | 27 | ||
| 28 | void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize, | 28 | void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize, |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include "libavcodec/simple_idct.h" | 22 | #include "libavcodec/simple_idct.h" |
| 23 | #include "libavutil/mem.h" | 23 | #include "libavutil/mem.h" |
| 24 | #include "libavutil/x86/asm.h" | 24 | #include "libavutil/x86/asm.h" |
| 25 | #include "dsputil_x86.h" | 25 | #include "idctdsp.h" |
| 26 | 26 | ||
| 27 | #if HAVE_INLINE_ASM | 27 | #if HAVE_INLINE_ASM |
| 28 | 28 | ||
| @@ -234,8 +234,8 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, · 233 unmodified lines | |||
| 234 | const int index = x1 + y1*linesize; | 234 | const int index = x1 + y1*linesize; |
| 235 | p->dsp.get_pixels(block, p->src + index, linesize); | 235 | p->dsp.get_pixels(block, p->src + index, linesize); |
| 236 | p->dsp.fdct(block); | 236 | p->dsp.fdct(block); |
| 237 | p->requantize(block2, block, qp, p->dsp.idct_permutation); | 237 | p->requantize(block2, block, qp, p->idsp.idct_permutation); |
| 238 | p->dsp.idct(block2); | 238 | p->idsp.idct(block2); |
| 239 | add_block(p->temp + index, linesize, block2); | 239 | add_block(p->temp + index, linesize, block2); |
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| @@ -381,6 +381,7 @@ static av_cold int init(AVFilterContext *ctx) · 139 unmodified lines | |||
| 381 | if (!spp->avctx) | 381 | if (!spp->avctx) |
| 382 | return AVERROR(ENOMEM); | 382 | return AVERROR(ENOMEM); |
| 383 | avpriv_dsputil_init(&spp->dsp, spp->avctx); | 383 | avpriv_dsputil_init(&spp->dsp, spp->avctx); |
| 384 | ff_idctdsp_init(&spp->idsp, spp->avctx); | ||
| 384 | spp->store_slice = store_slice_c; | 385 | spp->store_slice = store_slice_c; |
| 385 | switch (spp->mode) { | 386 | switch (spp->mode) { |
| 386 | case MODE_HARD: spp->requantize = hardthresh_c; break; | 387 | case MODE_HARD: spp->requantize = hardthresh_c; break; |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include "libavcodec/avcodec.h" | 25 | #include "libavcodec/avcodec.h" |
| 26 | #include "libavcodec/dsputil.h" | 26 | #include "libavcodec/dsputil.h" |
| 27 | #include "libavcodec/idctdsp.h" | ||
| 27 | #include "avfilter.h" | 28 | #include "avfilter.h" |
| 28 | 29 | ||
| 29 | #define MAX_LEVEL 6 /* quality levels */ | 30 | #define MAX_LEVEL 6 /* quality levels */ |
| @@ -40,6 +41,7 @@ typedef struct { · 10 unmodified lines | |||
| 40 | int16_t *temp; | 41 | int16_t *temp; |
| 41 | AVCodecContext *avctx; | 42 | AVCodecContext *avctx; |
| 42 | DSPContext dsp; | 43 | DSPContext dsp; |
| 44 | IDCTDSPContext idsp; | ||
| 43 | int8_t *non_b_qp_table; | 45 | int8_t *non_b_qp_table; |
| 44 | int non_b_qp_alloc_size; | 46 | int non_b_qp_alloc_size; |
| 45 | int use_bframe_qp; | 47 | int use_bframe_qp; |