* qatar/master: ARM: allow runtime masking of CPU features dsputil: remove unused functions mov: Treat keyframe indexes as 1-origin if starting at non-zero. mov: Take stps entries into consideration also about key_off. Remove lowres video decoding Conflicts: ffmpeg.c ffplay.c libavcodec/arm/vp8dsp_init_arm.c libavcodec/libopenjpegdec.c libavcodec/mjpegdec.c libavcodec/mpegvideo.c libavcodec/utils.c libavformat/mov.c
Unified · Split
| @@ -565,6 +565,14 @@ int opt_cpuflags(const char *opt, const char *arg) · 564 unmodified lines | ||
| 565 | 565 | { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_FMA4 }, .unit = "flags" }, |
| 566 | 566 | { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_3DNOW }, .unit = "flags" }, |
| 567 | 567 | { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_3DNOWEXT }, .unit = "flags" }, |
| 568 | + | |
| 569 | + { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV5TE }, .unit = "flags" }, | |
| 570 | + { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV6 }, .unit = "flags" }, | |
| 571 | + { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" }, | |
| 572 | + { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_VFP }, .unit = "flags" }, | |
| 573 | + { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_VFPV3 }, .unit = "flags" }, | |
| 574 | + { "neon", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_NEON }, .unit = "flags" }, | |
| 575 | + | |
| 568 | 576 | { NULL }, |
| 569 | 577 | }; |
| 570 | 578 | static const AVClass class = { |
| @@ -260,7 +260,6 @@ static int64_t duration = AV_NOPTS_VALUE; · 259 unmodified lines | ||
| 260 | 260 | static int workaround_bugs = 1; |
| 261 | 261 | static int fast = 0; |
| 262 | 262 | static int genpts = 0; |
| 263 | −static int lowres = 0; | |
| 264 | 263 | static int idct = FF_IDCT_AUTO; |
| 265 | 264 | static enum AVDiscard skip_frame = AVDISCARD_DEFAULT; |
| 266 | 265 | static enum AVDiscard skip_idct = AVDISCARD_DEFAULT; |
| @@ -1325,7 +1324,7 @@ static void alloc_picture(void *opaque) · 1058 unmodified lines | ||
| 1325 | 1324 | /* SDL allocates a buffer smaller than requested if the video |
| 1326 | 1325 | * overlay hardware is unable to support the requested size. */ |
| 1327 | 1326 | fprintf(stderr, "Error: the video system does not support an image\n" |
| 1328 | − "size of %dx%d pixels. Try using -lowres or -vf \"scale=w:h\"\n" | |
| 1327 | + "size of %dx%d pixels. Try using -vf \"scale=w:h\"\n" | |
| 1329 | 1328 | "to reduce the image size.\n", vp->width, vp->height ); |
| 1330 | 1329 | do_exit(is); |
| 1331 | 1330 | } |
| @@ -3085,7 +3084,6 @@ static const OptionDef options[] = { · 1753 unmodified lines | ||
| 3085 | 3084 | { "fast", OPT_BOOL | OPT_EXPERT, { (void*)&fast }, "non spec compliant optimizations", "" }, |
| 3086 | 3085 | { "genpts", OPT_BOOL | OPT_EXPERT, { (void*)&genpts }, "generate pts", "" }, |
| 3087 | 3086 | { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""}, |
| 3088 | − { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&lowres }, "", "" }, | |
| 3089 | 3087 | { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_loop_filter }, "", "" }, |
| 3090 | 3088 | { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_frame }, "", "" }, |
| 3091 | 3089 | { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_idct }, "", "" }, |
| @@ -336,7 +336,7 @@ void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx) · 335 unmodified lines | ||
| 336 | 336 | put_pixels_clamped_axp_p = c->put_pixels_clamped; |
| 337 | 337 | add_pixels_clamped_axp_p = c->add_pixels_clamped; |
| 338 | 338 | |
| 339 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 && | |
| 339 | + if (avctx->bits_per_raw_sample <= 8 && | |
| 340 | 340 | (avctx->idct_algo == FF_IDCT_AUTO || |
| 341 | 341 | avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) { |
| 342 | 342 | c->idct_put = ff_simple_idct_put_axp; |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include <stdint.h> |
| 22 | + | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 22 | 24 | #include "libavutil/attributes.h" |
| 23 | 25 | #include "libavcodec/ac3dsp.h" |
| 24 | 26 | #include "config.h" |
| @@ -47,13 +49,15 @@ void ff_ac3_update_bap_counts_arm(uint16_t mant_cnt[16], uint8_t *bap, int len); · 22 unmodified lines | ||
| 47 | 49 | |
| 48 | 50 | av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact) |
| 49 | 51 | { |
| 52 | + int cpu_flags = av_get_cpu_flags(); | |
| 53 | + | |
| 50 | 54 | c->update_bap_counts = ff_ac3_update_bap_counts_arm; |
| 51 | 55 | |
| 52 | − if (HAVE_ARMV6) { | |
| 56 | + if (have_armv6(cpu_flags)) { | |
| 53 | 57 | c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6; |
| 54 | 58 | } |
| 55 | 59 | |
| 56 | − if (HAVE_NEON) { | |
| 60 | + if (have_neon(cpu_flags)) { | |
| 57 | 61 | c->ac3_exponent_min = ff_ac3_exponent_min_neon; |
| 58 | 62 | c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon; |
| 59 | 63 | c->ac3_lshift_int16 = ff_ac3_lshift_int16_neon; |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include "config.h" |
| 22 | + | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 22 | 24 | #include "libavutil/attributes.h" |
| 23 | 25 | #include "libavcodec/dcadsp.h" |
| 24 | 26 | |
| @@ -27,6 +29,8 @@ void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs, · 2 unmodified lines | ||
| 27 | 29 | |
| 28 | 30 | av_cold void ff_dcadsp_init_arm(DCADSPContext *s) |
| 29 | 31 | { |
| 30 | − if (HAVE_NEON) | |
| 32 | + int cpu_flags = av_get_cpu_flags(); | |
| 33 | + | |
| 34 | + if (have_neon(cpu_flags)) | |
| 31 | 35 | s->lfe_fir = ff_dca_lfe_fir_neon; |
| 32 | 36 | } |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | +#include "libavutil/arm/cpu.h" | |
| 22 | 23 | #include "libavcodec/dsputil.h" |
| 23 | 24 | #include "dsputil_arm.h" |
| 24 | 25 | |
| @@ -76,11 +77,12 @@ static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block) · 51 unmodified lines | ||
| 76 | 77 | void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) |
| 77 | 78 | { |
| 78 | 79 | const int high_bit_depth = avctx->bits_per_raw_sample > 8; |
| 80 | + int cpu_flags = av_get_cpu_flags(); | |
| 79 | 81 | |
| 80 | 82 | ff_put_pixels_clamped = c->put_pixels_clamped; |
| 81 | 83 | ff_add_pixels_clamped = c->add_pixels_clamped; |
| 82 | 84 | |
| 83 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) { | |
| 85 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 84 | 86 | if(avctx->idct_algo == FF_IDCT_AUTO || |
| 85 | 87 | avctx->idct_algo == FF_IDCT_ARM){ |
| 86 | 88 | c->idct_put = j_rev_dct_arm_put; |
| @@ -117,8 +119,8 @@ void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) · 30 unmodified lines | ||
| 117 | 119 | c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm; |
| 118 | 120 | } |
| 119 | 121 | |
| 120 | − if (HAVE_ARMV5TE) ff_dsputil_init_armv5te(c, avctx); | |
| 121 | − if (HAVE_ARMV6) ff_dsputil_init_armv6(c, avctx); | |
| 122 | − if (HAVE_ARMVFP) ff_dsputil_init_vfp(c, avctx); | |
| 123 | − if (HAVE_NEON) ff_dsputil_init_neon(c, avctx); | |
| 122 | + if (have_armv5te(cpu_flags)) ff_dsputil_init_armv5te(c, avctx); | |
| 123 | + if (have_armv6(cpu_flags)) ff_dsputil_init_armv6(c, avctx); | |
| 124 | + if (have_vfp(cpu_flags)) ff_dsputil_init_vfp(c, avctx); | |
| 125 | + if (have_neon(cpu_flags)) ff_dsputil_init_neon(c, avctx); | |
| 124 | 126 | } |
| @@ -29,7 +29,7 @@ void ff_prefetch_arm(void *mem, int stride, int h); · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx) |
| 31 | 31 | { |
| 32 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 && | |
| 32 | + if (avctx->bits_per_raw_sample <= 8 && | |
| 33 | 33 | (avctx->idct_algo == FF_IDCT_AUTO || |
| 34 | 34 | avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { |
| 35 | 35 | c->idct_put = ff_simple_idct_put_armv5te; |
| @@ -74,7 +74,7 @@ av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx) · 73 unmodified lines | ||
| 74 | 74 | { |
| 75 | 75 | const int high_bit_depth = avctx->bits_per_raw_sample > 8; |
| 76 | 76 | |
| 77 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 && | |
| 77 | + if (avctx->bits_per_raw_sample <= 8 && | |
| 78 | 78 | (avctx->idct_algo == FF_IDCT_AUTO || |
| 79 | 79 | avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) { |
| 80 | 80 | c->idct_put = ff_simple_idct_put_armv6; |
| @@ -182,7 +182,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) · 181 unmodified lines | ||
| 182 | 182 | { |
| 183 | 183 | const int high_bit_depth = avctx->bits_per_raw_sample > 8; |
| 184 | 184 | |
| 185 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) { | |
| 185 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 186 | 186 | if (avctx->idct_algo == FF_IDCT_AUTO || |
| 187 | 187 | avctx->idct_algo == FF_IDCT_SIMPLENEON) { |
| 188 | 188 | c->idct_put = ff_simple_idct_put_neon; |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +#include "libavutil/arm/cpu.h" | |
| 21 | 22 | #include "libavcodec/dsputil.h" |
| 22 | 23 | #include "dsputil_arm.h" |
| 23 | 24 | |
| @@ -28,7 +29,9 @@ void ff_vector_fmul_reverse_vfp(float *dst, const float *src0, · 4 unmodified lines | ||
| 28 | 29 | |
| 29 | 30 | void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx) |
| 30 | 31 | { |
| 31 | − if (!HAVE_VFPV3) | |
| 32 | + int cpu_flags = av_get_cpu_flags(); | |
| 33 | + | |
| 34 | + if (!have_vfpv3(cpu_flags)) | |
| 32 | 35 | c->vector_fmul = ff_vector_fmul_vfp; |
| 33 | 36 | c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp; |
| 34 | 37 | } |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +#include "libavutil/arm/cpu.h" | |
| 22 | + | |
| 21 | 23 | #define CONFIG_FFT_FLOAT 0 |
| 22 | 24 | #include "libavcodec/fft.h" |
| 23 | 25 | |
| @@ -27,7 +29,9 @@ void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i); · 3 unmodified lines | ||
| 27 | 29 | |
| 28 | 30 | av_cold void ff_fft_fixed_init_arm(FFTContext *s) |
| 29 | 31 | { |
| 30 | − if (HAVE_NEON) { | |
| 32 | + int cpu_flags = av_get_cpu_flags(); | |
| 33 | + | |
| 34 | + if (have_neon(cpu_flags)) { | |
| 31 | 35 | s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; |
| 32 | 36 | s->fft_calc = ff_fft_fixed_calc_neon; |
| 33 | 37 | |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +#include "libavutil/arm/cpu.h" | |
| 21 | 22 | #include "libavcodec/fft.h" |
| 22 | 23 | #include "libavcodec/rdft.h" |
| 23 | 24 | #include "libavcodec/synth_filter.h" |
| @@ -39,7 +40,9 @@ void ff_synth_filter_float_neon(FFTContext *imdct, · 15 unmodified lines | ||
| 39 | 40 | |
| 40 | 41 | av_cold void ff_fft_init_arm(FFTContext *s) |
| 41 | 42 | { |
| 42 | − if (HAVE_NEON) { | |
| 43 | + int cpu_flags = av_get_cpu_flags(); | |
| 44 | + | |
| 45 | + if (have_neon(cpu_flags)) { | |
| 43 | 46 | s->fft_permute = ff_fft_permute_neon; |
| 44 | 47 | s->fft_calc = ff_fft_calc_neon; |
| 45 | 48 | #if CONFIG_MDCT |
| @@ -54,7 +57,9 @@ av_cold void ff_fft_init_arm(FFTContext *s) · 8 unmodified lines | ||
| 54 | 57 | #if CONFIG_RDFT |
| 55 | 58 | av_cold void ff_rdft_init_arm(RDFTContext *s) |
| 56 | 59 | { |
| 57 | − if (HAVE_NEON) | |
| 60 | + int cpu_flags = av_get_cpu_flags(); | |
| 61 | + | |
| 62 | + if (have_neon(cpu_flags)) | |
| 58 | 63 | s->rdft_calc = ff_rdft_calc_neon; |
| 59 | 64 | } |
| 60 | 65 | #endif |
| @@ -62,7 +67,9 @@ av_cold void ff_rdft_init_arm(RDFTContext *s) · 1 unmodified line | ||
| 62 | 67 | #if CONFIG_DCA_DECODER |
| 63 | 68 | av_cold void ff_synth_filter_init_arm(SynthFilterContext *s) |
| 64 | 69 | { |
| 65 | − if (HAVE_NEON) | |
| 70 | + int cpu_flags = av_get_cpu_flags(); | |
| 71 | + | |
| 72 | + if (have_neon(cpu_flags)) | |
| 66 | 73 | s->synth_filter_float = ff_synth_filter_float_neon; |
| 67 | 74 | } |
| 68 | 75 | #endif |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #include <stdint.h> |
| 22 | 22 | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 23 | 24 | #include "libavcodec/avcodec.h" |
| 24 | 25 | #include "libavcodec/fmtconvert.h" |
| 25 | 26 | |
| @@ -33,11 +34,13 @@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); · 7 unmodified lines | ||
| 33 | 34 | |
| 34 | 35 | void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) |
| 35 | 36 | { |
| 36 | − if (HAVE_ARMVFP && HAVE_ARMV6) { | |
| 37 | + int cpu_flags = av_get_cpu_flags(); | |
| 38 | + | |
| 39 | + if (have_vfp(cpu_flags) && have_armv6(cpu_flags)) { | |
| 37 | 40 | c->float_to_int16 = ff_float_to_int16_vfp; |
| 38 | 41 | } |
| 39 | 42 | |
| 40 | − if (HAVE_NEON) { | |
| 43 | + if (have_neon(cpu_flags)) { | |
| 41 | 44 | c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; |
| 42 | 45 | |
| 43 | 46 | if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #include <stdint.h> |
| 22 | 22 | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 23 | 24 | #include "libavcodec/dsputil.h" |
| 24 | 25 | #include "libavcodec/h264dsp.h" |
| 25 | 26 | |
| @@ -99,5 +100,8 @@ static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const i · 73 unmodified lines | ||
| 99 | 100 | |
| 100 | 101 | void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) |
| 101 | 102 | { |
| 102 | − if (HAVE_NEON) ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc); | |
| 103 | + int cpu_flags = av_get_cpu_flags(); | |
| 104 | + | |
| 105 | + if (have_neon(cpu_flags)) | |
| 106 | + ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc); | |
| 103 | 107 | } |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #include <stdint.h> |
| 22 | 22 | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 23 | 24 | #include "libavcodec/h264pred.h" |
| 24 | 25 | |
| 25 | 26 | void ff_pred16x16_vert_neon(uint8_t *src, int stride); |
| @@ -77,5 +78,8 @@ static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int b · 51 unmodified lines | ||
| 77 | 78 | |
| 78 | 79 | void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, int bit_depth, const int chroma_format_idc) |
| 79 | 80 | { |
| 80 | − if (HAVE_NEON) ff_h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc); | |
| 81 | + int cpu_flags = av_get_cpu_flags(); | |
| 82 | + | |
| 83 | + if (have_neon(cpu_flags)) | |
| 84 | + ff_h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc); | |
| 81 | 85 | } |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include <stdint.h> |
| 22 | + | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 22 | 24 | #include "libavcodec/mpegaudiodsp.h" |
| 23 | 25 | #include "config.h" |
| 24 | 26 | |
| @@ -27,7 +29,9 @@ void ff_mpadsp_apply_window_fixed_armv6(int32_t *synth_buf, int32_t *window, · 2 unmodified lines | ||
| 27 | 29 | |
| 28 | 30 | void ff_mpadsp_init_arm(MPADSPContext *s) |
| 29 | 31 | { |
| 30 | − if (HAVE_ARMV6) { | |
| 32 | + int cpu_flags = av_get_cpu_flags(); | |
| 33 | + | |
| 34 | + if (have_armv6(cpu_flags)) { | |
| 31 | 35 | s->apply_window_fixed = ff_mpadsp_apply_window_fixed_armv6; |
| 32 | 36 | } |
| 33 | 37 | } |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +#include "libavutil/arm/cpu.h" | |
| 21 | 22 | #include "libavcodec/avcodec.h" |
| 22 | 23 | #include "libavcodec/dsputil.h" |
| 23 | 24 | #include "libavcodec/mpegvideo.h" |
| @@ -40,11 +41,12 @@ void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, DCTELEM *block, · 16 unmodified lines | ||
| 40 | 41 | |
| 41 | 42 | void ff_MPV_common_init_arm(MpegEncContext *s) |
| 42 | 43 | { |
| 43 | −#if HAVE_ARMV5TE | |
| 44 | − ff_MPV_common_init_armv5te(s); | |
| 45 | −#endif | |
| 44 | + int cpu_flags = av_get_cpu_flags(); | |
| 45 | + | |
| 46 | + if (have_armv5te(cpu_flags)) | |
| 47 | + ff_MPV_common_init_armv5te(s); | |
| 46 | 48 | |
| 47 | − if (HAVE_NEON) { | |
| 49 | + if (have_neon(cpu_flags)) { | |
| 48 | 50 | s->dct_unquantize_h263_intra = ff_dct_unquantize_h263_intra_neon; |
| 49 | 51 | s->dct_unquantize_h263_inter = ff_dct_unquantize_h263_inter_neon; |
| 50 | 52 | } |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include "config.h" |
| 22 | +#include "libavutil/arm/cpu.h" | |
| 22 | 23 | #include "libavutil/attributes.h" |
| 23 | 24 | #include "libavcodec/sbrdsp.h" |
| 24 | 25 | |
| @@ -51,7 +52,9 @@ void ff_sbr_hf_apply_noise_3_neon(float Y[64][2], const float *s_m, · 26 unmodified lines | ||
| 51 | 52 | |
| 52 | 53 | av_cold void ff_sbrdsp_init_arm(SBRDSPContext *s) |
| 53 | 54 | { |
| 54 | − if (HAVE_NEON) { | |
| 55 | + int cpu_flags = av_get_cpu_flags(); | |
| 56 | + | |
| 57 | + if (have_neon(cpu_flags)) { | |
| 55 | 58 | s->sum64x5 = ff_sbr_sum64x5_neon; |
| 56 | 59 | s->sum_square = ff_sbr_sum_square_neon; |
| 57 | 60 | s->neg_odd_64 = ff_sbr_neg_odd_64_neon; |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | #include <stdint.h> |
| 22 | + | |
| 23 | +#include "libavutil/arm/cpu.h" | |
| 22 | 24 | #include "libavcodec/avcodec.h" |
| 23 | 25 | #include "libavcodec/vp56dsp.h" |
| 24 | 26 | |
| @@ -27,7 +29,9 @@ void ff_vp6_edge_filter_ver_neon(uint8_t *yuv, int stride, int t); · 2 unmodified lines | ||
| 27 | 29 | |
| 28 | 30 | void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec) |
| 29 | 31 | { |
| 30 | − if (codec != CODEC_ID_VP5 && HAVE_NEON) { | |
| 32 | + int cpu_flags = av_get_cpu_flags(); | |
| 33 | + | |
| 34 | + if (codec != CODEC_ID_VP5 && have_neon(cpu_flags)) { | |
| 31 | 35 | s->edge_filter_hor = ff_vp6_edge_filter_hor_neon; |
| 32 | 36 | s->edge_filter_ver = ff_vp6_edge_filter_ver_neon; |
| 33 | 37 | } |
| @@ -17,6 +17,8 @@ · 16 unmodified lines | ||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include <stdint.h> |
| 20 | + | |
| 21 | +#include "libavutil/arm/cpu.h" | |
| 20 | 22 | #include "libavcodec/vp8dsp.h" |
| 21 | 23 | |
| 22 | 24 | void ff_vp8_luma_dc_wht_dc_armv6(DCTELEM block[4][4][16], DCTELEM dc[16]); |
| @@ -301,7 +303,9 @@ av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) · 278 unmodified lines | ||
| 301 | 303 | dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_##opt; \ |
| 302 | 304 | dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_##opt; \ |
| 303 | 305 | dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_##opt |
| 304 | − if (HAVE_NEON) { | |
| 306 | + int cpu_flags = av_get_cpu_flags(); | |
| 307 | + | |
| 308 | + if (have_neon(cpu_flags)) { | |
| 305 | 309 | set_func_ptrs(neon); |
| 306 | 310 | } else if (HAVE_ARMV6) { |
| 307 | 311 | set_func_ptrs(armv6); |
| @@ -1451,7 +1451,7 @@ typedef struct AVCodecContext { · 1450 unmodified lines | ||
| 1451 | 1451 | int width, height; |
| 1452 | 1452 | |
| 1453 | 1453 | /** |
| 1454 | − * Bitstream width / height, may be different from width/height if lowres enabled. | |
| 1454 | + * Bitstream width / height, may be different from width/height. | |
| 1455 | 1455 | * - encoding: unused |
| 1456 | 1456 | * - decoding: Set by user before init if known. Codec should override / dynamically change if needed. |
| 1457 | 1457 | */ |
| @@ -2649,7 +2649,7 @@ typedef struct AVCodecContext { · 1191 unmodified lines | ||
| 2649 | 2649 | * - encoding: unused |
| 2650 | 2650 | * - decoding: Set by user. |
| 2651 | 2651 | */ |
| 2652 | − int lowres; | |
| 2652 | + attribute_deprecated int lowres; | |
| 2653 | 2653 | |
| 2654 | 2654 | /** |
| 2655 | 2655 | * the picture in the bitstream |
| @@ -2920,7 +2920,7 @@ typedef struct AVCodec { · 264 unmodified lines | ||
| 2920 | 2920 | const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 |
| 2921 | 2921 | const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 |
| 2922 | 2922 | const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 |
| 2923 | − uint8_t max_lowres; ///< maximum value for lowres supported by the decoder | |
| 2923 | + attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder | |
| 2924 | 2924 | const AVClass *priv_class; ///< AVClass for the private context |
| 2925 | 2925 | const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} |
| 2926 | 2926 | |
| @@ -381,38 +381,6 @@ void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, · 380 unmodified lines | ||
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | −static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels, | |
| 385 | − int line_size) | |
| 386 | −{ | |
| 387 | − int i; | |
| 388 | − | |
| 389 | − /* read the pixels */ | |
| 390 | − for(i=0;i<4;i++) { | |
| 391 | − pixels[0] = av_clip_uint8(block[0]); | |
| 392 | − pixels[1] = av_clip_uint8(block[1]); | |
| 393 | − pixels[2] = av_clip_uint8(block[2]); | |
| 394 | − pixels[3] = av_clip_uint8(block[3]); | |
| 395 | − | |
| 396 | − pixels += line_size; | |
| 397 | − block += 8; | |
| 398 | − } | |
| 399 | −} | |
| 400 | − | |
| 401 | −static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, | |
| 402 | − int line_size) | |
| 403 | −{ | |
| 404 | − int i; | |
| 405 | − | |
| 406 | − /* read the pixels */ | |
| 407 | − for(i=0;i<2;i++) { | |
| 408 | − pixels[0] = av_clip_uint8(block[0]); | |
| 409 | − pixels[1] = av_clip_uint8(block[1]); | |
| 410 | − | |
| 411 | − pixels += line_size; | |
| 412 | − block += 8; | |
| 413 | − } | |
| 414 | −} | |
| 415 | − | |
| 416 | 384 | void ff_put_signed_pixels_clamped_c(const DCTELEM *block, |
| 417 | 385 | uint8_t *restrict pixels, |
| 418 | 386 | int line_size) |
| @@ -454,36 +422,6 @@ void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, · 35 unmodified lines | ||
| 454 | 422 | } |
| 455 | 423 | } |
| 456 | 424 | |
| 457 | −static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels, | |
| 458 | − int line_size) | |
| 459 | −{ | |
| 460 | − int i; | |
| 461 | − | |
| 462 | − /* read the pixels */ | |
| 463 | − for(i=0;i<4;i++) { | |
| 464 | − pixels[0] = av_clip_uint8(pixels[0] + block[0]); | |
| 465 | − pixels[1] = av_clip_uint8(pixels[1] + block[1]); | |
| 466 | − pixels[2] = av_clip_uint8(pixels[2] + block[2]); | |
| 467 | − pixels[3] = av_clip_uint8(pixels[3] + block[3]); | |
| 468 | − pixels += line_size; | |
| 469 | − block += 8; | |
| 470 | − } | |
| 471 | −} | |
| 472 | − | |
| 473 | −static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, | |
| 474 | − int line_size) | |
| 475 | −{ | |
| 476 | − int i; | |
| 477 | − | |
| 478 | − /* read the pixels */ | |
| 479 | − for(i=0;i<2;i++) { | |
| 480 | − pixels[0] = av_clip_uint8(pixels[0] + block[0]); | |
| 481 | − pixels[1] = av_clip_uint8(pixels[1] + block[1]); | |
| 482 | − pixels += line_size; | |
| 483 | − block += 8; | |
| 484 | − } | |
| 485 | −} | |
| 486 | − | |
| 487 | 425 | static int sum_abs_dctelem_c(DCTELEM *block) |
| 488 | 426 | { |
| 489 | 427 | int sum=0, i; |
| @@ -2746,37 +2684,6 @@ static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block) · 2256 unmodified lines | ||
| 2746 | 2684 | ff_add_pixels_clamped_c(block, dest, line_size); |
| 2747 | 2685 | } |
| 2748 | 2686 | |
| 2749 | −static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2750 | −{ | |
| 2751 | − ff_j_rev_dct4 (block); | |
| 2752 | − put_pixels_clamped4_c(block, dest, line_size); | |
| 2753 | −} | |
| 2754 | −static void ff_jref_idct4_add(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2755 | −{ | |
| 2756 | − ff_j_rev_dct4 (block); | |
| 2757 | − add_pixels_clamped4_c(block, dest, line_size); | |
| 2758 | −} | |
| 2759 | − | |
| 2760 | −static void ff_jref_idct2_put(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2761 | −{ | |
| 2762 | − ff_j_rev_dct2 (block); | |
| 2763 | − put_pixels_clamped2_c(block, dest, line_size); | |
| 2764 | −} | |
| 2765 | −static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2766 | −{ | |
| 2767 | − ff_j_rev_dct2 (block); | |
| 2768 | − add_pixels_clamped2_c(block, dest, line_size); | |
| 2769 | −} | |
| 2770 | − | |
| 2771 | −static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2772 | −{ | |
| 2773 | − dest[0] = av_clip_uint8((block[0] + 4)>>3); | |
| 2774 | −} | |
| 2775 | −static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2776 | −{ | |
| 2777 | − dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3)); | |
| 2778 | −} | |
| 2779 | − | |
| 2780 | 2687 | static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; } |
| 2781 | 2688 | |
| 2782 | 2689 | /* init static data */ |
| @@ -2843,28 +2750,12 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 60 unmodified lines | ||
| 2843 | 2750 | } |
| 2844 | 2751 | #endif //CONFIG_ENCODERS |
| 2845 | 2752 | |
| 2846 | − if(avctx->lowres==1){ | |
| 2847 | − c->idct_put= ff_jref_idct4_put; | |
| 2848 | − c->idct_add= ff_jref_idct4_add; | |
| 2849 | − c->idct = ff_j_rev_dct4; | |
| 2850 | − c->idct_permutation_type= FF_NO_IDCT_PERM; | |
| 2851 | − }else if(avctx->lowres==2){ | |
| 2852 | − c->idct_put= ff_jref_idct2_put; | |
| 2853 | − c->idct_add= ff_jref_idct2_add; | |
| 2854 | − c->idct = ff_j_rev_dct2; | |
| 2855 | − c->idct_permutation_type= FF_NO_IDCT_PERM; | |
| 2856 | − }else if(avctx->lowres==3){ | |
| 2857 | − c->idct_put= ff_jref_idct1_put; | |
| 2858 | − c->idct_add= ff_jref_idct1_add; | |
| 2859 | − c->idct = ff_j_rev_dct1; | |
| 2860 | − c->idct_permutation_type= FF_NO_IDCT_PERM; | |
| 2861 | − }else{ | |
| 2862 | − if (avctx->bits_per_raw_sample == 10) { | |
| 2863 | − c->idct_put = ff_simple_idct_put_10; | |
| 2864 | − c->idct_add = ff_simple_idct_add_10; | |
| 2865 | − c->idct = ff_simple_idct_10; | |
| 2866 | − c->idct_permutation_type = FF_NO_IDCT_PERM; | |
| 2867 | − } else { | |
| 2753 | + if (avctx->bits_per_raw_sample == 10) { | |
| 2754 | + c->idct_put = ff_simple_idct_put_10; | |
| 2755 | + c->idct_add = ff_simple_idct_add_10; | |
| 2756 | + c->idct = ff_simple_idct_10; | |
| 2757 | + c->idct_permutation_type = FF_NO_IDCT_PERM; | |
| 2758 | + } else { | |
| 2868 | 2759 | if(avctx->idct_algo==FF_IDCT_INT){ |
| 2869 | 2760 | c->idct_put= ff_jref_idct_put; |
| 2870 | 2761 | c->idct_add= ff_jref_idct_add; |
| @@ -2895,7 +2786,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 24 unmodified lines | ||
| 2895 | 2786 | c->idct = ff_simple_idct_8; |
| 2896 | 2787 | c->idct_permutation_type= FF_NO_IDCT_PERM; |
| 2897 | 2788 | } |
| 2898 | − } | |
| 2899 | 2789 | } |
| 2900 | 2790 | |
| 2901 | 2791 | c->diff_pixels = diff_pixels_c; |
| @@ -46,9 +46,6 @@ void ff_fdct248_islow_8(DCTELEM *data); · 45 unmodified lines | ||
| 46 | 46 | void ff_fdct248_islow_10(DCTELEM *data); |
| 47 | 47 | |
| 48 | 48 | void ff_j_rev_dct (DCTELEM *data); |
| 49 | −void ff_j_rev_dct4 (DCTELEM *data); | |
| 50 | −void ff_j_rev_dct2 (DCTELEM *data); | |
| 51 | −void ff_j_rev_dct1 (DCTELEM *data); | |
| 52 | 49 | void ff_wmv2_idct_c(DCTELEM *data); |
| 53 | 50 | |
| 54 | 51 | void ff_fdct_mmx(DCTELEM *block); |
| @@ -311,13 +311,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx) · 310 unmodified lines | ||
| 311 | 311 | /* 248DCT setup */ |
| 312 | 312 | s->fdct[1] = dsp.fdct248; |
| 313 | 313 | s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP |
| 314 | − if (avctx->lowres){ | |
| 315 | − for (i = 0; i < 64; i++){ | |
| 316 | − int j = ff_zigzag248_direct[i]; | |
| 317 | − s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2]; | |
| 318 | − } | |
| 319 | − }else | |
| 320 | − memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); | |
| 314 | + memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); | |
| 321 | 315 | |
| 322 | 316 | avctx->coded_frame = &s->picture; |
| 323 | 317 | s->avctx = avctx; |
| @@ -144,7 +144,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) · 143 unmodified lines | ||
| 144 | 144 | LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]); |
| 145 | 145 | LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ |
| 146 | 146 | LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ |
| 147 | − const int log2_blocksize = 3-s->avctx->lowres; | |
| 147 | + const int log2_blocksize = 3; | |
| 148 | 148 | int is_field_mode[5]; |
| 149 | 149 | |
| 150 | 150 | assert((((int)mb_bit_buffer) & 7) == 0); |
| @@ -382,6 +382,5 @@ AVCodec ff_dvvideo_decoder = { · 231 unmodified lines | ||
| 382 | 382 | .close = dvvideo_close, |
| 383 | 383 | .decode = dvvideo_decode_frame, |
| 384 | 384 | .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS, |
| 385 | − .max_lowres = 3, | |
| 386 | 385 | .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), |
| 387 | 386 | }; |
| @@ -907,7 +907,7 @@ void ff_er_frame_end(MpegEncContext *s) · 906 unmodified lines | ||
| 907 | 907 | |
| 908 | 908 | /* We do not support ER of field pictures yet, |
| 909 | 909 | * though it should not crash if enabled. */ |
| 910 | − if (!s->err_recognition || s->error_count == 0 || s->avctx->lowres || | |
| 910 | + if (!s->err_recognition || s->error_count == 0 || | |
| 911 | 911 | s->avctx->hwaccel || |
| 912 | 912 | s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU || |
| 913 | 913 | s->picture_structure != PICT_FRAME || |
| @@ -127,7 +127,6 @@ AVCodec ff_flv_decoder = { · 126 unmodified lines | ||
| 127 | 127 | .close = ff_h263_decode_end, |
| 128 | 128 | .decode = ff_h263_decode_frame, |
| 129 | 129 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 130 | − .max_lowres = 3, | |
| 131 | 130 | .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"), |
| 132 | 131 | .pix_fmts = ff_pixfmt_list_420, |
| 133 | 132 | }; |
| @@ -658,6 +658,5 @@ AVCodec ff_h261_decoder = { · 657 unmodified lines | ||
| 658 | 658 | .close = h261_decode_end, |
| 659 | 659 | .decode = h261_decode_frame, |
| 660 | 660 | .capabilities = CODEC_CAP_DR1, |
| 661 | − .max_lowres = 3, | |
| 662 | 661 | .long_name = NULL_IF_CONFIG_SMALL("H.261"), |
| 663 | 662 | }; |
| @@ -151,7 +151,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){ · 150 unmodified lines | ||
| 151 | 151 | |
| 152 | 152 | static int decode_slice(MpegEncContext *s){ |
| 153 | 153 | const int part_mask= s->partitioned_frame ? (ER_AC_END|ER_AC_ERROR) : 0x7F; |
| 154 | − const int mb_size= 16>>s->avctx->lowres; | |
| 154 | + const int mb_size = 16; | |
| 155 | 155 | s->last_resync_gb= s->gb; |
| 156 | 156 | s->first_slice_line= 1; |
| 157 | 157 | |
| @@ -764,7 +764,6 @@ AVCodec ff_h263_decoder = { · 606 unmodified lines | ||
| 764 | 764 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | |
| 765 | 765 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, |
| 766 | 766 | .flush = ff_mpeg_flush, |
| 767 | − .max_lowres = 3, | |
| 768 | 767 | .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"), |
| 769 | 768 | .pix_fmts = ff_hwaccel_pixfmt_list_420, |
| 770 | 769 | }; |
| @@ -716,7 +716,6 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w) · 715 unmodified lines | ||
| 716 | 716 | * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function. |
| 717 | 717 | * The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function. |
| 718 | 718 | * This function does not use MPV_decode_mb(). |
| 719 | − * lowres decoding is theoretically impossible. | |
| 720 | 719 | * @param w pointer to IntraX8Context |
| 721 | 720 | * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1. |
| 722 | 721 | * @param quant_offset offset away from zero |
| @@ -940,216 +940,3 @@ void ff_j_rev_dct(DCTBLOCK data) · 939 unmodified lines | ||
| 940 | 940 | dataptr++; /* advance pointer to next column */ |
| 941 | 941 | } |
| 942 | 942 | } |
| 943 | − | |
| 944 | −#undef DCTSIZE | |
| 945 | −#define DCTSIZE 4 | |
| 946 | −#define DCTSTRIDE 8 | |
| 947 | − | |
| 948 | −void ff_j_rev_dct4(DCTBLOCK data) | |
| 949 | −{ | |
| 950 | − int32_t tmp0, tmp1, tmp2, tmp3; | |
| 951 | − int32_t tmp10, tmp11, tmp12, tmp13; | |
| 952 | − int32_t z1; | |
| 953 | − int32_t d0, d2, d4, d6; | |
| 954 | − register DCTELEM *dataptr; | |
| 955 | − int rowctr; | |
| 956 | − | |
| 957 | − /* Pass 1: process rows. */ | |
| 958 | − /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ | |
| 959 | − /* furthermore, we scale the results by 2**PASS1_BITS. */ | |
| 960 | − | |
| 961 | − data[0] += 4; | |
| 962 | − | |
| 963 | − dataptr = data; | |
| 964 | − | |
| 965 | − for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { | |
| 966 | − /* Due to quantization, we will usually find that many of the input | |
| 967 | − * coefficients are zero, especially the AC terms. We can exploit this | |
| 968 | − * by short-circuiting the IDCT calculation for any row in which all | |
| 969 | − * the AC terms are zero. In that case each output is equal to the | |
| 970 | − * DC coefficient (with scale factor as needed). | |
| 971 | − * With typical images and quantization tables, half or more of the | |
| 972 | − * row DCT calculations can be simplified this way. | |
| 973 | − */ | |
| 974 | − | |
| 975 | − register int *idataptr = (int*)dataptr; | |
| 976 | − | |
| 977 | − d0 = dataptr[0]; | |
| 978 | − d2 = dataptr[1]; | |
| 979 | − d4 = dataptr[2]; | |
| 980 | − d6 = dataptr[3]; | |
| 981 | − | |
| 982 | − if ((d2 | d4 | d6) == 0) { | |
| 983 | − /* AC terms all zero */ | |
| 984 | − if (d0) { | |
| 985 | − /* Compute a 32 bit value to assign. */ | |
| 986 | − DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); | |
| 987 | − register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); | |
| 988 | − | |
| 989 | − idataptr[0] = v; | |
| 990 | − idataptr[1] = v; | |
| 991 | − } | |
| 992 | − | |
| 993 | − dataptr += DCTSTRIDE; /* advance pointer to next row */ | |
| 994 | − continue; | |
| 995 | − } | |
| 996 | − | |
| 997 | − /* Even part: reverse the even part of the forward DCT. */ | |
| 998 | − /* The rotator is sqrt(2)*c(-6). */ | |
| 999 | − if (d6) { | |
| 1000 | − if (d2) { | |
| 1001 | − /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ | |
| 1002 | − z1 = MULTIPLY(d2 + d6, FIX_0_541196100); | |
| 1003 | − tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); | |
| 1004 | − tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); | |
| 1005 | − | |
| 1006 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1007 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1008 | − | |
| 1009 | − tmp10 = tmp0 + tmp3; | |
| 1010 | − tmp13 = tmp0 - tmp3; | |
| 1011 | − tmp11 = tmp1 + tmp2; | |
| 1012 | − tmp12 = tmp1 - tmp2; | |
| 1013 | − } else { | |
| 1014 | − /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ | |
| 1015 | − tmp2 = MULTIPLY(-d6, FIX_1_306562965); | |
| 1016 | − tmp3 = MULTIPLY(d6, FIX_0_541196100); | |
| 1017 | − | |
| 1018 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1019 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1020 | − | |
| 1021 | − tmp10 = tmp0 + tmp3; | |
| 1022 | − tmp13 = tmp0 - tmp3; | |
| 1023 | − tmp11 = tmp1 + tmp2; | |
| 1024 | − tmp12 = tmp1 - tmp2; | |
| 1025 | − } | |
| 1026 | − } else { | |
| 1027 | − if (d2) { | |
| 1028 | − /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ | |
| 1029 | − tmp2 = MULTIPLY(d2, FIX_0_541196100); | |
| 1030 | − tmp3 = MULTIPLY(d2, FIX_1_306562965); | |
| 1031 | − | |
| 1032 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1033 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1034 | − | |
| 1035 | − tmp10 = tmp0 + tmp3; | |
| 1036 | − tmp13 = tmp0 - tmp3; | |
| 1037 | − tmp11 = tmp1 + tmp2; | |
| 1038 | − tmp12 = tmp1 - tmp2; | |
| 1039 | − } else { | |
| 1040 | − /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ | |
| 1041 | − tmp10 = tmp13 = (d0 + d4) << CONST_BITS; | |
| 1042 | − tmp11 = tmp12 = (d0 - d4) << CONST_BITS; | |
| 1043 | − } | |
| 1044 | − } | |
| 1045 | − | |
| 1046 | − /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ | |
| 1047 | − | |
| 1048 | − dataptr[0] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS); | |
| 1049 | − dataptr[1] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS); | |
| 1050 | − dataptr[2] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS); | |
| 1051 | − dataptr[3] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS); | |
| 1052 | − | |
| 1053 | − dataptr += DCTSTRIDE; /* advance pointer to next row */ | |
| 1054 | − } | |
| 1055 | − | |
| 1056 | − /* Pass 2: process columns. */ | |
| 1057 | − /* Note that we must descale the results by a factor of 8 == 2**3, */ | |
| 1058 | − /* and also undo the PASS1_BITS scaling. */ | |
| 1059 | − | |
| 1060 | − dataptr = data; | |
| 1061 | − for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { | |
| 1062 | − /* Columns of zeroes can be exploited in the same way as we did with rows. | |
| 1063 | − * However, the row calculation has created many nonzero AC terms, so the | |
| 1064 | − * simplification applies less often (typically 5% to 10% of the time). | |
| 1065 | − * On machines with very fast multiplication, it's possible that the | |
| 1066 | − * test takes more time than it's worth. In that case this section | |
| 1067 | − * may be commented out. | |
| 1068 | − */ | |
| 1069 | − | |
| 1070 | − d0 = dataptr[DCTSTRIDE*0]; | |
| 1071 | − d2 = dataptr[DCTSTRIDE*1]; | |
| 1072 | − d4 = dataptr[DCTSTRIDE*2]; | |
| 1073 | − d6 = dataptr[DCTSTRIDE*3]; | |
| 1074 | − | |
| 1075 | − /* Even part: reverse the even part of the forward DCT. */ | |
| 1076 | − /* The rotator is sqrt(2)*c(-6). */ | |
| 1077 | − if (d6) { | |
| 1078 | − if (d2) { | |
| 1079 | − /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ | |
| 1080 | − z1 = MULTIPLY(d2 + d6, FIX_0_541196100); | |
| 1081 | − tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); | |
| 1082 | − tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); | |
| 1083 | − | |
| 1084 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1085 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1086 | − | |
| 1087 | − tmp10 = tmp0 + tmp3; | |
| 1088 | − tmp13 = tmp0 - tmp3; | |
| 1089 | − tmp11 = tmp1 + tmp2; | |
| 1090 | − tmp12 = tmp1 - tmp2; | |
| 1091 | − } else { | |
| 1092 | − /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ | |
| 1093 | − tmp2 = MULTIPLY(-d6, FIX_1_306562965); | |
| 1094 | − tmp3 = MULTIPLY(d6, FIX_0_541196100); | |
| 1095 | − | |
| 1096 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1097 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1098 | − | |
| 1099 | − tmp10 = tmp0 + tmp3; | |
| 1100 | − tmp13 = tmp0 - tmp3; | |
| 1101 | − tmp11 = tmp1 + tmp2; | |
| 1102 | − tmp12 = tmp1 - tmp2; | |
| 1103 | − } | |
| 1104 | − } else { | |
| 1105 | − if (d2) { | |
| 1106 | − /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ | |
| 1107 | − tmp2 = MULTIPLY(d2, FIX_0_541196100); | |
| 1108 | − tmp3 = MULTIPLY(d2, FIX_1_306562965); | |
| 1109 | − | |
| 1110 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1111 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1112 | − | |
| 1113 | − tmp10 = tmp0 + tmp3; | |
| 1114 | − tmp13 = tmp0 - tmp3; | |
| 1115 | − tmp11 = tmp1 + tmp2; | |
| 1116 | − tmp12 = tmp1 - tmp2; | |
| 1117 | − } else { | |
| 1118 | − /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ | |
| 1119 | − tmp10 = tmp13 = (d0 + d4) << CONST_BITS; | |
| 1120 | − tmp11 = tmp12 = (d0 - d4) << CONST_BITS; | |
| 1121 | − } | |
| 1122 | − } | |
| 1123 | − | |
| 1124 | − /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ | |
| 1125 | − | |
| 1126 | − dataptr[DCTSTRIDE*0] = tmp10 >> (CONST_BITS+PASS1_BITS+3); | |
| 1127 | − dataptr[DCTSTRIDE*1] = tmp11 >> (CONST_BITS+PASS1_BITS+3); | |
| 1128 | − dataptr[DCTSTRIDE*2] = tmp12 >> (CONST_BITS+PASS1_BITS+3); | |
| 1129 | − dataptr[DCTSTRIDE*3] = tmp13 >> (CONST_BITS+PASS1_BITS+3); | |
| 1130 | − | |
| 1131 | − dataptr++; /* advance pointer to next column */ | |
| 1132 | − } | |
| 1133 | −} | |
| 1134 | − | |
| 1135 | −void ff_j_rev_dct2(DCTBLOCK data){ | |
| 1136 | − int d00, d01, d10, d11; | |
| 1137 | − | |
| 1138 | − data[0] += 4; | |
| 1139 | − d00 = data[0+0*DCTSTRIDE] + data[1+0*DCTSTRIDE]; | |
| 1140 | − d01 = data[0+0*DCTSTRIDE] - data[1+0*DCTSTRIDE]; | |
| 1141 | − d10 = data[0+1*DCTSTRIDE] + data[1+1*DCTSTRIDE]; | |
| 1142 | − d11 = data[0+1*DCTSTRIDE] - data[1+1*DCTSTRIDE]; | |
| 1143 | − | |
| 1144 | − data[0+0*DCTSTRIDE]= (d00 + d10)>>3; | |
| 1145 | − data[1+0*DCTSTRIDE]= (d01 + d11)>>3; | |
| 1146 | − data[0+1*DCTSTRIDE]= (d00 - d10)>>3; | |
| 1147 | − data[1+1*DCTSTRIDE]= (d01 - d11)>>3; | |
| 1148 | −} | |
| 1149 | − | |
| 1150 | −void ff_j_rev_dct1(DCTBLOCK data){ | |
| 1151 | − data[0] = (data[0] + 4)>>3; | |
| 1152 | −} | |
| 1153 | − | |
| 1154 | −#undef FIX | |
| 1155 | −#undef CONST_BITS | |
| @@ -286,7 +286,6 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, · 285 unmodified lines | ||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | ctx->dec_params.cp_limit_decoding = NO_LIMITATION; |
| 289 | − ctx->dec_params.cp_reduce = avctx->lowres; | |
| 290 | 289 | // Tie decoder with decoding parameters |
| 291 | 290 | opj_setup_decoder(dec, &ctx->dec_params); |
| 292 | 291 | stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size); |
| @@ -369,6 +368,6 @@ AVCodec ff_libopenjpeg_decoder = { · 76 unmodified lines | ||
| 369 | 368 | .decode = libopenjpeg_decode_frame, |
| 370 | 369 | .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, |
| 371 | 370 | .max_lowres = 5, |
| 372 | − .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"), | |
| 371 | + .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"), | |
| 373 | 372 | .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy), |
| 374 | 373 | }; |
| @@ -161,6 +161,5 @@ AVCodec ff_mjpegb_decoder = { · 160 unmodified lines | ||
| 161 | 161 | .close = ff_mjpeg_decode_end, |
| 162 | 162 | .decode = mjpegb_decode_frame, |
| 163 | 163 | .capabilities = CODEC_CAP_DR1, |
| 164 | − .max_lowres = 3, | |
| 165 | 164 | .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"), |
| 166 | 165 | }; |
| @@ -941,21 +941,6 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, · 940 unmodified lines | ||
| 941 | 941 | return 0; |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | −static av_always_inline void mjpeg_copy_block(uint8_t *dst, const uint8_t *src, | |
| 945 | − int linesize, int lowres) | |
| 946 | −{ | |
| 947 | − switch (lowres) { | |
| 948 | − case 0: copy_block8(dst, src, linesize, linesize, 8); | |
| 949 | − break; | |
| 950 | − case 1: copy_block4(dst, src, linesize, linesize, 4); | |
| 951 | − break; | |
| 952 | − case 2: copy_block2(dst, src, linesize, linesize, 2); | |
| 953 | − break; | |
| 954 | − case 3: *dst = *src; | |
| 955 | − break; | |
| 956 | − } | |
| 957 | −} | |
| 958 | − | |
| 959 | 944 | static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, |
| 960 | 945 | int Al, const uint8_t *mb_bitmask, |
| 961 | 946 | const AVFrame *reference) |
| @@ -1018,16 +1003,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, · 56 unmodified lines | ||
| 1018 | 1003 | x = 0; |
| 1019 | 1004 | y = 0; |
| 1020 | 1005 | for (j = 0; j < n; j++) { |
| 1021 | − block_offset = (((linesize[c] * (v * mb_y + y) * 8) + | |
| 1022 | − (h * mb_x + x) * 8) >> s->avctx->lowres); | |
| 1006 | + block_offset = ((linesize[c] * (v * mb_y + y) * 8) + | |
| 1007 | + (h * mb_x + x) * 8); | |
| 1023 | 1008 | |
| 1024 | 1009 | if (s->interlaced && s->bottom_field) |
| 1025 | 1010 | block_offset += linesize[c] >> 1; |
| 1026 | 1011 | ptr = data[c] + block_offset; |
| 1027 | 1012 | if (!s->progressive) { |
| 1028 | 1013 | if (copy_mb) |
| 1029 | − mjpeg_copy_block(ptr, reference_data[c] + block_offset, | |
| 1030 | − linesize[c], s->avctx->lowres); | |
| 1014 | + copy_block8(ptr, reference_data[c] + block_offset, | |
| 1015 | + linesize[c], linesize[c], 8); | |
| 1031 | 1016 | else { |
| 1032 | 1017 | s->dsp.clear_block(s->block); |
| 1033 | 1018 | if (decode_block(s, s->block, i, |
| @@ -1829,7 +1814,6 @@ AVCodec ff_mjpeg_decoder = { · 795 unmodified lines | ||
| 1829 | 1814 | .close = ff_mjpeg_decode_end, |
| 1830 | 1815 | .decode = ff_mjpeg_decode_frame, |
| 1831 | 1816 | .capabilities = CODEC_CAP_DR1, |
| 1832 | − .max_lowres = 3, | |
| 1833 | 1817 | .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"), |
| 1834 | 1818 | .priv_class = &mjpegdec_class, |
| 1835 | 1819 | }; |
| @@ -1843,6 +1827,5 @@ AVCodec ff_thp_decoder = { · 7 unmodified lines | ||
| 1843 | 1827 | .close = ff_mjpeg_decode_end, |
| 1844 | 1828 | .decode = ff_mjpeg_decode_frame, |
| 1845 | 1829 | .capabilities = CODEC_CAP_DR1, |
| 1846 | − .max_lowres = 3, | |
| 1847 | 1830 | .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"), |
| 1848 | 1831 | }; |
| @@ -1676,7 +1676,6 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 1675 unmodified lines | ||
| 1676 | 1676 | const uint8_t **buf, int buf_size) |
| 1677 | 1677 | { |
| 1678 | 1678 | AVCodecContext *avctx = s->avctx; |
| 1679 | − const int lowres = s->avctx->lowres; | |
| 1680 | 1679 | const int field_pic = s->picture_structure != PICT_FRAME; |
| 1681 | 1680 | |
| 1682 | 1681 | s->resync_mb_x = |
| @@ -1797,14 +1796,14 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 114 unmodified lines | ||
| 1797 | 1796 | } |
| 1798 | 1797 | } |
| 1799 | 1798 | |
| 1800 | − s->dest[0] += 16 >> lowres; | |
| 1801 | − s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift; | |
| 1802 | − s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift; | |
| 1799 | + s->dest[0] += 16; | |
| 1800 | + s->dest[1] += 16 >> s->chroma_x_shift; | |
| 1801 | + s->dest[2] += 16 >> s->chroma_x_shift; | |
| 1803 | 1802 | |
| 1804 | 1803 | ff_MPV_decode_mb(s, s->block); |
| 1805 | 1804 | |
| 1806 | 1805 | if (++s->mb_x >= s->mb_width) { |
| 1807 | − const int mb_size = 16 >> s->avctx->lowres; | |
| 1806 | + const int mb_size = 16; | |
| 1808 | 1807 | |
| 1809 | 1808 | ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size); |
| 1810 | 1809 | ff_MPV_report_decode_progress(s); |
| @@ -2579,7 +2578,6 @@ AVCodec ff_mpeg1video_decoder = { · 768 unmodified lines | ||
| 2579 | 2578 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | |
| 2580 | 2579 | CODEC_CAP_SLICE_THREADS, |
| 2581 | 2580 | .flush = flush, |
| 2582 | − .max_lowres = 3, | |
| 2583 | 2581 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), |
| 2584 | 2582 | .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context) |
| 2585 | 2583 | }; |
| @@ -2596,7 +2594,6 @@ AVCodec ff_mpeg2video_decoder = { · 10 unmodified lines | ||
| 2596 | 2594 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | |
| 2597 | 2595 | CODEC_CAP_SLICE_THREADS, |
| 2598 | 2596 | .flush = flush, |
| 2599 | − .max_lowres = 3, | |
| 2600 | 2597 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), |
| 2601 | 2598 | .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles), |
| 2602 | 2599 | }; |
| @@ -2327,7 +2327,6 @@ AVCodec ff_mpeg4_decoder = { · 2326 unmodified lines | ||
| 2327 | 2327 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | |
| 2328 | 2328 | CODEC_CAP_FRAME_THREADS, |
| 2329 | 2329 | .flush = ff_mpeg_flush, |
| 2330 | − .max_lowres = 3, | |
| 2331 | 2330 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), |
| 2332 | 2331 | .pix_fmts = ff_hwaccel_pixfmt_list_420, |
| 2333 | 2332 | .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles), |
| @@ -1784,381 +1784,6 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict) · 1783 unmodified lines | ||
| 1784 | 1784 | } |
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | −static inline int hpel_motion_lowres(MpegEncContext *s, | |
| 1788 | − uint8_t *dest, uint8_t *src, | |
| 1789 | − int field_based, int field_select, | |
| 1790 | − int src_x, int src_y, | |
| 1791 | − int width, int height, int stride, | |
| 1792 | − int h_edge_pos, int v_edge_pos, | |
| 1793 | − int w, int h, h264_chroma_mc_func *pix_op, | |
| 1794 | − int motion_x, int motion_y) | |
| 1795 | −{ | |
| 1796 | − const int lowres = s->avctx->lowres; | |
| 1797 | − const int op_index = FFMIN(lowres, 2); | |
| 1798 | − const int s_mask = (2 << lowres) - 1; | |
| 1799 | − int emu = 0; | |
| 1800 | − int sx, sy; | |
| 1801 | − | |
| 1802 | − if (s->quarter_sample) { | |
| 1803 | − motion_x /= 2; | |
| 1804 | − motion_y /= 2; | |
| 1805 | − } | |
| 1806 | − | |
| 1807 | − sx = motion_x & s_mask; | |
| 1808 | − sy = motion_y & s_mask; | |
| 1809 | − src_x += motion_x >> lowres + 1; | |
| 1810 | − src_y += motion_y >> lowres + 1; | |
| 1811 | − | |
| 1812 | − src += src_y * stride + src_x; | |
| 1813 | − | |
| 1814 | − if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) || | |
| 1815 | − (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { | |
| 1816 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1, | |
| 1817 | − (h + 1) << field_based, src_x, | |
| 1818 | − src_y << field_based, | |
| 1819 | − h_edge_pos, | |
| 1820 | − v_edge_pos); | |
| 1821 | − src = s->edge_emu_buffer; | |
| 1822 | − emu = 1; | |
| 1823 | − } | |
| 1824 | − | |
| 1825 | − sx = (sx << 2) >> lowres; | |
| 1826 | − sy = (sy << 2) >> lowres; | |
| 1827 | − if (field_select) | |
| 1828 | − src += s->linesize; | |
| 1829 | − pix_op[op_index](dest, src, stride, h, sx, sy); | |
| 1830 | − return emu; | |
| 1831 | −} | |
| 1832 | − | |
| 1833 | −/* apply one mpeg motion vector to the three components */ | |
| 1834 | −static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, | |
| 1835 | − uint8_t *dest_y, | |
| 1836 | − uint8_t *dest_cb, | |
| 1837 | − uint8_t *dest_cr, | |
| 1838 | − int field_based, | |
| 1839 | − int bottom_field, | |
| 1840 | − int field_select, | |
| 1841 | − uint8_t **ref_picture, | |
| 1842 | − h264_chroma_mc_func *pix_op, | |
| 1843 | − int motion_x, int motion_y, | |
| 1844 | − int h, int mb_y) | |
| 1845 | −{ | |
| 1846 | − uint8_t *ptr_y, *ptr_cb, *ptr_cr; | |
| 1847 | − int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, | |
| 1848 | − uvsx, uvsy; | |
| 1849 | − const int lowres = s->avctx->lowres; | |
| 1850 | − const int op_index = FFMIN(lowres-1+s->chroma_x_shift, 2); | |
| 1851 | − const int block_s = 8>>lowres; | |
| 1852 | − const int s_mask = (2 << lowres) - 1; | |
| 1853 | − const int h_edge_pos = s->h_edge_pos >> lowres; | |
| 1854 | − const int v_edge_pos = s->v_edge_pos >> lowres; | |
| 1855 | − linesize = s->current_picture.f.linesize[0] << field_based; | |
| 1856 | − uvlinesize = s->current_picture.f.linesize[1] << field_based; | |
| 1857 | − | |
| 1858 | − // FIXME obviously not perfect but qpel will not work in lowres anyway | |
| 1859 | − if (s->quarter_sample) { | |
| 1860 | − motion_x /= 2; | |
| 1861 | − motion_y /= 2; | |
| 1862 | − } | |
| 1863 | − | |
| 1864 | − if(field_based){ | |
| 1865 | − motion_y += (bottom_field - field_select)*((1 << lowres)-1); | |
| 1866 | − } | |
| 1867 | − | |
| 1868 | − sx = motion_x & s_mask; | |
| 1869 | − sy = motion_y & s_mask; | |
| 1870 | − src_x = s->mb_x * 2 * block_s + (motion_x >> lowres + 1); | |
| 1871 | − src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >> lowres + 1); | |
| 1872 | − | |
| 1873 | − if (s->out_format == FMT_H263) { | |
| 1874 | − uvsx = ((motion_x >> 1) & s_mask) | (sx & 1); | |
| 1875 | − uvsy = ((motion_y >> 1) & s_mask) | (sy & 1); | |
| 1876 | − uvsrc_x = src_x >> 1; | |
| 1877 | − uvsrc_y = src_y >> 1; | |
| 1878 | − } else if (s->out_format == FMT_H261) { | |
| 1879 | − // even chroma mv's are full pel in H261 | |
| 1880 | − mx = motion_x / 4; | |
| 1881 | − my = motion_y / 4; | |
| 1882 | − uvsx = (2 * mx) & s_mask; | |
| 1883 | − uvsy = (2 * my) & s_mask; | |
| 1884 | − uvsrc_x = s->mb_x * block_s + (mx >> lowres); | |
| 1885 | − uvsrc_y = mb_y * block_s + (my >> lowres); | |
| 1886 | − } else { | |
| 1887 | − if(s->chroma_y_shift){ | |
| 1888 | − mx = motion_x / 2; | |
| 1889 | − my = motion_y / 2; | |
| 1890 | − uvsx = mx & s_mask; | |
| 1891 | − uvsy = my & s_mask; | |
| 1892 | − uvsrc_x = s->mb_x * block_s + (mx >> lowres + 1); | |
| 1893 | − uvsrc_y = (mb_y * block_s >> field_based) + (my >> lowres + 1); | |
| 1894 | − } else { | |
| 1895 | − if(s->chroma_x_shift){ | |
| 1896 | − //Chroma422 | |
| 1897 | − mx = motion_x / 2; | |
| 1898 | − uvsx = mx & s_mask; | |
| 1899 | − uvsy = motion_y & s_mask; | |
| 1900 | − uvsrc_y = src_y; | |
| 1901 | − uvsrc_x = s->mb_x*block_s + (mx >> (lowres+1)); | |
| 1902 | − } else { | |
| 1903 | − //Chroma444 | |
| 1904 | − uvsx = motion_x & s_mask; | |
| 1905 | − uvsy = motion_y & s_mask; | |
| 1906 | − uvsrc_x = src_x; | |
| 1907 | − uvsrc_y = src_y; | |
| 1908 | − } | |
| 1909 | − } | |
| 1910 | − } | |
| 1911 | − | |
| 1912 | − ptr_y = ref_picture[0] + src_y * linesize + src_x; | |
| 1913 | − ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; | |
| 1914 | − ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; | |
| 1915 | − | |
| 1916 | − if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || | |
| 1917 | − (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { | |
| 1918 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, | |
| 1919 | − s->linesize, 17, 17 + field_based, | |
| 1920 | − src_x, src_y << field_based, h_edge_pos, | |
| 1921 | − v_edge_pos); | |
| 1922 | − ptr_y = s->edge_emu_buffer; | |
| 1923 | − if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { | |
| 1924 | − uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; | |
| 1925 | − s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, | |
| 1926 | − 9 + field_based, | |
| 1927 | − uvsrc_x, uvsrc_y << field_based, | |
| 1928 | − h_edge_pos >> 1, v_edge_pos >> 1); | |
| 1929 | − s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9, | |
| 1930 | − 9 + field_based, | |
| 1931 | − uvsrc_x, uvsrc_y << field_based, | |
| 1932 | − h_edge_pos >> 1, v_edge_pos >> 1); | |
| 1933 | − ptr_cb = uvbuf; | |
| 1934 | − ptr_cr = uvbuf + 16; | |
| 1935 | − } | |
| 1936 | − } | |
| 1937 | − | |
| 1938 | − // FIXME use this for field pix too instead of the obnoxious hack which changes picture.f.data | |
| 1939 | − if (bottom_field) { | |
| 1940 | − dest_y += s->linesize; | |
| 1941 | − dest_cb += s->uvlinesize; | |
| 1942 | − dest_cr += s->uvlinesize; | |
| 1943 | − } | |
| 1944 | − | |
| 1945 | − if (field_select) { | |
| 1946 | − ptr_y += s->linesize; | |
| 1947 | − ptr_cb += s->uvlinesize; | |
| 1948 | − ptr_cr += s->uvlinesize; | |
| 1949 | − } | |
| 1950 | − | |
| 1951 | − sx = (sx << 2) >> lowres; | |
| 1952 | − sy = (sy << 2) >> lowres; | |
| 1953 | − pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy); | |
| 1954 | − | |
| 1955 | − if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { | |
| 1956 | − uvsx = (uvsx << 2) >> lowres; | |
| 1957 | − uvsy = (uvsy << 2) >> lowres; | |
| 1958 | − if (h >> s->chroma_y_shift) { | |
| 1959 | − pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); | |
| 1960 | − pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); | |
| 1961 | − } | |
| 1962 | − } | |
| 1963 | − // FIXME h261 lowres loop filter | |
| 1964 | −} | |
| 1965 | − | |
| 1966 | −static inline void chroma_4mv_motion_lowres(MpegEncContext *s, | |
| 1967 | − uint8_t *dest_cb, uint8_t *dest_cr, | |
| 1968 | − uint8_t **ref_picture, | |
| 1969 | − h264_chroma_mc_func * pix_op, | |
| 1970 | − int mx, int my) | |
| 1971 | −{ | |
| 1972 | − const int lowres = s->avctx->lowres; | |
| 1973 | − const int op_index = FFMIN(lowres, 2); | |
| 1974 | − const int block_s = 8 >> lowres; | |
| 1975 | − const int s_mask = (2 << lowres) - 1; | |
| 1976 | − const int h_edge_pos = s->h_edge_pos >> lowres + 1; | |
| 1977 | − const int v_edge_pos = s->v_edge_pos >> lowres + 1; | |
| 1978 | − int emu = 0, src_x, src_y, offset, sx, sy; | |
| 1979 | − uint8_t *ptr; | |
| 1980 | − | |
| 1981 | − if (s->quarter_sample) { | |
| 1982 | − mx /= 2; | |
| 1983 | − my /= 2; | |
| 1984 | − } | |
| 1985 | − | |
| 1986 | − /* In case of 8X8, we construct a single chroma motion vector | |
| 1987 | − with a special rounding */ | |
| 1988 | − mx = ff_h263_round_chroma(mx); | |
| 1989 | − my = ff_h263_round_chroma(my); | |
| 1990 | − | |
| 1991 | − sx = mx & s_mask; | |
| 1992 | − sy = my & s_mask; | |
| 1993 | − src_x = s->mb_x * block_s + (mx >> lowres + 1); | |
| 1994 | − src_y = s->mb_y * block_s + (my >> lowres + 1); | |
| 1995 | − | |
| 1996 | − offset = src_y * s->uvlinesize + src_x; | |
| 1997 | − ptr = ref_picture[1] + offset; | |
| 1998 | − if (s->flags & CODEC_FLAG_EMU_EDGE) { | |
| 1999 | − if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) || | |
| 2000 | − (unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) { | |
| 2001 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, | |
| 2002 | − 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); | |
| 2003 | − ptr = s->edge_emu_buffer; | |
| 2004 | − emu = 1; | |
| 2005 | − } | |
| 2006 | − } | |
| 2007 | − sx = (sx << 2) >> lowres; | |
| 2008 | − sy = (sy << 2) >> lowres; | |
| 2009 | − pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy); | |
| 2010 | − | |
| 2011 | − ptr = ref_picture[2] + offset; | |
| 2012 | − if (emu) { | |
| 2013 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, | |
| 2014 | − src_x, src_y, h_edge_pos, v_edge_pos); | |
| 2015 | − ptr = s->edge_emu_buffer; | |
| 2016 | − } | |
| 2017 | − pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy); | |
| 2018 | −} | |
| 2019 | − | |
| 2020 | −/** | |
| 2021 | − * motion compensation of a single macroblock | |
| 2022 | − * @param s context | |
| 2023 | − * @param dest_y luma destination pointer | |
| 2024 | − * @param dest_cb chroma cb/u destination pointer | |
| 2025 | − * @param dest_cr chroma cr/v destination pointer | |
| 2026 | − * @param dir direction (0->forward, 1->backward) | |
| 2027 | − * @param ref_picture array[3] of pointers to the 3 planes of the reference picture | |
| 2028 | − * @param pix_op halfpel motion compensation function (average or put normally) | |
| 2029 | − * the motion vectors are taken from s->mv and the MV type from s->mv_type | |
| 2030 | − */ | |
| 2031 | −static inline void MPV_motion_lowres(MpegEncContext *s, | |
| 2032 | − uint8_t *dest_y, uint8_t *dest_cb, | |
| 2033 | − uint8_t *dest_cr, | |
| 2034 | − int dir, uint8_t **ref_picture, | |
| 2035 | − h264_chroma_mc_func *pix_op) | |
| 2036 | −{ | |
| 2037 | − int mx, my; | |
| 2038 | − int mb_x, mb_y, i; | |
| 2039 | − const int lowres = s->avctx->lowres; | |
| 2040 | − const int block_s = 8 >>lowres; | |
| 2041 | − | |
| 2042 | − mb_x = s->mb_x; | |
| 2043 | − mb_y = s->mb_y; | |
| 2044 | − | |
| 2045 | − switch (s->mv_type) { | |
| 2046 | − case MV_TYPE_16X16: | |
| 2047 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2048 | − 0, 0, 0, | |
| 2049 | − ref_picture, pix_op, | |
| 2050 | − s->mv[dir][0][0], s->mv[dir][0][1], | |
| 2051 | − 2 * block_s, mb_y); | |
| 2052 | − break; | |
| 2053 | − case MV_TYPE_8X8: | |
| 2054 | − mx = 0; | |
| 2055 | − my = 0; | |
| 2056 | − for (i = 0; i < 4; i++) { | |
| 2057 | − hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) * | |
| 2058 | − s->linesize) * block_s, | |
| 2059 | − ref_picture[0], 0, 0, | |
| 2060 | − (2 * mb_x + (i & 1)) * block_s, | |
| 2061 | − (2 * mb_y + (i >> 1)) * block_s, | |
| 2062 | − s->width, s->height, s->linesize, | |
| 2063 | − s->h_edge_pos >> lowres, s->v_edge_pos >> lowres, | |
| 2064 | − block_s, block_s, pix_op, | |
| 2065 | − s->mv[dir][i][0], s->mv[dir][i][1]); | |
| 2066 | − | |
| 2067 | − mx += s->mv[dir][i][0]; | |
| 2068 | − my += s->mv[dir][i][1]; | |
| 2069 | − } | |
| 2070 | − | |
| 2071 | − if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) | |
| 2072 | − chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, | |
| 2073 | − pix_op, mx, my); | |
| 2074 | − break; | |
| 2075 | − case MV_TYPE_FIELD: | |
| 2076 | − if (s->picture_structure == PICT_FRAME) { | |
| 2077 | − /* top field */ | |
| 2078 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2079 | − 1, 0, s->field_select[dir][0], | |
| 2080 | − ref_picture, pix_op, | |
| 2081 | − s->mv[dir][0][0], s->mv[dir][0][1], | |
| 2082 | − block_s, mb_y); | |
| 2083 | − /* bottom field */ | |
| 2084 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2085 | − 1, 1, s->field_select[dir][1], | |
| 2086 | − ref_picture, pix_op, | |
| 2087 | − s->mv[dir][1][0], s->mv[dir][1][1], | |
| 2088 | − block_s, mb_y); | |
| 2089 | − } else { | |
| 2090 | − if (s->picture_structure != s->field_select[dir][0] + 1 && | |
| 2091 | − s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { | |
| 2092 | − ref_picture = s->current_picture_ptr->f.data; | |
| 2093 | − | |
| 2094 | − } | |
| 2095 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2096 | − 0, 0, s->field_select[dir][0], | |
| 2097 | − ref_picture, pix_op, | |
| 2098 | − s->mv[dir][0][0], | |
| 2099 | − s->mv[dir][0][1], 2 * block_s, mb_y >> 1); | |
| 2100 | − } | |
| 2101 | − break; | |
| 2102 | − case MV_TYPE_16X8: | |
| 2103 | − for (i = 0; i < 2; i++) { | |
| 2104 | − uint8_t **ref2picture; | |
| 2105 | − | |
| 2106 | − if (s->picture_structure == s->field_select[dir][i] + 1 || | |
| 2107 | − s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { | |
| 2108 | − ref2picture = ref_picture; | |
| 2109 | − } else { | |
| 2110 | − ref2picture = s->current_picture_ptr->f.data; | |
| 2111 | − } | |
| 2112 | − | |
| 2113 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2114 | − 0, 0, s->field_select[dir][i], | |
| 2115 | − ref2picture, pix_op, | |
| 2116 | − s->mv[dir][i][0], s->mv[dir][i][1] + | |
| 2117 | − 2 * block_s * i, block_s, mb_y >> 1); | |
| 2118 | − | |
| 2119 | − dest_y += 2 * block_s * s->linesize; | |
| 2120 | − dest_cb += (2 * block_s >> s->chroma_y_shift) * s->uvlinesize; | |
| 2121 | − dest_cr += (2 * block_s >> s->chroma_y_shift) * s->uvlinesize; | |
| 2122 | − } | |
| 2123 | − break; | |
| 2124 | − case MV_TYPE_DMV: | |
| 2125 | − if (s->picture_structure == PICT_FRAME) { | |
| 2126 | − for (i = 0; i < 2; i++) { | |
| 2127 | − int j; | |
| 2128 | − for (j = 0; j < 2; j++) { | |
| 2129 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2130 | − 1, j, j ^ i, | |
| 2131 | − ref_picture, pix_op, | |
| 2132 | − s->mv[dir][2 * i + j][0], | |
| 2133 | − s->mv[dir][2 * i + j][1], | |
| 2134 | − block_s, mb_y); | |
| 2135 | − } | |
| 2136 | − pix_op = s->dsp.avg_h264_chroma_pixels_tab; | |
| 2137 | − } | |
| 2138 | − } else { | |
| 2139 | − for (i = 0; i < 2; i++) { | |
| 2140 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2141 | − 0, 0, s->picture_structure != i + 1, | |
| 2142 | − ref_picture, pix_op, | |
| 2143 | − s->mv[dir][2 * i][0],s->mv[dir][2 * i][1], | |
| 2144 | − 2 * block_s, mb_y >> 1); | |
| 2145 | − | |
| 2146 | − // after put we make avg of the same block | |
| 2147 | − pix_op = s->dsp.avg_h264_chroma_pixels_tab; | |
| 2148 | − | |
| 2149 | − // opposite parity is always in the same | |
| 2150 | − // frame if this is second field | |
| 2151 | − if (!s->first_field) { | |
| 2152 | − ref_picture = s->current_picture_ptr->f.data; | |
| 2153 | − } | |
| 2154 | − } | |
| 2155 | − } | |
| 2156 | − break; | |
| 2157 | − default: | |
| 2158 | − assert(0); | |
| 2159 | − } | |
| 2160 | −} | |
| 2161 | − | |
| 2162 | 1787 | /** |
| 2163 | 1788 | * find the lowest MB row referenced in the MVs |
| 2164 | 1789 | */ |
| @@ -2268,7 +1893,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s) · 103 unmodified lines | ||
| 2268 | 1893 | */ |
| 2269 | 1894 | static av_always_inline |
| 2270 | 1895 | void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], |
| 2271 | − int lowres_flag, int is_mpeg12) | |
| 1896 | + int is_mpeg12) | |
| 2272 | 1897 | { |
| 2273 | 1898 | const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; |
| 2274 | 1899 | if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ |
| @@ -2313,8 +1938,8 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], · 38 unmodified lines | ||
| 2313 | 1938 | qpel_mc_func (*op_qpix)[16]; |
| 2314 | 1939 | const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics |
| 2315 | 1940 | const int uvlinesize = s->current_picture.f.linesize[1]; |
| 2316 | − const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band || lowres_flag; | |
| 2317 | − const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8; | |
| 1941 | + const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band; | |
| 1942 | + const int block_size = 8; | |
| 2318 | 1943 | |
| 2319 | 1944 | /* avoid copy if macroblock skipped in last frame too */ |
| 2320 | 1945 | /* skip only during decoding as we might trash the buffers during encoding a bit */ |
| @@ -2363,31 +1988,19 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], · 42 unmodified lines | ||
| 2363 | 1988 | } |
| 2364 | 1989 | } |
| 2365 | 1990 | |
| 2366 | − if(lowres_flag){ | |
| 2367 | − h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab; | |
| 2368 | − | |
| 2369 | − if (s->mv_dir & MV_DIR_FORWARD) { | |
| 2370 | − MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix); | |
| 2371 | − op_pix = s->dsp.avg_h264_chroma_pixels_tab; | |
| 2372 | − } | |
| 2373 | − if (s->mv_dir & MV_DIR_BACKWARD) { | |
| 2374 | − MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix); | |
| 2375 | − } | |
| 1991 | + op_qpix= s->me.qpel_put; | |
| 1992 | + if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ | |
| 1993 | + op_pix = s->dsp.put_pixels_tab; | |
| 2376 | 1994 | }else{ |
| 2377 | − op_qpix= s->me.qpel_put; | |
| 2378 | − if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ | |
| 2379 | − op_pix = s->dsp.put_pixels_tab; | |
| 2380 | − }else{ | |
| 2381 | − op_pix = s->dsp.put_no_rnd_pixels_tab; | |
| 2382 | − } | |
| 2383 | − if (s->mv_dir & MV_DIR_FORWARD) { | |
| 2384 | − MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); | |
| 2385 | − op_pix = s->dsp.avg_pixels_tab; | |
| 2386 | − op_qpix= s->me.qpel_avg; | |
| 2387 | − } | |
| 2388 | − if (s->mv_dir & MV_DIR_BACKWARD) { | |
| 2389 | − MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); | |
| 2390 | − } | |
| 1995 | + op_pix = s->dsp.put_no_rnd_pixels_tab; | |
| 1996 | + } | |
| 1997 | + if (s->mv_dir & MV_DIR_FORWARD) { | |
| 1998 | + MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); | |
| 1999 | + op_pix = s->dsp.avg_pixels_tab; | |
| 2000 | + op_qpix= s->me.qpel_avg; | |
| 2001 | + } | |
| 2002 | + if (s->mv_dir & MV_DIR_BACKWARD) { | |
| 2003 | + MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); | |
| 2391 | 2004 | } |
| 2392 | 2005 | } |
| 2393 | 2006 | |
| @@ -2513,12 +2126,10 @@ skip_idct: · 119 unmodified lines | ||
| 2513 | 2126 | void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){ |
| 2514 | 2127 | #if !CONFIG_SMALL |
| 2515 | 2128 | if(s->out_format == FMT_MPEG1) { |
| 2516 | − if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1); | |
| 2517 | − else MPV_decode_mb_internal(s, block, 0, 1); | |
| 2129 | + MPV_decode_mb_internal(s, block, 1); | |
| 2518 | 2130 | } else |
| 2519 | 2131 | #endif |
| 2520 | − if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0); | |
| 2521 | − else MPV_decode_mb_internal(s, block, 0, 0); | |
| 2132 | + MPV_decode_mb_internal(s, block, 0); | |
| 2522 | 2133 | } |
| 2523 | 2134 | |
| 2524 | 2135 | /** |
| @@ -2593,7 +2204,7 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ · 68 unmodified lines | ||
| 2593 | 2204 | void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename |
| 2594 | 2205 | const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics |
| 2595 | 2206 | const int uvlinesize = s->current_picture.f.linesize[1]; |
| 2596 | − const int mb_size= 4 - s->avctx->lowres; | |
| 2207 | + const int mb_size= 4; | |
| 2597 | 2208 | |
| 2598 | 2209 | s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2; |
| 2599 | 2210 | s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2; |
| @@ -793,7 +793,7 @@ extern const enum PixelFormat ff_pixfmt_list_420[]; · 792 unmodified lines | ||
| 793 | 793 | extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[]; |
| 794 | 794 | |
| 795 | 795 | static inline void ff_update_block_index(MpegEncContext *s){ |
| 796 | − const int block_size= 8>>s->avctx->lowres; | |
| 796 | + const int block_size = 8; | |
| 797 | 797 | |
| 798 | 798 | s->block_index[0]+=2; |
| 799 | 799 | s->block_index[1]+=2; |
| @@ -1216,7 +1216,6 @@ AVCodec ff_msmpeg4v1_decoder = { · 1215 unmodified lines | ||
| 1216 | 1216 | .close = ff_h263_decode_end, |
| 1217 | 1217 | .decode = ff_h263_decode_frame, |
| 1218 | 1218 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1219 | − .max_lowres = 3, | |
| 1220 | 1219 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), |
| 1221 | 1220 | .pix_fmts = ff_pixfmt_list_420, |
| 1222 | 1221 | }; |
| @@ -1230,7 +1229,6 @@ AVCodec ff_msmpeg4v2_decoder = { · 7 unmodified lines | ||
| 1230 | 1229 | .close = ff_h263_decode_end, |
| 1231 | 1230 | .decode = ff_h263_decode_frame, |
| 1232 | 1231 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1233 | − .max_lowres = 3, | |
| 1234 | 1232 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), |
| 1235 | 1233 | .pix_fmts = ff_pixfmt_list_420, |
| 1236 | 1234 | }; |
| @@ -1244,7 +1242,6 @@ AVCodec ff_msmpeg4v3_decoder = { · 7 unmodified lines | ||
| 1244 | 1242 | .close = ff_h263_decode_end, |
| 1245 | 1243 | .decode = ff_h263_decode_frame, |
| 1246 | 1244 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1247 | − .max_lowres = 3, | |
| 1248 | 1245 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), |
| 1249 | 1246 | .pix_fmts = ff_pixfmt_list_420, |
| 1250 | 1247 | }; |
| @@ -1258,7 +1255,6 @@ AVCodec ff_wmv1_decoder = { · 7 unmodified lines | ||
| 1258 | 1255 | .close = ff_h263_decode_end, |
| 1259 | 1256 | .decode = ff_h263_decode_frame, |
| 1260 | 1257 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1261 | − .max_lowres = 3, | |
| 1262 | 1258 | .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"), |
| 1263 | 1259 | .pix_fmts = ff_pixfmt_list_420, |
| 1264 | 1260 | }; |
| @@ -339,5 +339,4 @@ AVCodec ff_mxpeg_decoder = { · 338 unmodified lines | ||
| 339 | 339 | .close = mxpeg_decode_end, |
| 340 | 340 | .decode = mxpeg_decode_frame, |
| 341 | 341 | .capabilities = CODEC_CAP_DR1, |
| 342 | − .max_lowres = 3, | |
| 343 | 342 | }; |
| @@ -326,7 +326,6 @@ static const AVOption options[]={ · 325 unmodified lines | ||
| 326 | 326 | {"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"}, |
| 327 | 327 | {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, |
| 328 | 328 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, |
| 329 | −{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|A|D}, | |
| 330 | 329 | {"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 331 | 330 | {"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 332 | 331 | {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| @@ -187,7 +187,7 @@ void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) · 186 unmodified lines | ||
| 187 | 187 | } |
| 188 | 188 | #endif //CONFIG_ENCODERS |
| 189 | 189 | |
| 190 | − if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) { | |
| 190 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 191 | 191 | if ((avctx->idct_algo == FF_IDCT_AUTO) || |
| 192 | 192 | (avctx->idct_algo == FF_IDCT_ALTIVEC)) { |
| 193 | 193 | c->idct_put = ff_idct_put_altivec; |
| @@ -435,8 +435,7 @@ av_log(s->avctx, AV_LOG_DEBUG, "\n");*/ · 434 unmodified lines | ||
| 435 | 435 | // s->obmc=1; |
| 436 | 436 | // s->umvplus=1; |
| 437 | 437 | s->modified_quant=1; |
| 438 | − if(!s->avctx->lowres) | |
| 439 | − s->loop_filter=1; | |
| 438 | + s->loop_filter=1; | |
| 440 | 439 | |
| 441 | 440 | if(s->avctx->debug & FF_DEBUG_PICT_INFO){ |
| 442 | 441 | av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", |
| @@ -755,7 +754,6 @@ AVCodec ff_rv10_decoder = { · 312 unmodified lines | ||
| 755 | 754 | .close = rv10_decode_end, |
| 756 | 755 | .decode = rv10_decode_frame, |
| 757 | 756 | .capabilities = CODEC_CAP_DR1, |
| 758 | − .max_lowres = 3, | |
| 759 | 757 | .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), |
| 760 | 758 | .pix_fmts = ff_pixfmt_list_420, |
| 761 | 759 | }; |
| @@ -770,7 +768,6 @@ AVCodec ff_rv20_decoder = { · 8 unmodified lines | ||
| 770 | 768 | .decode = rv10_decode_frame, |
| 771 | 769 | .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
| 772 | 770 | .flush = ff_mpeg_flush, |
| 773 | − .max_lowres = 3, | |
| 774 | 771 | .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"), |
| 775 | 772 | .pix_fmts = ff_pixfmt_list_420, |
| 776 | 773 | }; |
| @@ -102,7 +102,6 @@ AVCodec ff_sp5x_decoder = { · 101 unmodified lines | ||
| 102 | 102 | .close = ff_mjpeg_decode_end, |
| 103 | 103 | .decode = sp5x_decode_frame, |
| 104 | 104 | .capabilities = CODEC_CAP_DR1, |
| 105 | − .max_lowres = 3, | |
| 106 | 105 | .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), |
| 107 | 106 | }; |
| 108 | 107 | |
| @@ -149,8 +149,8 @@ unsigned avcodec_get_edge_width(void) · 148 unmodified lines | ||
| 149 | 149 | void avcodec_set_dimensions(AVCodecContext *s, int width, int height){ |
| 150 | 150 | s->coded_width = width; |
| 151 | 151 | s->coded_height= height; |
| 152 | − s->width = -((-width )>>s->lowres); | |
| 153 | − s->height= -((-height)>>s->lowres); | |
| 152 | + s->width = width; | |
| 153 | + s->height = height; | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | #define INTERNAL_BUFFER_SIZE (32+1) |
| @@ -239,9 +239,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, · 82 unmodified lines | ||
| 239 | 239 | |
| 240 | 240 | *width = FFALIGN(*width , w_align); |
| 241 | 241 | *height= FFALIGN(*height, h_align); |
| 242 | − if(s->codec_id == CODEC_ID_H264 || s->lowres) | |
| 242 | + if (s->codec_id == CODEC_ID_H264) | |
| 243 | 243 | *height+=2; // some of the optimized chroma MC reads one line too much |
| 244 | − // which is also done in mpeg decoders with lowres > 0 | |
| 245 | 244 | |
| 246 | 245 | for (i = 0; i < 4; i++) |
| 247 | 246 | linesize_align[i] = STRIDE_ALIGN; |
| @@ -844,6 +843,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD · 596 unmodified lines | ||
| 844 | 843 | ret = AVERROR(EINVAL); |
| 845 | 844 | goto free_and_end; |
| 846 | 845 | } |
| 846 | + | |
| 847 | 847 | if (av_codec_is_encoder(avctx->codec)) { |
| 848 | 848 | int i; |
| 849 | 849 | if (avctx->codec->sample_fmts) { |
| @@ -3203,7 +3203,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx) · 3202 unmodified lines | ||
| 3203 | 3203 | if (mm_flags & AV_CPU_FLAG_MMX) { |
| 3204 | 3204 | const int idct_algo = avctx->idct_algo; |
| 3205 | 3205 | |
| 3206 | − if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) { | |
| 3206 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 3207 | 3207 | if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) { |
| 3208 | 3208 | c->idct_put = ff_simple_idct_put_mmx; |
| 3209 | 3209 | c->idct_add = ff_simple_idct_add_mmx; |
| @@ -1852,7 +1852,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) · 1851 unmodified lines | ||
| 1852 | 1852 | unsigned int stts_sample = 0; |
| 1853 | 1853 | unsigned int sample_size; |
| 1854 | 1854 | unsigned int distance = 0; |
| 1855 | − int key_off = sc->keyframe_count && sc->keyframes[0] == 1; | |
| 1855 | + int key_off = (sc->keyframe_count && sc->keyframes[0] > 0) || (sc->stps_data && sc->stps_data[0] > 0); | |
| 1856 | 1856 | |
| 1857 | 1857 | current_dts -= sc->dts_shift; |
| 1858 | 1858 | |
| @@ -0,0 +1 @@ | ||
| 1 | +OBJS += arm/cpu.o | |
| @@ -0,0 +1,30 @@ | ||
| 1 | +/* | |
| 2 | + * This file is part of Libav. | |
| 3 | + * | |
| 4 | + * Libav is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * Libav is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with Libav; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#include "libavutil/cpu.h" | |
| 20 | +#include "config.h" | |
| 21 | + | |
| 22 | +int ff_get_cpu_flags_arm(void) | |
| 23 | +{ | |
| 24 | + return AV_CPU_FLAG_ARMV5TE * HAVE_ARMV5TE | | |
| 25 | + AV_CPU_FLAG_ARMV6 * HAVE_ARMV6 | | |
| 26 | + AV_CPU_FLAG_ARMV6T2 * HAVE_ARMV6T2 | | |
| 27 | + AV_CPU_FLAG_VFP * HAVE_ARMVFP | | |
| 28 | + AV_CPU_FLAG_VFPV3 * HAVE_VFPV3 | | |
| 29 | + AV_CPU_FLAG_NEON * HAVE_NEON; | |
| 30 | +} | |
| @@ -0,0 +1,32 @@ | ||
| 1 | +/* | |
| 2 | + * This file is part of Libav. | |
| 3 | + * | |
| 4 | + * Libav is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * Libav is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with Libav; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef AVUTIL_ARM_CPU_H | |
| 20 | +#define AVUTIL_ARM_CPU_H | |
| 21 | + | |
| 22 | +#include "config.h" | |
| 23 | +#include "libavutil/cpu.h" | |
| 24 | + | |
| 25 | +#define have_armv5te(flags) (HAVE_ARMV5TE && ((flags) & AV_CPU_FLAG_ARMV5TE)) | |
| 26 | +#define have_armv6(flags) (HAVE_ARMV6 && ((flags) & AV_CPU_FLAG_ARMV6)) | |
| 27 | +#define have_armv6t2(flags) (HAVE_ARMV6T2 && ((flags) & AV_CPU_FLAG_ARMV6T2)) | |
| 28 | +#define have_vfp(flags) (HAVE_ARMVFP && ((flags) & AV_CPU_FLAG_VFP)) | |
| 29 | +#define have_vfpv3(flags) (HAVE_VFPV3 && ((flags) & AV_CPU_FLAG_VFPV3)) | |
| 30 | +#define have_neon(flags) (HAVE_NEON && ((flags) & AV_CPU_FLAG_NEON)) | |
| 31 | + | |
| 32 | +#endif | |
| @@ -31,6 +31,7 @@ int av_get_cpu_flags(void) · 30 unmodified lines | ||
| 31 | 31 | if (checked) |
| 32 | 32 | return flags; |
| 33 | 33 | |
| 34 | + if (ARCH_ARM) flags = ff_get_cpu_flags_arm(); | |
| 34 | 35 | if (ARCH_PPC) flags = ff_get_cpu_flags_ppc(); |
| 35 | 36 | if (ARCH_X86) flags = ff_get_cpu_flags_x86(); |
| 36 | 37 | |
| @@ -54,7 +55,14 @@ static const struct { · 17 unmodified lines | ||
| 54 | 55 | int flag; |
| 55 | 56 | const char *name; |
| 56 | 57 | } cpu_flag_tab[] = { |
| 57 | −#if ARCH_PPC | |
| 58 | +#if ARCH_ARM | |
| 59 | + { AV_CPU_FLAG_ARMV5TE, "armv5te" }, | |
| 60 | + { AV_CPU_FLAG_ARMV6, "armv6" }, | |
| 61 | + { AV_CPU_FLAG_ARMV6T2, "armv6t2" }, | |
| 62 | + { AV_CPU_FLAG_VFP, "vfp" }, | |
| 63 | + { AV_CPU_FLAG_VFPV3, "vfpv3" }, | |
| 64 | + { AV_CPU_FLAG_NEON, "neon" }, | |
| 65 | +#elif ARCH_PPC | |
| 58 | 66 | { AV_CPU_FLAG_ALTIVEC, "altivec" }, |
| 59 | 67 | #elif ARCH_X86 |
| 60 | 68 | { AV_CPU_FLAG_MMX, "mmx" }, |
| @@ -45,6 +45,13 @@ · 44 unmodified lines | ||
| 45 | 45 | #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions |
| 46 | 46 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard |
| 47 | 47 | |
| 48 | +#define AV_CPU_FLAG_ARMV5TE (1 << 0) | |
| 49 | +#define AV_CPU_FLAG_ARMV6 (1 << 1) | |
| 50 | +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) | |
| 51 | +#define AV_CPU_FLAG_VFP (1 << 3) | |
| 52 | +#define AV_CPU_FLAG_VFPV3 (1 << 4) | |
| 53 | +#define AV_CPU_FLAG_NEON (1 << 5) | |
| 54 | + | |
| 48 | 55 | /** |
| 49 | 56 | * Return the flags which specify extensions supported by the CPU. |
| 50 | 57 | */ |
| @@ -66,6 +73,7 @@ void av_force_cpu_flags(int flags); · 15 unmodified lines | ||
| 66 | 73 | attribute_deprecated void av_set_cpu_flags_mask(int mask); |
| 67 | 74 | |
| 68 | 75 | /* The following CPU-specific functions shall not be called directly. */ |
| 76 | +int ff_get_cpu_flags_arm(void); | |
| 69 | 77 | int ff_get_cpu_flags_ppc(void); |
| 70 | 78 | int ff_get_cpu_flags_x86(void); |
| 71 | 79 | |