Skip to content
This repository
Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  g723.1: simplify scale_vector()
  g723.1: simplify normalize_bits()
  vda: cosmetics: fix Doxygen comment formatting
  vda: better frame allocation
  vda: Merge implementation into one file
  vda: support synchronous decoding
  vda: Reuse the bitstream buffer and reallocate it only if needed
  build: Factor out mpegvideo encoding dependencies to CONFIG_MPEGVIDEOENC
  avprobe: Include libm.h for the log2 fallback
  proresenc: use the edge emulation buffer
  rtmp: handle bytes read reports
  configure: Fix typo in mpeg2video/svq1 decoder dependency declaration
  Use log2(x) instead of log(x) / log(2)
  x86: swscale: fix fragile memory accesses
  x86: swscale: remove disabled code
  x86: yadif: fix asm with suncc
  x86: cabac: allow building with suncc
  x86: mlpdsp: avoid taking address of void
  ARM: intmath: use native-size return types for clipping functions

Conflicts:
	configure
	ffprobe.c
	libavcodec/Makefile
	libavcodec/g723_1.c
	libavcodec/v210dec.h
	libavcodec/vda.h
	libavcodec/vda_h264.c
	libavcodec/x86/cabac.h
	libavfilter/x86/yadif_template.c
	libswscale/x86/rgb2rgb_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information...
commit 7427d1ca4ab202def24fc3cefc4401a351d7248c 2 parents 0e05908 + 0d230e9
Michael Niedermayer michaelni authored
24 configure
@@ -1377,6 +1377,7 @@ CONFIG_EXTRA="
1377 1377 lpc
1378 1378 mpegaudiodsp
1379 1379 mpegvideo
  1380 + mpegvideoenc
1380 1381 nettle
1381 1382 rtpdec
1382 1383 sinewin
@@ -1500,6 +1501,7 @@ dct_select="rdft"
1500 1501 mdct_select="fft"
1501 1502 rdft_select="fft"
1502 1503 mpegaudiodsp_select="dct"
  1504 +mpegvideoenc_select="mpegvideo"
1503 1505
1504 1506 # decoders / encoders / hardware accelerators
1505 1507 aac_decoder_select="mdct sinewin"
@@ -1521,7 +1523,7 @@ cook_decoder_select="mdct sinewin"
1521 1523 cscd_decoder_suggest="zlib"
1522 1524 dca_decoder_select="mdct"
1523 1525 dirac_decoder_select="dwt golomb"
1524   -dnxhd_encoder_select="aandcttables mpegvideo"
  1526 +dnxhd_encoder_select="aandcttables mpegvideoenc"
1525 1527 dxa_decoder_select="zlib"
1526 1528 eac3_decoder_select="ac3_decoder"
1527 1529 eac3_encoder_select="mdct ac3dsp"
@@ -1540,9 +1542,9 @@ flv_decoder_select="h263_decoder"
1540 1542 flv_encoder_select="h263_encoder"
1541 1543 fraps_decoder_select="huffman"
1542 1544 h261_decoder_select="mpegvideo"
1543   -h261_encoder_select="aandcttables mpegvideo"
  1545 +h261_encoder_select="aandcttables mpegvideoenc"
1544 1546 h263_decoder_select="h263_parser mpegvideo"
1545   -h263_encoder_select="aandcttables mpegvideo"
  1547 +h263_encoder_select="aandcttables mpegvideoenc"
1546 1548 h263_vaapi_hwaccel_select="vaapi h263_decoder"
1547 1549 h263i_decoder_select="h263_decoder"
1548 1550 h263p_encoder_select="h263_encoder"
@@ -1558,10 +1560,10 @@ iac_decoder_select="fft mdct sinewin"
1558 1560 imc_decoder_select="fft mdct sinewin"
1559 1561 jpegls_decoder_select="golomb"
1560 1562 jpegls_encoder_select="golomb"
1561   -ljpeg_encoder_select="aandcttables mpegvideo"
  1563 +ljpeg_encoder_select="aandcttables mpegvideoenc"
1562 1564 loco_decoder_select="golomb"
1563 1565 mdec_decoder_select="mpegvideo"
1564   -mjpeg_encoder_select="aandcttables mpegvideo"
  1566 +mjpeg_encoder_select="aandcttables mpegvideoenc"
1565 1567 mlp_decoder_select="mlp_parser"
1566 1568 mp1_decoder_select="mpegaudiodsp"
1567 1569 mp1float_decoder_select="mpegaudiodsp"
@@ -1581,14 +1583,14 @@ mpeg_xvmc_decoder_select="mpegvideo_decoder"
1581 1583 mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
1582 1584 mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
1583 1585 mpeg1video_decoder_select="mpegvideo"
1584   -mpeg1video_encoder_select="aandcttables mpegvideo"
  1586 +mpeg1video_encoder_select="aandcttables mpegvideoenc"
1585 1587 mpeg2_crystalhd_decoder_select="crystalhd"
1586 1588 mpeg2_dxva2_hwaccel_deps="dxva2api_h"
1587 1589 mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
1588 1590 mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
1589 1591 mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
1590   -mpeg2video_encoder_select="mpegvideo"
1591   -mpeg2video_encoder_select="aandcttables mpegvideo"
  1592 +mpeg2video_decoder_select="mpegvideo"
  1593 +mpeg2video_encoder_select="aandcttables mpegvideoenc"
1592 1594 mpeg4_crystalhd_decoder_select="crystalhd"
1593 1595 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1594 1596 mpeg4_encoder_select="h263_encoder"
@@ -1618,12 +1620,12 @@ rv40_decoder_select="golomb h264chroma h264pred h264qpel mpegvideo"
1618 1620 shorten_decoder_select="golomb"
1619 1621 sipr_decoder_select="lsp"
1620 1622 snow_decoder_select="dwt"
1621   -snow_encoder_select="aandcttables dwt mpegvideo"
  1623 +snow_encoder_select="aandcttables dwt mpegvideoenc"
1622 1624 sonic_decoder_select="golomb"
1623 1625 sonic_encoder_select="golomb"
1624 1626 sonic_ls_encoder_select="golomb"
1625   -svq1_encoder_select="mpegvideo"
1626   -svq1_encoder_select="aandcttables mpegvideo"
  1627 +svq1_decoder_select="mpegvideo"
  1628 +svq1_encoder_select="aandcttables mpegvideoenc"
1627 1629 svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
1628 1630 svq3_decoder_suggest="zlib"
1629 1631 theora_decoder_select="vp3_decoder"
2  ffmpeg.c
@@ -1120,7 +1120,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
1120 1120 if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram))
1121 1121 qp_histogram[qp]++;
1122 1122 for (j = 0; j < 32; j++)
1123   - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j] + 1) / log(2)));
  1123 + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1)));
1124 1124 }
1125 1125 if (enc->flags&CODEC_FLAG_PSNR) {
1126 1126 int j;
3  ffprobe.c
@@ -33,6 +33,7 @@
33 33 #include "libavutil/opt.h"
34 34 #include "libavutil/pixdesc.h"
35 35 #include "libavutil/dict.h"
  36 +#include "libavutil/libm.h"
36 37 #include "libavutil/timecode.h"
37 38 #include "libavdevice/avdevice.h"
38 39 #include "libswscale/swscale.h"
@@ -121,7 +122,7 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
121 122 long long int index;
122 123
123 124 if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {
124   - index = (long long int) (log(vald)/log(2)) / 10;
  125 + index = (long long int) (log2(vald)) / 10;
125 126 index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);
126 127 vald /= pow(2, index * 10);
127 128 prefix_string = binary_unit_prefixes[index];
44 libavcodec/Makefile
@@ -56,6 +56,8 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
56 56 mpegaudiodsp_fixed.o \
57 57 mpegaudiodsp_float.o
58 58 OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o
  59 +OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
  60 + motion_est.o ratecontrol.o
59 61 RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
60 62 OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
61 63 OBJS-$(CONFIG_SINEWIN) += sinewin.o
@@ -144,9 +146,7 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o \
144 146 dirac_arith.o mpeg12data.o dwt.o
145 147 OBJS-$(CONFIG_DFA_DECODER) += dfa.o
146 148 OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
147   -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \
148   - mpegvideo_enc.o motion_est.o \
149   - ratecontrol.o mpeg12data.o
  149 +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
150 150 OBJS-$(CONFIG_DPX_DECODER) += dpx.o
151 151 OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o
152 152 OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinav.o
@@ -199,17 +199,13 @@ OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
199 199 OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
200 200 OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
201 201 OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o h261data.o error_resilience.o
202   -OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o h261data.o \
203   - mpegvideo_enc.o motion_est.o \
204   - ratecontrol.o mpeg12data.o
  202 +OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o h261data.o
205 203 OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \
206 204 mpeg4video.o mpeg4videodec.o flvdec.o\
207 205 intelh263dec.o error_resilience.o
208 206 OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
209   -OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o \
210   - mpeg4videoenc.o motion_est.o \
211   - ratecontrol.o h263.o ituh263enc.o \
212   - flvenc.o mpeg12data.o \
  207 +OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \
  208 + h263.o ituh263enc.o flvenc.o \
213 209 error_resilience.o
214 210 OBJS-$(CONFIG_H264_DECODER) += h264.o \
215 211 h264_loopfilter.o h264_direct.o \
@@ -243,9 +239,7 @@ OBJS-$(CONFIG_JV_DECODER) += jvdec.o
243 239 OBJS-$(CONFIG_KGV1_DECODER) += kgv1dec.o
244 240 OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o
245 241 OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o
246   -OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o \
247   - mpegvideo_enc.o motion_est.o \
248   - ratecontrol.o mpeg12data.o
  242 +OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o
249 243 OBJS-$(CONFIG_LOCO_DECODER) += loco.o
250 244 OBJS-$(CONFIG_MACE3_DECODER) += mace.o
251 245 OBJS-$(CONFIG_MACE6_DECODER) += mace.o
@@ -254,9 +248,7 @@ OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \
254 248 OBJS-$(CONFIG_MICRODVD_DECODER) += microdvddec.o ass.o
255 249 OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
256 250 OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o
257   -OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \
258   - mpegvideo_enc.o motion_est.o \
259   - ratecontrol.o mpeg12data.o
  251 +OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o
260 252 OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o
261 253 OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o
262 254 OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
@@ -298,19 +290,15 @@ OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12.o mpeg12data.o \
298 290 OBJS-$(CONFIG_MPEG_XVMC_DECODER) += mpegvideo_xvmc.o
299 291 OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o \
300 292 error_resilience.o
301   -OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \
  293 +OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o \
302 294 timecode.o \
303   - motion_est.o ratecontrol.o \
304   - mpeg12.o mpeg12data.o \
305 295 error_resilience.o
306 296 OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
307 297 OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
308 298 OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \
309 299 error_resilience.o
310   -OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \
  300 +OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o \
311 301 timecode.o \
312   - motion_est.o ratecontrol.o \
313   - mpeg12.o mpeg12data.o \
314 302 error_resilience.o
315 303 OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
316 304 OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o
@@ -411,10 +399,8 @@ OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o
411 399 OBJS-$(CONFIG_SMC_DECODER) += smc.o
412 400 OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o rangecoder.o
413 401 OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o rangecoder.o \
414   - motion_est.o ratecontrol.o \
415   - h263.o \
416   - error_resilience.o ituh263enc.o \
417   - mpegvideo_enc.o mpeg12data.o
  402 + h263.o ituh263enc.o \
  403 + error_resilience.o
418 404 OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o
419 405 OBJS-$(CONFIG_SONIC_DECODER) += sonic.o
420 406 OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o
@@ -428,10 +414,8 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
428 414 OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \
429 415 error_resilience.o
430 416 OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
431   - motion_est.o h263.o \
432   - error_resilience.o \
433   - ituh263enc.o mpegvideo_enc.o \
434   - ratecontrol.o mpeg12data.o
  417 + h263.o ituh263enc.o \
  418 + error_resilience.o
435 419 OBJS-$(CONFIG_SVQ3_DECODER) += h264.o svq3.o \
436 420 h264_loopfilter.o h264_direct.o \
437 421 h264_sei.o h264_ps.o h264_refs.o \
12 libavcodec/g723_1.c
@@ -230,17 +230,7 @@ static int16_t square_root(int val)
230 230 */
231 231 static int normalize_bits(int num, int width)
232 232 {
233   - int i = 0;
234   -
235   - if (num) {
236   - if (num == -1)
237   - return width;
238   - if (num < 0)
239   - num = ~num;
240   - i= width - av_log2(num) - 1;
241   - i= FFMAX(i, 0);
242   - }
243   - return i;
  233 + return width - av_log2(num) - 1;
244 234 }
245 235
246 236 #define normalize_bits_int16(num) normalize_bits(num, 15)
4 libavcodec/imc.c
@@ -342,7 +342,7 @@ static void imc_decode_level_coefficients(IMCContext *q, int *levlCoeffBuf,
342 342 // maybe some frequency division thingy
343 343
344 344 flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
345   - flcoeffs2[0] = log(flcoeffs1[0]) / log(2);
  345 + flcoeffs2[0] = log2f(flcoeffs1[0]);
346 346 tmp = flcoeffs1[0];
347 347 tmp2 = flcoeffs2[0];
348 348
@@ -414,7 +414,7 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx,
414 414 highest = FFMAX(highest, chctx->flcoeffs1[i]);
415 415
416 416 for (i = 0; i < BANDS - 1; i++)
417   - chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log(chctx->flcoeffs5[i]) / log(2);
  417 + chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]);
418 418 chctx->flcoeffs4[BANDS - 1] = limit;
419 419
420 420 highest = highest * 0.25;
2  libavcodec/snowenc.c
@@ -1538,7 +1538,7 @@ static void update_last_header_values(SnowContext *s){
1538 1538 }
1539 1539
1540 1540 static int qscale2qlog(int qscale){
1541   - return rint(QROOT*log(qscale / (float)FF_QP2LAMBDA)/log(2))
  1541 + return rint(QROOT*log2(qscale / (float)FF_QP2LAMBDA))
1542 1542 + 61*QROOT/8; ///< 64 > 60
1543 1543 }
1544 1544
168 libavcodec/vda.h
@@ -34,6 +34,7 @@
34 34 #if FF_API_VDA_ASYNC
35 35 #include <pthread.h>
36 36 #endif
  37 +
37 38 #include <stdint.h>
38 39
39 40 // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
@@ -53,34 +54,33 @@
53 54
54 55 #if FF_API_VDA_ASYNC
55 56 /**
56   - * This structure is used to store a decoded frame information and data.
  57 + * This structure is used to store decoded frame information and data.
57 58 *
58 59 * @deprecated Use synchronous decoding mode.
59   - *
60 60 */
61 61 typedef struct {
62 62 /**
63   - * The PTS of the frame.
64   - *
65   - * - encoding: unused
66   - * - decoding: Set/Unset by libavcodec.
67   - */
  63 + * The PTS of the frame.
  64 + *
  65 + * - encoding: unused
  66 + * - decoding: Set/Unset by libavcodec.
  67 + */
68 68 int64_t pts;
69 69
70 70 /**
71   - * The CoreVideo buffer that contains the decoded data.
72   - *
73   - * - encoding: unused
74   - * - decoding: Set/Unset by libavcodec.
75   - */
  71 + * The CoreVideo buffer that contains the decoded data.
  72 + *
  73 + * - encoding: unused
  74 + * - decoding: Set/Unset by libavcodec.
  75 + */
76 76 CVPixelBufferRef cv_buffer;
77 77
78 78 /**
79   - * A pointer to the next frame.
80   - *
81   - * - encoding: unused
82   - * - decoding: Set/Unset by libavcodec.
83   - */
  79 + * A pointer to the next frame.
  80 + *
  81 + * - encoding: unused
  82 + * - decoding: Set/Unset by libavcodec.
  83 + */
84 84 struct vda_frame *next_frame;
85 85 } vda_frame;
86 86 #endif
@@ -93,106 +93,106 @@ typedef struct {
93 93 */
94 94 struct vda_context {
95 95 /**
96   - * VDA decoder object.
97   - *
98   - * - encoding: unused
99   - * - decoding: Set/Unset by libavcodec.
100   - */
  96 + * VDA decoder object.
  97 + *
  98 + * - encoding: unused
  99 + * - decoding: Set/Unset by libavcodec.
  100 + */
101 101 VDADecoder decoder;
102 102
103 103 /**
104   - * The Core Video pixel buffer that contains the current image data.
105   - *
106   - * encoding: unused
107   - * decoding: Set by libavcodec. Unset by user.
108   - */
  104 + * The Core Video pixel buffer that contains the current image data.
  105 + *
  106 + * encoding: unused
  107 + * decoding: Set by libavcodec. Unset by user.
  108 + */
109 109 CVPixelBufferRef cv_buffer;
110 110
111 111 /**
112   - * An integer value that indicates whether use the hardware decoder in synchronous mode.
113   - *
114   - * encoding: unused
115   - * decoding: Set by user.
116   - */
  112 + * Use the hardware decoder in synchronous mode.
  113 + *
  114 + * encoding: unused
  115 + * decoding: Set by user.
  116 + */
117 117 int use_sync_decoding;
118 118
119 119 #if FF_API_VDA_ASYNC
120 120 /**
121   - * VDA frames queue ordered by presentation timestamp.
122   - *
123   - * @deprecated Use synchronous decoding mode.
124   - *
125   - * - encoding: unused
126   - * - decoding: Set/Unset by libavcodec.
127   - */
  121 + * VDA frames queue ordered by presentation timestamp.
  122 + *
  123 + * @deprecated Use synchronous decoding mode.
  124 + *
  125 + * - encoding: unused
  126 + * - decoding: Set/Unset by libavcodec.
  127 + */
128 128 vda_frame *queue;
129 129
130 130 /**
131   - * Mutex for locking queue operations.
132   - *
133   - * @deprecated Use synchronous decoding mode.
134   - *
135   - * - encoding: unused
136   - * - decoding: Set/Unset by libavcodec.
137   - */
  131 + * Mutex for locking queue operations.
  132 + *
  133 + * @deprecated Use synchronous decoding mode.
  134 + *
  135 + * - encoding: unused
  136 + * - decoding: Set/Unset by libavcodec.
  137 + */
138 138 pthread_mutex_t queue_mutex;
139 139 #endif
140 140
141 141 /**
142   - * The frame width.
143   - *
144   - * - encoding: unused
145   - * - decoding: Set/Unset by user.
146   - */
  142 + * The frame width.
  143 + *
  144 + * - encoding: unused
  145 + * - decoding: Set/Unset by user.
  146 + */
147 147 int width;
148 148
149 149 /**
150   - * The frame height.
151   - *
152   - * - encoding: unused
153   - * - decoding: Set/Unset by user.
154   - */
  150 + * The frame height.
  151 + *
  152 + * - encoding: unused
  153 + * - decoding: Set/Unset by user.
  154 + */
155 155 int height;
156 156
157 157 /**
158   - * The frame format.
159   - *
160   - * - encoding: unused
161   - * - decoding: Set/Unset by user.
162   - */
  158 + * The frame format.
  159 + *
  160 + * - encoding: unused
  161 + * - decoding: Set/Unset by user.
  162 + */
163 163 int format;
164 164
165 165 /**
166   - * The pixel format for output image buffers.
167   - *
168   - * - encoding: unused
169   - * - decoding: Set/Unset by user.
170   - */
  166 + * The pixel format for output image buffers.
  167 + *
  168 + * - encoding: unused
  169 + * - decoding: Set/Unset by user.
  170 + */
171 171 OSType cv_pix_fmt_type;
172 172
173 173 /**
174   - * The current bitstream buffer.
175   - *
176   - * - encoding: unused
177   - * - decoding: Set/Unset by libavcodec.
178   - */
179   - uint8_t *bitstream;
  174 + * The current bitstream buffer.
  175 + *
  176 + * - encoding: unused
  177 + * - decoding: Set/Unset by libavcodec.
  178 + */
  179 + uint8_t *priv_bitstream;
180 180
181 181 /**
182   - * The current size of the bitstream.
183   - *
184   - * - encoding: unused
185   - * - decoding: Set/Unset by libavcodec.
186   - */
187   - int bitstream_size;
  182 + * The current size of the bitstream.
  183 + *
  184 + * - encoding: unused
  185 + * - decoding: Set/Unset by libavcodec.
  186 + */
  187 + int priv_bitstream_size;
188 188
189 189 /**
190   - * The reference size used for fast reallocation.
191   - *
192   - * - encoding: unused
193   - * - decoding: Set/Unset by libavcodec.
194   - */
195   - int ref_size;
  190 + * The reference size used for fast reallocation.
  191 + *
  192 + * - encoding: unused
  193 + * - decoding: Set/Unset by libavcodec.
  194 + */
  195 + int priv_allocated_size;
196 196 };
197 197
198 198 /** Create the video decoder. */
46 libavcodec/vda_h264.c
@@ -130,7 +130,7 @@ static void vda_decoder_callback (void *vda_hw_ctx,
130 130 uint32_t infoFlags,
131 131 CVImageBufferRef image_buffer)
132 132 {
133   - struct vda_context *vda_ctx = (struct vda_context*)vda_hw_ctx;
  133 + struct vda_context *vda_ctx = vda_hw_ctx;
134 134
135 135 if (!image_buffer)
136 136 return;
@@ -140,8 +140,7 @@ static void vda_decoder_callback (void *vda_hw_ctx,
140 140
141 141 if (vda_ctx->use_sync_decoding) {
142 142 vda_ctx->cv_buffer = CVPixelBufferRetain(image_buffer);
143   - }
144   - else {
  143 + } else {
145 144 vda_frame *new_frame;
146 145 vda_frame *queue_walker;
147 146
@@ -188,8 +187,8 @@ static int vda_sync_decode(struct vda_context *vda_ctx)
188 187 uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames
189 188
190 189 coded_frame = CFDataCreate(kCFAllocatorDefault,
191   - vda_ctx->bitstream,
192   - vda_ctx->bitstream_size);
  190 + vda_ctx->priv_bitstream,
  191 + vda_ctx->priv_bitstream_size);
193 192
194 193 status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);
195 194
@@ -210,7 +209,7 @@ static int start_frame(AVCodecContext *avctx,
210 209 if (!vda_ctx->decoder)
211 210 return -1;
212 211
213   - vda_ctx->bitstream_size = 0;
  212 + vda_ctx->priv_bitstream_size = 0;
214 213
215 214 return 0;
216 215 }
@@ -225,38 +224,38 @@ static int decode_slice(AVCodecContext *avctx,
225 224 if (!vda_ctx->decoder)
226 225 return -1;
227 226
228   - tmp = av_fast_realloc(vda_ctx->bitstream,
229   - &vda_ctx->ref_size,
230   - vda_ctx->bitstream_size+size+4);
  227 + tmp = av_fast_realloc(vda_ctx->priv_bitstream,
  228 + &vda_ctx->priv_allocated_size,
  229 + vda_ctx->priv_bitstream_size + size + 4);
231 230 if (!tmp)
232 231 return AVERROR(ENOMEM);
233 232
234   - vda_ctx->bitstream = tmp;
  233 + vda_ctx->priv_bitstream = tmp;
235 234
236   - AV_WB32(vda_ctx->bitstream+vda_ctx->bitstream_size, size);
237   - memcpy(vda_ctx->bitstream+vda_ctx->bitstream_size+4, buffer, size);
  235 + AV_WB32(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size, size);
  236 + memcpy(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size + 4, buffer, size);
238 237
239   - vda_ctx->bitstream_size += size + 4;
  238 + vda_ctx->priv_bitstream_size += size + 4;
240 239
241 240 return 0;
242 241 }
243 242
244 243 static int end_frame(AVCodecContext *avctx)
245 244 {
246   - H264Context *h = avctx->priv_data;
247   - struct vda_context *vda_ctx = avctx->hwaccel_context;
248   - AVFrame *frame = &h->s.current_picture_ptr->f;
  245 + H264Context *h = avctx->priv_data;
  246 + struct vda_context *vda_ctx = avctx->hwaccel_context;
  247 + AVFrame *frame = &h->s.current_picture_ptr->f;
249 248 int status;
250 249
251   - if (!vda_ctx->decoder || !vda_ctx->bitstream)
  250 + if (!vda_ctx->decoder || !vda_ctx->priv_bitstream)
252 251 return -1;
253 252
254 253 if (vda_ctx->use_sync_decoding) {
255 254 status = vda_sync_decode(vda_ctx);
256 255 frame->data[3] = (void*)vda_ctx->cv_buffer;
257 256 } else {
258   - status = vda_decoder_decode(vda_ctx, vda_ctx->bitstream,
259   - vda_ctx->bitstream_size,
  257 + status = vda_decoder_decode(vda_ctx, vda_ctx->priv_bitstream,
  258 + vda_ctx->priv_bitstream_size,
260 259 frame->reordered_opaque);
261 260 }
262 261
@@ -280,8 +279,8 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
280 279 CFMutableDictionaryRef io_surface_properties;
281 280 CFNumberRef cv_pix_fmt;
282 281
283   - vda_ctx->bitstream = NULL;
284   - vda_ctx->ref_size = 0;
  282 + vda_ctx->priv_bitstream = NULL;
  283 + vda_ctx->priv_allocated_size = 0;
285 284
286 285 #if FF_API_VDA_ASYNC
287 286 pthread_mutex_init(&vda_ctx->queue_mutex, NULL);
@@ -341,7 +340,7 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
341 340
342 341 status = VDADecoderCreate(config_info,
343 342 buffer_attributes,
344   - (VDADecoderOutputCallback *)vda_decoder_callback,
  343 + vda_decoder_callback,
345 344 vda_ctx,
346 345 &vda_ctx->decoder);
347 346
@@ -368,8 +367,7 @@ int ff_vda_destroy_decoder(struct vda_context *vda_ctx)
368 367 vda_clear_queue(vda_ctx);
369 368 pthread_mutex_destroy(&vda_ctx->queue_mutex);
370 369 #endif
371   - if (vda_ctx->bitstream)
372   - av_freep(&vda_ctx->bitstream);
  370 + av_freep(&vda_ctx->priv_bitstream);
373 371
374 372 return status;
375 373 }
3  libavcodec/version.h
@@ -89,6 +89,9 @@
89 89 #ifndef FF_API_CODEC_ID
90 90 #define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 55)
91 91 #endif
  92 +#ifndef FF_API_VDA_ASYNC
  93 +#define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55)
  94 +#endif
92 95
93 96 #ifndef FF_API_VDA_ASYNC
94 97 #define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55)
22 libavcodec/x86/cabac.h
@@ -169,14 +169,16 @@ static av_always_inline int get_cabac_inline_x86(CABACContext *c,
169 169 __asm__ volatile(
170 170 BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1",
171 171 "%2", "%q2", "%3", "%b3",
172   - "%a6(%5)", "%a7(%5)", "%a8", "%a9", "%a10", "%11")
  172 + "%c6(%5)", "%c7(%5)",
  173 + AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
  174 + AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
  175 + AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
  176 + "%8")
173 177 : "=&r"(bit), "+&r"(c->low), "+&r"(c->range), "=&q"(tmp)
174 178 : "r"(state), "r"(c),
175 179 "i"(offsetof(CABACContext, bytestream)),
176   - "i"(offsetof(CABACContext, bytestream_end)),
177   - "i"(H264_NORM_SHIFT_OFFSET),
178   - "i"(H264_LPS_RANGE_OFFSET),
179   - "i"(H264_MLPS_STATE_OFFSET) TABLES_ARG
  180 + "i"(offsetof(CABACContext, bytestream_end))
  181 + TABLES_ARG
180 182 : "%"REG_c, "memory"
181 183 );
182 184 return bit & 1;
@@ -188,8 +190,8 @@ static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)
188 190 {
189 191 x86_reg tmp;
190 192 __asm__ volatile(
191   - "movl %a6(%2), %k1 \n\t"
192   - "movl %a3(%2), %%eax \n\t"
  193 + "movl %c6(%2), %k1 \n\t"
  194 + "movl %c3(%2), %%eax \n\t"
193 195 "shl $17, %k1 \n\t"
194 196 "add %%eax, %%eax \n\t"
195 197 "sub %k1, %%eax \n\t"
@@ -200,16 +202,16 @@ static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)
200 202 "sub %%edx, %%ecx \n\t"
201 203 "test %%ax, %%ax \n\t"
202 204 "jnz 1f \n\t"
203   - "mov %a4(%2), %1 \n\t"
  205 + "mov %c4(%2), %1 \n\t"
204 206 "subl $0xFFFF, %%eax \n\t"
205 207 "movzwl (%1), %%edx \n\t"
206 208 "bswap %%edx \n\t"
207 209 "shrl $15, %%edx \n\t"
208 210 "add $2, %1 \n\t"
209 211 "addl %%edx, %%eax \n\t"
210   - "mov %1, %a4(%2) \n\t"
  212 + "mov %1, %c4(%2) \n\t"
211 213 "1: \n\t"
212   - "movl %%eax, %a3(%2) \n\t"
  214 + "movl %%eax, %c3(%2) \n\t"
213 215
214 216 : "+c"(val), "=&r"(tmp)
215 217 : "r"(c),
37 libavcodec/x86/h264_i386.h
@@ -63,7 +63,11 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
63 63
64 64 BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
65 65 "%5", "%q5", "%k0", "%b0",
66   - "%a11(%6)", "%a12(%6)", "%a13", "%a14", "%a15", "%16")
  66 + "%c11(%6)", "%c12(%6)",
  67 + AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
  68 + AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
  69 + AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
  70 + "%13")
67 71
68 72 "test $1, %4 \n\t"
69 73 " jz 4f \n\t"
@@ -71,7 +75,11 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
71 75
72 76 BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
73 77 "%5", "%q5", "%k0", "%b0",
74   - "%a11(%6)", "%a12(%6)", "%a13", "%a14", "%a15", "%16")
  78 + "%c11(%6)", "%c12(%6)",
  79 + AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
  80 + AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
  81 + AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
  82 + "%13")
75 83
76 84 "sub %10, %1 \n\t"
77 85 "mov %2, %0 \n\t"
@@ -99,10 +107,8 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
99 107 "+&r"(c->low), "=&r"(bit), "+&r"(c->range)
100 108 : "r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
101 109 "i"(offsetof(CABACContext, bytestream)),
102   - "i"(offsetof(CABACContext, bytestream_end)),
103   - "i"(H264_NORM_SHIFT_OFFSET),
104   - "i"(H264_LPS_RANGE_OFFSET),
105   - "i"(H264_MLPS_STATE_OFFSET) TABLES_ARG
  110 + "i"(offsetof(CABACContext, bytestream_end))
  111 + TABLES_ARG
106 112 : "%"REG_c, "memory"
107 113 );
108 114 return coeff_count;
@@ -137,22 +143,30 @@ static int decode_significance_8x8_x86(CABACContext *c,
137 143
138 144 BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3",
139 145 "%5", "%q5", "%k0", "%b0",
140   - "%a12(%7)", "%a13(%7)", "%a14", "%a15", "%a16", "%18")
  146 + "%c12(%7)", "%c13(%7)",
  147 + AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
  148 + AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
  149 + AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
  150 + "%15")
141 151
142 152 "mov %1, %k6 \n\t"
143 153 "test $1, %4 \n\t"
144 154 " jz 4f \n\t"
145 155
146 156 #ifdef BROKEN_RELOCATIONS
147   - "movzbl %a17(%18, %q6), %k6\n\t"
  157 + "movzbl %c14(%15, %q6), %k6\n\t"
148 158 #else
149   - "movzbl "MANGLE(ff_h264_cabac_tables)"+%a17(%k6), %k6\n\t"
  159 + "movzbl "MANGLE(ff_h264_cabac_tables)"+%c14(%k6), %k6\n\t"
150 160 #endif
151 161 "add %11, %6 \n\t"
152 162
153 163 BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3",
154 164 "%5", "%q5", "%k0", "%b0",
155   - "%a12(%7)", "%a13(%7)", "%a14", "%a15", "%a16", "%18")
  165 + "%c12(%7)", "%c13(%7)",
  166 + AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
  167 + AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
  168 + AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
  169 + "%15")
156 170
157 171 "mov %2, %0 \n\t"
158 172 "mov %1, %k6 \n\t"
@@ -179,9 +193,6 @@ static int decode_significance_8x8_x86(CABACContext *c,
179 193 "m"(sig_off), "m"(last_coeff_ctx_base),
180 194 "i"(offsetof(CABACContext, bytestream)),
181 195 "i"(offsetof(CABACContext, bytestream_end)),
182   - "i"(H264_NORM_SHIFT_OFFSET),
183   - "i"(H264_LPS_RANGE_OFFSET),
184   - "i"(H264_MLPS_STATE_OFFSET),
185 196 "i"(H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET) TABLES_ARG
186 197 : "%"REG_c, "memory"
187 198 );
30 libavcodec/x86/mlpdsp.c
@@ -25,21 +25,21 @@
25 25
26 26 #if HAVE_7REGS
27 27
28   -extern void ff_mlp_firorder_8;
29   -extern void ff_mlp_firorder_7;
30   -extern void ff_mlp_firorder_6;
31   -extern void ff_mlp_firorder_5;
32   -extern void ff_mlp_firorder_4;
33   -extern void ff_mlp_firorder_3;
34   -extern void ff_mlp_firorder_2;
35   -extern void ff_mlp_firorder_1;
36   -extern void ff_mlp_firorder_0;
37   -
38   -extern void ff_mlp_iirorder_4;
39   -extern void ff_mlp_iirorder_3;
40   -extern void ff_mlp_iirorder_2;
41   -extern void ff_mlp_iirorder_1;
42   -extern void ff_mlp_iirorder_0;
  28 +extern char ff_mlp_firorder_8;
  29 +extern char ff_mlp_firorder_7;
  30 +extern char ff_mlp_firorder_6;
  31 +extern char ff_mlp_firorder_5;
  32 +extern char ff_mlp_firorder_4;
  33 +extern char ff_mlp_firorder_3;
  34 +extern char ff_mlp_firorder_2;
  35 +extern char ff_mlp_firorder_1;
  36 +extern char ff_mlp_firorder_0;
  37 +
  38 +extern char ff_mlp_iirorder_4;
  39 +extern char ff_mlp_iirorder_3;
  40 +extern char ff_mlp_iirorder_2;
  41 +extern char ff_mlp_iirorder_1;
  42 +extern char ff_mlp_iirorder_0;
43 43
44 44 static const void *firtable[9] = { &ff_mlp_firorder_0, &ff_mlp_firorder_1,
45 45 &ff_mlp_firorder_2, &ff_mlp_firorder_3,
29 libavfilter/x86/yadif_template.c
@@ -107,8 +107,8 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
107 107 uint8_t *next, int w, int prefs,
108 108 int mrefs, int parity, int mode)
109 109 {
110   - uint8_t tmp[5*16];
111   - uint8_t *tmpA= (uint8_t*)(((uint64_t)(tmp+15)) & ~15);
  110 + uint8_t tmpU[5*16];
  111 + uint8_t *tmp= (uint8_t*)(((uint64_t)(tmpU+15)) & ~15);
112 112 int x;
113 113
114 114 #define FILTER\
@@ -122,9 +122,9 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
122 122 MOVQ" "MM"3, "MM"4 \n\t"\
123 123 "paddw "MM"2, "MM"3 \n\t"\
124 124 "psraw $1, "MM"3 \n\t" /* d = (prev2[x] + next2[x])>>1 */\
125   - MOVQ" "MM"0, (%[tmpA]) \n\t" /* c */\
126   - MOVQ" "MM"3, 16(%[tmpA]) \n\t" /* d */\
127   - MOVQ" "MM"1, 32(%[tmpA]) \n\t" /* e */\
  125 + MOVQ" "MM"0, (%[tmp]) \n\t" /* c */\
  126 + MOVQ" "MM"3, 16(%[tmp]) \n\t" /* d */\
  127 + MOVQ" "MM"1, 32(%[tmp]) \n\t" /* e */\
128 128 "psubw "MM"4, "MM"2 \n\t"\
129 129 PABS( MM"4", MM"2") /* temporal_diff0 */\
130 130 LOAD("(%[prev],%[mrefs])", MM"3") /* prev[x-refs] */\
@@ -146,7 +146,7 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
146 146 "paddw "MM"4, "MM"3 \n\t" /* temporal_diff2 */\
147 147 "psrlw $1, "MM"3 \n\t"\
148 148 "pmaxsw "MM"3, "MM"2 \n\t"\
149   - MOVQ" "MM"2, 48(%[tmpA]) \n\t" /* diff */\
  149 + MOVQ" "MM"2, 48(%[tmp]) \n\t" /* diff */\
150 150 \
151 151 "paddw "MM"0, "MM"1 \n\t"\
152 152 "paddw "MM"0, "MM"0 \n\t"\
@@ -177,7 +177,7 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
177 177 CHECK2\
178 178 \
179 179 /* if(p->mode<2) ... */\
180   - MOVQ" 48(%[tmpA]), "MM"6 \n\t" /* diff */\
  180 + MOVQ" 48(%[tmp]), "MM"6 \n\t" /* diff */\
181 181 "cmpl $2, %[mode] \n\t"\
182 182 "jge 1f \n\t"\
183 183 LOAD("(%["prev2"],%[mrefs],2)", MM"2") /* prev2[x-2*refs] */\
@@ -188,9 +188,9 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
188 188 "paddw "MM"5, "MM"3 \n\t"\
189 189 "psrlw $1, "MM"2 \n\t" /* b */\
190 190 "psrlw $1, "MM"3 \n\t" /* f */\
191   - MOVQ" (%[tmpA]), "MM"4 \n\t" /* c */\
192   - MOVQ" 16(%[tmpA]), "MM"5 \n\t" /* d */\
193   - MOVQ" 32(%[tmpA]), "MM"7 \n\t" /* e */\
  191 + MOVQ" (%[tmp]), "MM"4 \n\t" /* c */\
  192 + MOVQ" 16(%[tmp]), "MM"5 \n\t" /* d */\
  193 + MOVQ" 32(%[tmp]), "MM"7 \n\t" /* e */\
194 194 "psubw "MM"4, "MM"2 \n\t" /* b-c */\
195 195 "psubw "MM"7, "MM"3 \n\t" /* f-e */\
196 196 MOVQ" "MM"5, "MM"0 \n\t"\
@@ -209,7 +209,7 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
209 209 "pmaxsw "MM"4, "MM"6 \n\t" /* diff= MAX3(diff, min, -max); */\
210 210 "1: \n\t"\
211 211 \
212   - MOVQ" 16(%[tmpA]), "MM"2 \n\t" /* d */\
  212 + MOVQ" 16(%[tmp]), "MM"2 \n\t" /* d */\
213 213 MOVQ" "MM"2, "MM"3 \n\t"\
214 214 "psubw "MM"6, "MM"2 \n\t" /* d-diff */\
215 215 "paddw "MM"6, "MM"3 \n\t" /* d+diff */\
@@ -217,14 +217,13 @@ static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
217 217 "pminsw "MM"3, "MM"1 \n\t" /* d = clip(spatial_pred, d-diff, d+diff); */\
218 218 "packuswb "MM"1, "MM"1 \n\t"\
219 219 \
220   - :\
221   - :[tmpA] "r"(tmpA),\
222   - [prev] "r"(prev),\
  220 + ::[prev] "r"(prev),\
223 221 [cur] "r"(cur),\
224 222 [next] "r"(next),\
225 223 [prefs]"r"((x86_reg)prefs),\
226 224 [mrefs]"r"((x86_reg)mrefs),\
227   - [mode] "g"(mode)\
  225 + [mode] "g"(mode),\
  226 + [tmp] "r"(tmp)\
228 227 );\
229 228 __asm__ volatile(MOV" "MM"1, %0" :"=m"(*dst));\
230 229 dst += STEP;\
3  libavformat/rtmpproto.c
@@ -1200,6 +1200,9 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
1200 1200 #endif
1201 1201
1202 1202 switch (pkt->type) {
  1203 + case RTMP_PT_BYTES_READ:
  1204 + av_dlog(s, "received bytes read report\n");
  1205 + break;
1203 1206 case RTMP_PT_CHUNK_SIZE:
1204 1207 if ((ret = handle_chunk_size(s, pkt)) < 0)
1205 1208 return ret;
10 libavutil/arm/intmath.h
@@ -44,7 +44,7 @@ static av_always_inline av_const int FASTDIV(int a, int b)
44 44 }
45 45
46 46 #define av_clip_uint8 av_clip_uint8_arm
47   -static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
  47 +static av_always_inline av_const unsigned av_clip_uint8_arm(int a)
48 48 {
49 49 unsigned x;
50 50 __asm__ ("usat %0, #8, %1" : "=r"(x) : "r"(a));
@@ -52,15 +52,15 @@ static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
52 52 }
53 53
54 54 #define av_clip_int8 av_clip_int8_arm
55   -static av_always_inline av_const uint8_t av_clip_int8_arm(int a)
  55 +static av_always_inline av_const int av_clip_int8_arm(int a)
56 56 {
57   - unsigned x;
  57 + int x;
58 58 __asm__ ("ssat %0, #8, %1" : "=r"(x) : "r"(a));
59 59 return x;
60 60 }
61 61
62 62 #define av_clip_uint16 av_clip_uint16_arm
63   -static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
  63 +static av_always_inline av_const unsigned av_clip_uint16_arm(int a)
64 64 {
65 65 unsigned x;
66 66 __asm__ ("usat %0, #16, %1" : "=r"(x) : "r"(a));
@@ -68,7 +68,7 @@ static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
68 68 }
69 69
70 70 #define av_clip_int16 av_clip_int16_arm
71   -static av_always_inline av_const int16_t av_clip_int16_arm(int a)
  71 +static av_always_inline av_const int av_clip_int16_arm(int a)
72 72 {
73 73 int x;
74 74 __asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
368 libswscale/x86/rgb2rgb_template.c
@@ -73,25 +73,24 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int sr
73 73 __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory");
74 74 while (s < mm_end) {
75 75 __asm__ volatile(
76   - PREFETCH" 32%1 \n\t"
77   - "movd %1, %%mm0 \n\t"
78   - "punpckldq 3%1, %%mm0 \n\t"
79   - "movd 6%1, %%mm1 \n\t"
80   - "punpckldq 9%1, %%mm1 \n\t"
81   - "movd 12%1, %%mm2 \n\t"
82   - "punpckldq 15%1, %%mm2 \n\t"
83   - "movd 18%1, %%mm3 \n\t"
84   - "punpckldq 21%1, %%mm3 \n\t"
  76 + PREFETCH" 32(%1) \n\t"
  77 + "movd (%1), %%mm0 \n\t"
  78 + "punpckldq 3(%1), %%mm0 \n\t"
  79 + "movd 6(%1), %%mm1 \n\t"
  80 + "punpckldq 9(%1), %%mm1 \n\t"
  81 + "movd 12(%1), %%mm2 \n\t"
  82 + "punpckldq 15(%1), %%mm2 \n\t"
  83 + "movd 18(%1), %%mm3 \n\t"
  84 + "punpckldq 21(%1), %%mm3 \n\t"
85 85 "por %%mm7, %%mm0 \n\t"
86 86 "por %%mm7, %%mm1 \n\t"
87 87 "por %%mm7, %%mm2 \n\t"
88 88 "por %%mm7, %%mm3 \n\t"
89   - MOVNTQ" %%mm0, %0 \n\t"
90   - MOVNTQ" %%mm1, 8%0 \n\t"
91   - MOVNTQ" %%mm2, 16%0 \n\t"
92   - MOVNTQ" %%mm3, 24%0"
93   - :"=m"(*dest)
94   - :"m"(*s)
  89 + MOVNTQ" %%mm0, (%0) \n\t"
  90 + MOVNTQ" %%mm1, 8(%0) \n\t"
  91 + MOVNTQ" %%mm2, 16(%0) \n\t"
  92 + MOVNTQ" %%mm3, 24(%0)"
  93 + :: "r"(dest), "r"(s)
95 94 :"memory");
96 95 dest += 32;
97 96 s += 24;
@@ -138,9 +137,9 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int sr
138 137 "pand "MANGLE(mask24hhhh)", %%mm5\n\t" \
139 138 "por %%mm5, %%mm4 \n\t" \
140 139 \
141   - MOVNTQ" %%mm0, %0 \n\t" \
142   - MOVNTQ" %%mm1, 8%0 \n\t" \
143   - MOVNTQ" %%mm4, 16%0"
  140 + MOVNTQ" %%mm0, (%0) \n\t" \
  141 + MOVNTQ" %%mm1, 8(%0) \n\t" \
  142 + MOVNTQ" %%mm4, 16(%0)"
144 143
145 144
146 145 static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
@@ -154,18 +153,17 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int sr
154 153 mm_end = end - 31;
155 154 while (s < mm_end) {
156 155 __asm__ volatile(
157   - PREFETCH" 32%1 \n\t"
158   - "movq %1, %%mm0 \n\t"
159   - "movq 8%1, %%mm1 \n\t"
160   - "movq 16%1, %%mm4 \n\t"
161   - "movq 24%1, %%mm5 \n\t"
  156 + PREFETCH" 32(%1) \n\t"
  157 + "movq (%1), %%mm0 \n\t"
  158 + "movq 8(%1), %%mm1 \n\t"
  159 + "movq 16(%1), %%mm4 \n\t"
  160 + "movq 24(%1), %%mm5 \n\t"
162 161 "movq %%mm0, %%mm2 \n\t"
163 162 "movq %%mm1, %%mm3 \n\t"
164 163 "movq %%mm4, %%mm6 \n\t"
165 164 "movq %%mm5, %%mm7 \n\t"
166 165 STORE_BGR24_MMX
167   - :"=m"(*dest)
168   - :"m"(*s)
  166 + :: "r"(dest), "r"(s)
169 167 :"memory");
170 168 dest += 24;
171 169 s += 32;
@@ -198,19 +196,18 @@ static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, int src_s
198 196 mm_end = end - 15;
199 197 while (s<mm_end) {
200 198 __asm__ volatile(
201   - PREFETCH" 32%1 \n\t"
202   - "movq %1, %%mm0 \n\t"
203   - "movq 8%1, %%mm2 \n\t"
  199 + PREFETCH" 32(%1) \n\t"
  200 + "movq (%1), %%mm0 \n\t"
  201 + "movq 8(%1), %%mm2 \n\t"
204 202 "movq %%mm0, %%mm1 \n\t"
205 203 "movq %%mm2, %%mm3 \n\t"
206 204 "pand %%mm4, %%mm0 \n\t"
207 205 "pand %%mm4, %%mm2 \n\t"
208 206 "paddw %%mm1, %%mm0 \n\t"
209 207 "paddw %%mm3, %%mm2 \n\t"
210   - MOVNTQ" %%mm0, %0 \n\t"
211   - MOVNTQ" %%mm2, 8%0"
212   - :"=m"(*d)
213   - :"m"(*s)
  208 + MOVNTQ" %%mm0, (%0) \n\t"
  209 + MOVNTQ" %%mm2, 8(%0)"
  210 + :: "r"(d), "r"(s)
214 211 );
215 212 d+=16;
216 213 s+=16;
@@ -243,9 +240,9 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, int src_s
243 240 mm_end = end - 15;
244 241 while (s<mm_end) {
245 242 __asm__ volatile(
246   - PREFETCH" 32%1 \n\t"
247   - "movq %1, %%mm0 \n\t"
248   - "movq 8%1, %%mm2 \n\t"
  243 + PREFETCH" 32(%1) \n\t"
  244 + "movq (%1), %%mm0 \n\t"
  245 + "movq 8(%1), %%mm2 \n\t"
249 246 "movq %%mm0, %%mm1 \n\t"
250 247 "movq %%mm2, %%mm3 \n\t"
251 248 "psrlq $1, %%mm0 \n\t"
@@ -256,10 +253,9 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, int src_s
256 253 "pand %%mm6, %%mm3 \n\t"
257 254 "por %%mm1, %%mm0 \n\t"
258 255 "por %%mm3, %%mm2 \n\t"
259   - MOVNTQ" %%mm0, %0 \n\t"
260   - MOVNTQ" %%mm2, 8%0"
261   - :"=m"(*d)
262   - :"m"(*s)
  256 + MOVNTQ" %%mm0, (%0) \n\t"
  257 + MOVNTQ" %%mm2, 8(%0)"
  258 + :: "r"(d), "r"(s)
263 259 );
264 260 d+=16;
265 261 s+=16;
@@ -287,7 +283,6 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, int src_s
287 283 uint16_t *d = (uint16_t *)dst;
288 284 end = s + src_size;
289 285 mm_end = end - 15;
290   -#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
291 286 __asm__ volatile(
292 287 "movq %3, %%mm5 \n\t"
293 288 "movq %4, %%mm6 \n\t"
@@ -322,47 +317,6 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, int src_s
322 317 : "+r" (d), "+r"(s)
323 318 : "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216)
324 319 );
325   -#else
326   - __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
327   - __asm__ volatile(
328   - "movq %0, %%mm7 \n\t"
329   - "movq %1, %%mm6 \n\t"
330   - ::"m"(red_16mask),"m"(green_16mask));
331   - while (s < mm_end) {
332   - __asm__ volatile(
333   - PREFETCH" 32%1 \n\t"
334   - "movd %1, %%mm0 \n\t"
335   - "movd 4%1, %%mm3 \n\t"
336   - "punpckldq 8%1, %%mm0 \n\t"
337   - "punpckldq 12%1, %%mm3 \n\t"
338   - "movq %%mm0, %%mm1 \n\t"
339   - "movq %%mm0, %%mm2 \n\t"
340   - "movq %%mm3, %%mm4 \n\t"
341   - "movq %%mm3, %%mm5 \n\t"
342   - "psrlq $3, %%mm0 \n\t"
343   - "psrlq $3, %%mm3 \n\t"
344   - "pand %2, %%mm0 \n\t"
345   - "pand %2, %%mm3 \n\t"
346   - "psrlq $5, %%mm1 \n\t"
347   - "psrlq $5, %%mm4 \n\t"
348   - "pand %%mm6, %%mm1 \n\t"
349   - "pand %%mm6, %%mm4 \n\t"
350   - "psrlq $8, %%mm2 \n\t"
351   - "psrlq $8, %%mm5 \n\t"
352   - "pand %%mm7, %%mm2 \n\t"
353   - "pand %%mm7, %%mm5 \n\t"
354   - "por %%mm1, %%mm0 \n\t"
355   - "por %%mm4, %%mm3 \n\t"
356   - "por %%mm2, %%mm0 \n\t"
357   - "por %%mm5, %%mm3 \n\t"
358   - "psllq $16, %%mm3 \n\t"
359   - "por %%mm3, %%mm0 \n\t"
360   - MOVNTQ" %%mm0, %0 \n\t"
361   - :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
362   - d += 4;
363   - s += 16;
364   - }
365   -#endif
366 320 __asm__ volatile(SFENCE:::"memory");
367 321 __asm__ volatile(EMMS:::"memory");
368 322 while (s < end) {
@@ -386,11 +340,11 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int sr
386 340 mm_end = end - 15;
387 341 while (s < mm_end) {
388 342 __asm__ volatile(
389   - PREFETCH" 32%1 \n\t"
390   - "movd %1, %%mm0 \n\t"
391   - "movd 4%1, %%mm3 \n\t"
392   - "punpckldq 8%1, %%mm0 \n\t"
393   - "punpckldq 12%1, %%mm3 \n\t"
  343 + PREFETCH" 32(%1) \n\t"
  344 + "movd (%1), %%mm0 \n\t"