History

Merge remote-tracking branch 'qatar/master'

* qatar/master: pixdesc: mark pseudopaletted formats with a special flag. avconv: switch to avcodec_encode_video2(). libx264: implement encode2(). libx264: split extradata writing out of encode_nals(). lavc: add avcodec_encode_video2() that encodes from an AVFrame -> AVPacket cmdutils: update copyright year to 2012. swscale: sign-extend integer function argument to qword on x86-64. x86inc: support yasm -f win64 flag also. h264: manually save/restore XMM registers for functions using INIT_MMX. x86inc: allow manual use of WIN64_SPILL_XMM. aacdec: Use correct speaker order for 7.1. aacdec: Remove incorrect comment. aacdec: Simplify output configuration. Remove Sun medialib glue code. dsputil: set STRIDE_ALIGN to 16 for x86 also. pngdsp: swap argument inversion. Conflicts: cmdutils.c configure doc/APIchanges ffmpeg.c libavcodec/aacdec.c libavcodec/dsputil.h libavcodec/libx264.c libavcodec/mlib/dsputil_mlib.c libavcodec/utils.c libavfilter/vf_scale.c libavutil/avutil.h libswscale/mlib/yuv2rgb_mlib.c

Michael Niedermayer committed 14 years ago

Commit f2b20b72 parents d871022 38d553334 files · +271 −741Browse files

Unified · Split

34 files
  1. configure +0 −4
  2. doc/APIchanges +6 −0
  3. ffmpeg.c +23 −41
  4. libavcodec/Makefile +1 −3
  5. libavcodec/aacdec.c +16 −19
  6. libavcodec/aacdectab.h +2 −2
  7. libavcodec/avcodec.h +39 −2
  8. libavcodec/dsputil.c +0 −1
  9. libavcodec/dsputil.h +2 −19
  10. libavcodec/imgconvert.c +1 −7
  11. libavcodec/libx264.c +43 −37
  12. libavcodec/mlib/dsputil_mlib.c +0 −469
  13. libavcodec/mpegvideo.c +0 −2
  14. libavcodec/mpegvideo.h +0 −1
  15. libavcodec/options.c +0 −2
  16. libavcodec/rawdec.c +1 −2
  17. libavcodec/utils.c +92 −20
  18. libavcodec/version.h +3 −0
  19. libavcodec/x86/h264_idct.asm +3 −0
  20. libavcodec/x86/h264_intrapred.asm +3 −0
  21. libavfilter/vf_crop.c +2 −1
  22. libavfilter/vf_pixdesctest.c +2 −1
  23. libavfilter/vf_scale.c +2 −1
  24. libavutil/audioconvert.h +1 −0
  25. libavutil/avutil.h +1 −1
  26. libavutil/imgutils.c +6 −3
  27. libavutil/pixdesc.c +4 −4
  28. libavutil/pixdesc.h +6 −0
  29. libavutil/x86/x86inc.asm +7 −4
  30. libswscale/Makefile +1 −2
  31. libswscale/mlib/yuv2rgb_mlib.c +0 −89
  32. libswscale/swscale_internal.h +3 −2
  33. libswscale/x86/output.asm +1 −0
  34. libswscale/yuv2rgb.c +0 −2
configure+0−4
@@ -205,7 +205,6 @@ External library support: · 204 unmodified lines
205205 --enable-libxvid enable Xvid encoding via xvidcore,
206206 native MPEG-4/Xvid encoder exists [no]
207207 --enable-openal enable OpenAL 1.1 capture support [no]
208− --enable-mlib enable Sun medialib [no]
209208 --enable-openssl enable openssl [no]
210209 --enable-zlib enable zlib [autodetect]
211210
@@ -1062,7 +1061,6 @@ CONFIG_LIST=" · 850 unmodified lines
10621061 lsp
10631062 mdct
10641063 memalign_hack
1065− mlib
10661064 mpegaudiodsp
10671065 network
10681066 nonfree
@@ -3179,7 +3177,6 @@ enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32 · 2110 unmodified lines
31793177 die "ERROR: openal not found"; } &&
31803178 { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
31813179 die "ERROR: openal version must be 1.1 or compatible"; }
3182−enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
31833180 enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
31843181 check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
31853182 check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
@@ -3478,7 +3475,6 @@ echo "network support ${network-no}" · 292 unmodified lines
34783475 echo "threading support ${thread_type-no}"
34793476 echo "safe bitstream reader ${safe_bitstream_reader-no}"
34803477 echo "SDL support ${sdl-no}"
3481−echo "Sun medialib support ${mlib-no}"
34823478 echo "libdxva2 enabled ${dxva2-no}"
34833479 echo "libva enabled ${vaapi-no}"
34843480 echo "libvdpau enabled ${vdpau-no}"
doc/APIchanges+6−0
@@ -25,6 +25,12 @@ API changes, most recent first: · 24 unmodified lines
2525 2012-01-24 - xxxxxxx - lavfi 2.60.100
2626 Add avfilter_graph_dump.
2727
28+2012-02-xx - xxxxxxx - lavu 51.22.1 - pixdesc.h
29+ Add PIX_FMT_PSEUDOPAL flag.
30+
31+2012-02-01 - xxxxxxx - lavc 54.01.0
32+ Add avcodec_encode_video2() and deprecate avcodec_encode_video().
33+
2834 2012-02-01 - 316fc74 - lavc 54.01.0
2935 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned
3036 memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE
ffmpeg.c+23−41
@@ -1385,9 +1385,6 @@ static void do_subtitle_out(AVFormatContext *s, · 1384 unmodified lines
13851385 }
13861386 }
13871387
1388−static int bit_buffer_size = 1024 * 256;
1389−static uint8_t *bit_buffer = NULL;
1390−
13911388 static void do_video_resample(OutputStream *ost,
13921389 InputStream *ist,
13931390 AVFrame *in_picture,
@@ -1513,6 +1510,8 @@ static void do_video_out(AVFormatContext *s, · 119 unmodified lines
15131510 for (i = 0; i < nb_frames; i++) {
15141511 AVPacket pkt;
15151512 av_init_packet(&pkt);
1513+ pkt.data = NULL;
1514+ pkt.size = 0;
15161515
15171516 if (s->oformat->flags & AVFMT_RAWPICTURE &&
15181517 enc->codec->id == CODEC_ID_RAWVIDEO) {
@@ -1528,6 +1527,7 @@ static void do_video_out(AVFormatContext *s, · 9 unmodified lines
15281527
15291528 write_frame(s, &pkt, ost);
15301529 } else {
1530+ int got_packet;
15311531 AVFrame big_picture;
15321532
15331533 big_picture = *final_picture;
@@ -1552,29 +1552,27 @@ static void do_video_out(AVFormatContext *s, · 18 unmodified lines
15521552 big_picture.pict_type = AV_PICTURE_TYPE_I;
15531553 ost->forced_kf_index++;
15541554 }
1555− ret = avcodec_encode_video(enc,
1556− bit_buffer, bit_buffer_size,
1557− &big_picture);
1555+ ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet);
15581556 if (ret < 0) {
15591557 av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
15601558 exit_program(1);
15611559 }
15621560
1563− if (ret > 0) {
1564− pkt.data = bit_buffer;
1565− pkt.size = ret;
1566− if (!(enc->codec->capabilities & CODEC_CAP_DELAY))
1567− pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
1568− if (enc->coded_frame->pts != AV_NOPTS_VALUE)
1569− pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
1561+ if (got_packet) {
1562+ if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY))
1563+ pkt.pts = ost->sync_opts;
1564+
1565+ if (pkt.pts != AV_NOPTS_VALUE)
1566+ pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
1567+ if (pkt.dts != AV_NOPTS_VALUE)
1568+ pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
15701569
1571− if (enc->coded_frame->key_frame)
1572− pkt.flags |= AV_PKT_FLAG_KEY;
15731570 if (format_video_sync == VSYNC_DROP)
15741571 pkt.pts = pkt.dts = AV_NOPTS_VALUE;
1572+
15751573 write_frame(s, &pkt, ost);
1576− *frame_size = ret;
1577− video_size += ret;
1574+ *frame_size = pkt.size;
1575+ video_size += pkt.size;
15781576
15791577 /* if two pass, output log */
15801578 if (ost->logfile && enc->stats_out) {
@@ -1789,7 +1787,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) · 208 unmodified lines
17891787
17901788 for (;;) {
17911789 AVPacket pkt;
1792− int fifo_bytes;
1790+ int fifo_bytes, got_packet;
17931791 av_init_packet(&pkt);
17941792 pkt.data = NULL;
17951793 pkt.size = 0;
@@ -1822,25 +1820,23 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) · 26 unmodified lines
18221820 }
18231821 break;
18241822 case AVMEDIA_TYPE_VIDEO:
1825− ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
1823+ ret = avcodec_encode_video2(enc, &pkt, NULL, &got_packet);
18261824 if (ret < 0) {
18271825 av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
18281826 exit_program(1);
18291827 }
1830− video_size += ret;
1831− if (enc->coded_frame && enc->coded_frame->key_frame)
1832− pkt.flags |= AV_PKT_FLAG_KEY;
1828+ video_size += pkt.size;
18331829 if (ost->logfile && enc->stats_out) {
18341830 fprintf(ost->logfile, "%s", enc->stats_out);
18351831 }
1836− if (ret <= 0) {
1832+ if (!got_packet) {
18371833 stop_encoding = 1;
18381834 break;
18391835 }
1840− pkt.data = bit_buffer;
1841− pkt.size = ret;
1842− if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
1843− pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
1836+ if (pkt.pts != AV_NOPTS_VALUE)
1837+ pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
1838+ if (pkt.dts != AV_NOPTS_VALUE)
1839+ pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
18441840 write_frame(os, &pkt, ost);
18451841 break;
18461842 default:
@@ -2668,19 +2664,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, · 821 unmodified lines
26682664 }
26692665 }
26702666 }
2671− if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
2672− /* maximum video buffer size is 8-bytes per pixel, plus DPX header size (1664)*/
2673− int size = codec->width * codec->height;
2674− bit_buffer_size = FFMAX(bit_buffer_size, 9*size + 10000);
2675− }
2676− }
2677−
2678− if (!bit_buffer)
2679− bit_buffer = av_malloc(bit_buffer_size);
2680− if (!bit_buffer) {
2681− av_log(NULL, AV_LOG_ERROR, "Cannot allocate %d bytes output buffer\n",
2682− bit_buffer_size);
2683− return AVERROR(ENOMEM);
26842667 }
26852668
26862669 /* open each encoder */
@@ -3118,7 +3101,6 @@ static int transcode(OutputFile *output_files, int nb_output_files, · 431 unmodified lines
31183101 ret = 0;
31193102
31203103 fail:
3121− av_freep(&bit_buffer);
31223104 av_freep(&no_packet);
31233105
31243106 if (output_streams) {
libavcodec/Makefile+1−3
@@ -718,8 +718,6 @@ OBJS-$(HAVE_PTHREADS) += pthread.o · 717 unmodified lines
718718 OBJS-$(HAVE_W32THREADS) += pthread.o
719719 OBJS-$(HAVE_OS2THREADS) += pthread.o
720720
721−OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \
722−
723721 # inverse.o contains the ff_inverse table definition, which is used by
724722 # the FASTDIV macro (from libavutil); since referencing the external
725723 # table has a negative effect on performance, copy it in libavcodec as
@@ -749,7 +747,7 @@ HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ · 23 unmodified lines
749747 dv_tablegen motionpixels_tablegen mpegaudio_tablegen \
750748 pcm_tablegen qdm2_tablegen sinewin_tablegen
751749
752−DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
750+DIRS = alpha arm bfin ppc ps2 sh4 sparc x86
753751
754752 CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
755753
libavcodec/aacdec.c+16−19
@@ -189,10 +189,10 @@ static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID]) · 188 unmodified lines
189189 * @return Returns error status. 0 - OK, !0 - error
190190 */
191191 static av_cold int che_configure(AACContext *ac,
192− enum ChannelPosition che_pos[4][MAX_ELEM_ID],
192+ enum ChannelPosition che_pos,
193193 int type, int id, int *channels)
194194 {
195− if (che_pos[type][id]) {
195+ if (che_pos) {
196196 if (!ac->che[type][id]) {
197197 if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
198198 return AVERROR(ENOMEM);
@@ -222,22 +222,21 @@ static av_cold int che_configure(AACContext *ac, · 23 unmodified lines
222222 * @return Returns error status. 0 - OK, !0 - error
223223 */
224224 static av_cold int output_configure(AACContext *ac,
225− enum ChannelPosition che_pos[4][MAX_ELEM_ID],
226225 enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
227226 int channel_config, enum OCStatus oc_type)
228227 {
229228 AVCodecContext *avctx = ac->avctx;
230229 int i, type, channels = 0, ret;
231230
232− if (new_che_pos != che_pos)
233− memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
231+ if (new_che_pos)
232+ memcpy(ac->che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
234233
235234 if (channel_config) {
236235 for (i = 0; i < tags_per_config[channel_config]; i++) {
237− if ((ret = che_configure(ac, che_pos,
238− aac_channel_layout_map[channel_config - 1][i][0],
239− aac_channel_layout_map[channel_config - 1][i][1],
240− &channels)))
236+ int id = aac_channel_layout_map[channel_config - 1][i][1];
237+ type = aac_channel_layout_map[channel_config - 1][i][0];
238+ if ((ret = che_configure(ac, ac->che_pos[type][id],
239+ type, id, &channels)))
241240 return ret;
242241 }
243242
@@ -249,14 +248,12 @@ static av_cold int output_configure(AACContext *ac, · 5 unmodified lines
249248 * current program configuration.
250249 *
251250 * Set up default 1:1 output mapping.
252− *
253− * For a 5.1 stream the output order will be:
254− * [ Center ] [ Front Left ] [ Front Right ] [ LFE ] [ Surround Left ] [ Surround Right ]
255251 */
256252
257253 for (i = 0; i < MAX_ELEM_ID; i++) {
258254 for (type = 0; type < 4; type++) {
259− if ((ret = che_configure(ac, che_pos, type, i, &channels)))
255+ if ((ret = che_configure(ac, ac->che_pos[type][i],
256+ type, i, &channels)))
260257 return ret;
261258 }
262259 }
@@ -456,7 +453,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, · 193 unmodified lines
456453 } else if (m4ac->sbr == 1 && m4ac->ps == -1)
457454 m4ac->ps = 1;
458455
459− if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR)))
456+ if (ac && (ret = output_configure(ac, new_che_pos, channel_config, OC_GLOBAL_HDR)))
460457 return ret;
461458
462459 if (extension_flag) {
@@ -629,7 +626,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) · 166 unmodified lines
629626 if (ac->m4ac.chan_config) {
630627 int ret = set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config);
631628 if (!ret)
632− output_configure(ac, ac->che_pos, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR);
629+ output_configure(ac, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR);
633630 else if (avctx->err_recognition & AV_EF_EXPLODE)
634631 return AVERROR_INVALIDDATA;
635632 }
@@ -1733,7 +1730,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, · 1097 unmodified lines
17331730 } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) {
17341731 ac->m4ac.sbr = 1;
17351732 ac->m4ac.ps = 1;
1736− output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured);
1733+ output_configure(ac, NULL, ac->m4ac.chan_config, ac->output_configured);
17371734 } else {
17381735 ac->m4ac.sbr = 1;
17391736 }
@@ -2116,7 +2113,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) · 376 unmodified lines
21162113 ac->m4ac.chan_config = hdr_info.chan_config;
21172114 if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config))
21182115 return -7;
2119− if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config,
2116+ if (output_configure(ac, new_che_pos, hdr_info.chan_config,
21202117 FFMAX(ac->output_configured, OC_TRIAL_FRAME)))
21212118 return -7;
21222119 } else if (ac->output_configured != OC_LOCKED) {
@@ -2176,7 +2173,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, · 53 unmodified lines
21762173
21772174 if (set_default_channel_config(ac->avctx, new_che_pos, 2)<0)
21782175 return -1;
2179− if (output_configure(ac, ac->che_pos, new_che_pos, 2, OC_TRIAL_FRAME)<0)
2176+ if (output_configure(ac, new_che_pos, 2, OC_TRIAL_FRAME)<0)
21802177 return -1;
21812178 }
21822179 if (!(che=get_che(ac, elem_type, elem_id))) {
@@ -2220,7 +2217,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, · 37 unmodified lines
22202217 if (ac->output_configured > OC_TRIAL_PCE)
22212218 av_log(avctx, AV_LOG_INFO,
22222219 "Evaluating a further program_config_element.\n");
2223− err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE);
2220+ err = output_configure(ac, new_che_pos, 0, OC_TRIAL_PCE);
22242221 if (!err)
22252222 ac->m4ac.chan_config = 0;
22262223 break;
libavcodec/aacdectab.h+2−2
@@ -87,7 +87,7 @@ static const uint8_t aac_channel_layout_map[7][5][2] = { · 86 unmodified lines
8787 { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, },
8888 { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, },
8989 { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 1 }, },
90− { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 1 }, },
90+ { { TYPE_CPE, 1 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 0 }, },
9191 };
9292
9393 static const uint64_t aac_channel_layout[8] = {
@@ -97,7 +97,7 @@ static const uint64_t aac_channel_layout[8] = { · 3 unmodified lines
9797 AV_CH_LAYOUT_4POINT0,
9898 AV_CH_LAYOUT_5POINT0_BACK,
9999 AV_CH_LAYOUT_5POINT1_BACK,
100− AV_CH_LAYOUT_7POINT1_WIDE,
100+ AV_CH_LAYOUT_7POINT1_WIDE_BACK,
101101 0,
102102 };
103103
libavcodec/avcodec.h+39−2
@@ -1735,7 +1735,6 @@ typedef struct AVCodecContext { · 1734 unmodified lines
17351735 #define FF_DCT_FASTINT 1
17361736 #define FF_DCT_INT 2
17371737 #define FF_DCT_MMX 3
1738−#define FF_DCT_MLIB 4
17391738 #define FF_DCT_ALTIVEC 5
17401739 #define FF_DCT_FAAN 6
17411740
@@ -1786,7 +1785,6 @@ typedef struct AVCodecContext { · 44 unmodified lines
17861785 #define FF_IDCT_SIMPLEMMX 3
17871786 #define FF_IDCT_LIBMPEG2MMX 4
17881787 #define FF_IDCT_PS2 5
1789−#define FF_IDCT_MLIB 6
17901788 #define FF_IDCT_ARM 7
17911789 #define FF_IDCT_ALTIVEC 8
17921790 #define FF_IDCT_SH4 9
@@ -3960,7 +3958,10 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, · 2167 unmodified lines
39603958 enum AVSampleFormat sample_fmt, const uint8_t *buf,
39613959 int buf_size, int align);
39623960
3961+#if FF_API_OLD_ENCODE_VIDEO
39633962 /**
3963+ * @deprecated use avcodec_encode_video2() instead.
3964+ *
39643965 * Encode a video frame from pict into buf.
39653966 * The input picture should be
39663967 * stored using a specific format, namely avctx.pix_fmt.
@@ -3972,8 +3973,44 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, · 5 unmodified lines
39723973 * @return On error a negative value is returned, on success zero or the number
39733974 * of bytes used from the output buffer.
39743975 */
3976+attribute_deprecated
39753977 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
39763978 const AVFrame *pict);
3979+#endif
3980+
3981+/**
3982+ * Encode a frame of video.
3983+ *
3984+ * Takes input raw video data from frame and writes the next output packet, if
3985+ * available, to avpkt. The output packet does not necessarily contain data for
3986+ * the most recent frame, as encoders can delay and reorder input frames
3987+ * internally as needed.
3988+ *
3989+ * @param avctx codec context
3990+ * @param avpkt output AVPacket.
3991+ * The user can supply an output buffer by setting
3992+ * avpkt->data and avpkt->size prior to calling the
3993+ * function, but if the size of the user-provided data is not
3994+ * large enough, encoding will fail. All other AVPacket fields
3995+ * will be reset by the encoder using av_init_packet(). If
3996+ * avpkt->data is NULL, the encoder will allocate it.
3997+ * The encoder will set avpkt->size to the size of the
3998+ * output packet. The returned data (if any) belongs to the
3999+ * caller, he is responsible for freeing it.
4000+ * @param[in] frame AVFrame containing the raw video data to be encoded.
4001+ * May be NULL when flushing an encoder that has the
4002+ * CODEC_CAP_DELAY capability set.
4003+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
4004+ * output packet is non-empty, and to 0 if it is
4005+ * empty. If the function returns an error, the
4006+ * packet can be assumed to be invalid, and the
4007+ * value of got_packet_ptr is undefined and should
4008+ * not be used.
4009+ * @return 0 on success, negative error code on failure
4010+ */
4011+int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
4012+ const AVFrame *frame, int *got_packet_ptr);
4013+
39774014 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
39784015 const AVSubtitle *sub);
39794016
libavcodec/dsputil.c+0−1
@@ -3184,7 +3184,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) · 3183 unmodified lines
31843184
31853185 if (HAVE_MMX) dsputil_init_mmx (c, avctx);
31863186 if (ARCH_ARM) dsputil_init_arm (c, avctx);
3187− if (CONFIG_MLIB) dsputil_init_mlib (c, avctx);
31883187 if (HAVE_VIS) dsputil_init_vis (c, avctx);
31893188 if (ARCH_ALPHA) dsputil_init_alpha (c, avctx);
31903189 if (ARCH_PPC) dsputil_init_ppc (c, avctx);
libavcodec/dsputil.h+2−19
@@ -644,7 +644,6 @@ static inline int get_penalty_factor(int lambda, int lambda2, int type){ · 643 unmodified lines
644644 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
645645 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
646646 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
647−void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
648647 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
649648 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
650649 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
@@ -656,25 +655,9 @@ void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); · 5 unmodified lines
656655 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
657656 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
658657
659−
660−#if ARCH_ARM
661−
662−
663−#if HAVE_NEON
658+#if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMI || HAVE_MMX
664659 # define STRIDE_ALIGN 16
665−#endif
666−
667−#elif ARCH_PPC
668−
669−#define STRIDE_ALIGN 16
670−
671−#elif HAVE_MMI
672−
673−#define STRIDE_ALIGN 16
674−
675−#endif
676−
677−#ifndef STRIDE_ALIGN
660+#else
678661 # define STRIDE_ALIGN 8
679662 #endif
680663
libavcodec/imgconvert.c+1−7
@@ -361,15 +361,9 @@ int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height) · 360 unmodified lines
361361 AVPicture dummy_pict;
362362 if(av_image_check_size(width, height, 0, NULL))
363363 return -1;
364− switch (pix_fmt) {
365− case PIX_FMT_RGB8:
366− case PIX_FMT_BGR8:
367− case PIX_FMT_RGB4_BYTE:
368− case PIX_FMT_BGR4_BYTE:
369− case PIX_FMT_GRAY8:
364+ if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PSEUDOPAL)
370365 // do not include palette for these pseudo-paletted formats
371366 return width * height;
372− }
373367 return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
374368 }
375369
libavcodec/libx264.c+43−37
@@ -88,12 +88,23 @@ static void X264_log(void *p, int level, const char *fmt, va_list args) · 87 unmodified lines
8888 }
8989
9090
91−static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
92− x264_nal_t *nals, int nnal, int skip_sei)
91+static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
92+ x264_nal_t *nals, int nnal)
9393 {
9494 X264Context *x4 = ctx->priv_data;
95− uint8_t *p = buf;
96− int i;
95+ uint8_t *p;
96+ int i, size = x4->sei_size, ret;
97+
98+ if (!nnal)
99+ return 0;
100+
101+ for (i = 0; i < nnal; i++)
102+ size += nals[i].i_payload;
103+
104+ if ((ret = ff_alloc_packet(pkt, size)) < 0)
105+ return ret;
106+
107+ p = pkt->data;
97108
98109 /* Write the SEI as part of the first frame. */
99110 if (x4->sei_size > 0 && nnal > 0) {
@@ -108,23 +119,11 @@ static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size, · 8 unmodified lines
108119 }
109120
110121 for (i = 0; i < nnal; i++){
111− /* Don't put the SEI in extradata. */
112− if (skip_sei && nals[i].i_type == NAL_SEI) {
113− x4->sei_size = nals[i].i_payload;
114− x4->sei = av_malloc(x4->sei_size);
115− memcpy(x4->sei, nals[i].p_payload, nals[i].i_payload);
116− continue;
117− }
118− if (nals[i].i_payload > (size - (p - buf))) {
119− // return only complete nals which fit in buf
120− av_log(ctx, AV_LOG_ERROR, "Error: nal buffer is too small\n");
121− break;
122− }
123122 memcpy(p, nals[i].p_payload, nals[i].i_payload);
124123 p += nals[i].i_payload;
125124 }
126125
127− return p - buf;
126+ return 1;
128127 }
129128
130129 static int avfmt2_num_planes(int avfmt)
@@ -146,15 +145,13 @@ static int avfmt2_num_planes(int avfmt) · 15 unmodified lines
146145 }
147146 }
148147
149−static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
150− int orig_bufsize, void *data)
148+static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
149+ int *got_packet)
151150 {
152151 X264Context *x4 = ctx->priv_data;
153− AVFrame *frame = data;
154152 x264_nal_t *nal;
155− int nnal, i;
153+ int nnal, i, ret;
156154 x264_picture_t pic_out;
157− int bufsize;
158155
159156 x264_picture_init( &x4->pic );
160157 x4->pic.img.i_csp = x4->params.i_csp;
@@ -187,17 +184,16 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf, · 26 unmodified lines
187184 }
188185
189186 do {
190− bufsize = orig_bufsize;
191187 if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
192188 return -1;
193189
194− bufsize = encode_nals(ctx, buf, bufsize, nal, nnal, 0);
195− if (bufsize < 0)
190+ ret = encode_nals(ctx, pkt, nal, nnal);
191+ if (ret < 0)
196192 return -1;
197− } while (!bufsize && !frame && x264_encoder_delayed_frames(x4->enc));
193+ } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc));
198194
199− /* FIXME: libx264 now provides DTS, but AVFrame doesn't have a field for it. */
200− x4->out_pic.pts = pic_out.i_pts;
195+ pkt->pts = pic_out.i_pts;
196+ pkt->dts = pic_out.i_dts;
201197
202198 switch (pic_out.i_type) {
203199 case X264_TYPE_IDR:
@@ -213,11 +209,12 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf, · 9 unmodified lines
213209 break;
214210 }
215211
216− x4->out_pic.key_frame = pic_out.b_keyframe;
217− if (bufsize)
212+ pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
213+ if (ret)
218214 x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
219215
220− return bufsize;
216+ *got_packet = ret;
217+ return 0;
221218 }
222219
223220 static av_cold int X264_close(AVCodecContext *avctx)
@@ -485,16 +482,25 @@ static av_cold int X264_init(AVCodecContext *avctx) · 261 unmodified lines
485482
486483 if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
487484 x264_nal_t *nal;
485+ uint8_t *p;
488486 int nnal, s, i;
489487
490488 s = x264_encoder_headers(x4->enc, &nal, &nnal);
489+ avctx->extradata = p = av_malloc(s);
491490
492− for (i = 0; i < nnal; i++)
493− if (nal[i].i_type == NAL_SEI)
491+ for (i = 0; i < nnal; i++) {
492+ /* Don't put the SEI in extradata. */
493+ if (nal[i].i_type == NAL_SEI) {
494494 av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25);
495−
496− avctx->extradata = av_malloc(s);
497− avctx->extradata_size = encode_nals(avctx, avctx->extradata, s, nal, nnal, 1);
495+ x4->sei_size = nal[i].i_payload;
496+ x4->sei = av_malloc(x4->sei_size);
497+ memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload);
498+ continue;
499+ }
500+ memcpy(p, nal[i].p_payload, nal[i].i_payload);
501+ p += nal[i].i_payload;
502+ }
503+ avctx->extradata_size = p - avctx->extradata;
498504 }
499505
500506 return 0;
@@ -634,7 +640,7 @@ AVCodec ff_libx264_encoder = { · 133 unmodified lines
634640 .id = CODEC_ID_H264,
635641 .priv_data_size = sizeof(X264Context),
636642 .init = X264_init,
637− .encode = X264_frame,
643+ .encode2 = X264_frame,
638644 .close = X264_close,
639645 .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
640646 .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
libavcodec/mlib/dsputil_mlib.c+0−469
@@ -1,469 +0,0 @@
1−/*
2− * Sun mediaLib optimized DSP utils
3− * Copyright (c) 2001 Fabrice Bellard
4− *
5− * This file is part of FFmpeg.
6− *
7− * FFmpeg is free software; you can redistribute it and/or
8− * modify it under the terms of the GNU Lesser General Public
9− * License as published by the Free Software Foundation; either
10− * version 2.1 of the License, or (at your option) any later version.
11− *
12− * FFmpeg is distributed in the hope that it will be useful,
13− * but WITHOUT ANY WARRANTY; without even the implied warranty of
14− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15− * Lesser General Public License for more details.
16− *
17− * You should have received a copy of the GNU Lesser General Public
18− * License along with FFmpeg; if not, write to the Free Software
19− * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20− */
21−
22−#include "libavcodec/dsputil.h"
23−#include "libavcodec/mpegvideo.h"
24−
25−#include <mlib_types.h>
26−#include <mlib_status.h>
27−#include <mlib_sys.h>
28−#include <mlib_algebra.h>
29−#include <mlib_video.h>
30−
31−/* misc */
32−
33−static void get_pixels_mlib(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
34−{
35− int i;
36−
37− for (i=0;i<8;i++) {
38− mlib_VectorConvert_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)pixels, 8);
39−
40− pixels += line_size;
41− block += 8;
42− }
43−}
44−
45−static void diff_pixels_mlib(DCTELEM *restrict block, const uint8_t *s1, const uint8_t *s2, int line_size)
46−{
47− int i;
48−
49− for (i=0;i<8;i++) {
50− mlib_VectorSub_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)s1, (mlib_u8 *)s2, 8);
51−
52− s1 += line_size;
53− s2 += line_size;
54− block += 8;
55− }
56−}
57−
58−static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
59−{
60− mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
61−}
62−
63−/* put block, width 16 pixel, height 8/16 */
64−
65−static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
66− int stride, int height)
67−{
68− switch (height) {
69− case 8:
70− mlib_VideoCopyRef_U8_U8_16x8(dest, (uint8_t *)ref, stride);
71− break;
72−
73− case 16:
74− mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride);
75− break;
76−
77− default:
78− assert(0);
79− }
80−}
81−
82−static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
83− int stride, int height)
84−{
85− switch (height) {
86− case 8:
87− mlib_VideoInterpX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
88− break;
89−
90− case 16:
91− mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
92− break;
93−
94− default:
95− assert(0);
96− }
97−}
98−
99−static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
100− int stride, int height)
101−{
102− switch (height) {
103− case 8:
104− mlib_VideoInterpY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
105− break;
106−
107− case 16:
108− mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
109− break;
110−
111− default:
112− assert(0);
113− }
114−}
115−
116−static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
117− int stride, int height)
118−{
119− switch (height) {
120− case 8:
121− mlib_VideoInterpXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
122− break;
123−
124− case 16:
125− mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
126− break;
127−
128− default:
129− assert(0);
130− }
131−}
132−
133−/* put block, width 8 pixel, height 4/8/16 */
134−
135−static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
136− int stride, int height)
137−{
138− switch (height) {
139− case 4:
140− mlib_VideoCopyRef_U8_U8_8x4(dest, (uint8_t *)ref, stride);
141− break;
142−
143− case 8:
144− mlib_VideoCopyRef_U8_U8_8x8(dest, (uint8_t *)ref, stride);
145− break;
146−
147− case 16:
148− mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
149− break;
150−
151− default:
152− assert(0);
153− }
154−}
155−
156−static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
157− int stride, int height)
158−{
159− switch (height) {
160− case 4:
161− mlib_VideoInterpX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
162− break;
163−
164− case 8:
165− mlib_VideoInterpX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
166− break;
167−
168− case 16:
169− mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
170− break;
171−
172− default:
173− assert(0);
174− }
175−}
176−
177−static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
178− int stride, int height)
179−{
180− switch (height) {
181− case 4:
182− mlib_VideoInterpY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
183− break;
184−
185− case 8:
186− mlib_VideoInterpY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
187− break;
188−
189− case 16:
190− mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
191− break;
192−
193− default:
194− assert(0);
195− }
196−}
197−
198−static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
199− int stride, int height)
200−{
201− switch (height) {
202− case 4:
203− mlib_VideoInterpXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
204− break;
205−
206− case 8:
207− mlib_VideoInterpXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
208− break;
209−
210− case 16:
211− mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
212− break;
213−
214− default:
215− assert(0);
216− }
217−}
218−
219−/* average block, width 16 pixel, height 8/16 */
220−
221−static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
222− int stride, int height)
223−{
224− switch (height) {
225− case 8:
226− mlib_VideoCopyRefAve_U8_U8_16x8(dest, (uint8_t *)ref, stride);
227− break;
228−
229− case 16:
230− mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride);
231− break;
232−
233− default:
234− assert(0);
235− }
236−}
237−
238−static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
239− int stride, int height)
240−{
241− switch (height) {
242− case 8:
243− mlib_VideoInterpAveX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
244− break;
245−
246− case 16:
247− mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
248− break;
249−
250− default:
251− assert(0);
252− }
253−}
254−
255−static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
256− int stride, int height)
257−{
258− switch (height) {
259− case 8:
260− mlib_VideoInterpAveY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
261− break;
262−
263− case 16:
264− mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
265− break;
266−
267− default:
268− assert(0);
269− }
270−}
271−
272−static void avg_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
273− int stride, int height)
274−{
275− switch (height) {
276− case 8:
277− mlib_VideoInterpAveXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
278− break;
279−
280− case 16:
281− mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
282− break;
283−
284− default:
285− assert(0);
286− }
287−}
288−
289−/* average block, width 8 pixel, height 4/8/16 */
290−
291−static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
292− int stride, int height)
293−{
294− switch (height) {
295− case 4:
296− mlib_VideoCopyRefAve_U8_U8_8x4(dest, (uint8_t *)ref, stride);
297− break;
298−
299− case 8:
300− mlib_VideoCopyRefAve_U8_U8_8x8(dest, (uint8_t *)ref, stride);
301− break;
302−
303− case 16:
304− mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
305− break;
306−
307− default:
308− assert(0);
309− }
310−}
311−
312−static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
313− int stride, int height)
314−{
315− switch (height) {
316− case 4:
317− mlib_VideoInterpAveX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
318− break;
319−
320− case 8:
321− mlib_VideoInterpAveX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
322− break;
323−
324− case 16:
325− mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
326− break;
327−
328− default:
329− assert(0);
330− }
331−}
332−
333−static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
334− int stride, int height)
335−{
336− switch (height) {
337− case 4:
338− mlib_VideoInterpAveY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
339− break;
340−
341− case 8:
342− mlib_VideoInterpAveY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
343− break;
344−
345− case 16:
346− mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
347− break;
348−
349− default:
350− assert(0);
351− }
352−}
353−
354−static void avg_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
355− int stride, int height)
356−{
357− switch (height) {
358− case 4:
359− mlib_VideoInterpAveXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
360− break;
361−
362− case 8:
363− mlib_VideoInterpAveXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
364− break;
365−
366− case 16:
367− mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
368− break;
369−
370− default:
371− assert(0);
372− }
373−}
374−
375−/* swap byte order of a buffer */
376−
377−static void bswap_buf_mlib(uint32_t *dst, const uint32_t *src, int w)
378−{
379− mlib_VectorReverseByteOrder_U32_U32(dst, src, w);
380−}
381−
382−/* transformations */
383−
384−static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
385−{
386− int i;
387− uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
388−
389− mlib_VideoIDCT8x8_S16_S16 (data, data);
390−
391− for(i=0;i<8;i++) {
392− dest[0] = cm[data[0]];
393− dest[1] = cm[data[1]];
394− dest[2] = cm[data[2]];
395− dest[3] = cm[data[3]];
396− dest[4] = cm[data[4]];
397− dest[5] = cm[data[5]];
398− dest[6] = cm[data[6]];
399− dest[7] = cm[data[7]];
400−
401− dest += line_size;
402− data += 8;
403− }
404−}
405−
406−static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
407−{
408− mlib_VideoIDCT8x8_S16_S16 (data, data);
409− mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);
410−}
411−
412−static void ff_idct_mlib(DCTELEM *data)
413−{
414− mlib_VideoIDCT8x8_S16_S16 (data, data);
415−}
416−
417−static void ff_fdct_mlib(DCTELEM *data)
418−{
419− mlib_VideoDCT8x8_S16_S16 (data, data);
420−}
421−
422−void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
423−{
424− const int high_bit_depth = avctx->bits_per_raw_sample > 8;
425−
426− c->diff_pixels = diff_pixels_mlib;
427− c->add_pixels_clamped = add_pixels_clamped_mlib;
428−
429− if (!high_bit_depth) {
430− c->get_pixels = get_pixels_mlib;
431−
432− c->put_pixels_tab[0][0] = put_pixels16_mlib;
433− c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
434− c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
435− c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
436− c->put_pixels_tab[1][0] = put_pixels8_mlib;
437− c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
438− c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
439− c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
440−
441− c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
442− c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
443− c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
444− c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
445− c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
446− c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
447− c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
448− c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
449−
450− c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
451− c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
452− }
453−
454− c->bswap_buf = bswap_buf_mlib;
455−}
456−
457−void MPV_common_init_mlib(MpegEncContext *s)
458−{
459− if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){
460− s->dsp.fdct = ff_fdct_mlib;
461− }
462−
463− if(s->avctx->idct_algo==FF_IDCT_MLIB){
464− s->dsp.idct_put= ff_idct_put_mlib;
465− s->dsp.idct_add= ff_idct_add_mlib;
466− s->dsp.idct = ff_idct_mlib;
467− s->dsp.idct_permutation_type= FF_NO_IDCT_PERM;
468− }
469−}
libavcodec/mpegvideo.c+0−2
@@ -191,8 +191,6 @@ av_cold int ff_dct_common_init(MpegEncContext *s) · 190 unmodified lines
191191 MPV_common_init_mmx(s);
192192 #elif ARCH_ALPHA
193193 MPV_common_init_axp(s);
194−#elif CONFIG_MLIB
195− MPV_common_init_mlib(s);
196194 #elif HAVE_MMI
197195 MPV_common_init_mmi(s);
198196 #elif ARCH_ARM
libavcodec/mpegvideo.h+0−1
@@ -705,7 +705,6 @@ int MPV_encode_end(AVCodecContext *avctx); · 704 unmodified lines
705705 int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data);
706706 void MPV_common_init_mmx(MpegEncContext *s);
707707 void MPV_common_init_axp(MpegEncContext *s);
708−void MPV_common_init_mlib(MpegEncContext *s);
709708 void MPV_common_init_mmi(MpegEncContext *s);
710709 void MPV_common_init_arm(MpegEncContext *s);
711710 void MPV_common_init_altivec(MpegEncContext *s);
libavcodec/options.c+0−2
@@ -206,7 +206,6 @@ static const AVOption options[]={ · 205 unmodified lines
206206 {"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"},
207207 {"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"},
208208 {"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"},
209−{"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_MLIB }, INT_MIN, INT_MAX, V|E, "dct"},
210209 {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"},
211210 {"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"},
212211 {"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
@@ -221,7 +220,6 @@ static const AVOption options[]={ · 8 unmodified lines
221220 {"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
222221 {"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
223222 {"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"},
224−{"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_MLIB }, INT_MIN, INT_MAX, V|E|D, "idct"},
225223 {"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
226224 {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"},
227225 {"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"},
libavcodec/rawdec.c+1−2
@@ -187,8 +187,7 @@ static int raw_decode(AVCodecContext *avctx, · 186 unmodified lines
187187
188188 avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height);
189189 if((avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length) ||
190− (avctx->pix_fmt!=PIX_FMT_PAL8 &&
191− (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){
190+ (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PSEUDOPAL)) {
192191 frame->data[1]= context->palette;
193192 }
194193 if (avctx->pix_fmt == PIX_FMT_PAL8) {
libavcodec/utils.c+92−20
@@ -244,18 +244,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, · 243 unmodified lines
244244
245245 for (i = 0; i < 4; i++)
246246 linesize_align[i] = STRIDE_ALIGN;
247−//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
248−//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
249−//picture size unneccessarily in some cases. The solution here is not
250−//pretty and better ideas are welcome!
251−#if HAVE_MMX
252− if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
253− s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
254− s->codec_id == CODEC_ID_VP6A || s->codec_id == CODEC_ID_DIRAC) {
255− for (i = 0; i < 4; i++)
256− linesize_align[i] = 16;
257− }
258−#endif
259247 }
260248
261249 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
@@ -1125,23 +1113,107 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, · 863 unmodified lines
11251113 }
11261114 #endif
11271115
1116+#if FF_API_OLD_ENCODE_VIDEO
11281117 int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
11291118 const AVFrame *pict)
11301119 {
1120+ AVPacket pkt;
1121+ int ret, got_packet = 0;
1122+
11311123 if(buf_size < FF_MIN_BUFFER_SIZE){
11321124 av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
11331125 return -1;
11341126 }
1135− if(av_image_check_size(avctx->width, avctx->height, 0, avctx))
1136− return -1;
1137− if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
1138− int ret = avctx->codec->encode(avctx, buf, buf_size, pict);
1139− avctx->frame_number++;
1140− emms_c(); //needed to avoid an emms_c() call before every return;
11411127
1142− return ret;
1143− }else
1128+ av_init_packet(&pkt);
1129+ pkt.data = buf;
1130+ pkt.size = buf_size;
1131+
1132+ ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet);
1133+ if (!ret && got_packet && avctx->coded_frame) {
1134+ avctx->coded_frame->pts = pkt.pts;
1135+ avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY);
1136+ }
1137+
1138+ /* free any side data since we cannot return it */
1139+ if (pkt.side_data_elems > 0) {
1140+ int i;
1141+ for (i = 0; i < pkt.side_data_elems; i++)
1142+ av_free(pkt.side_data[i].data);
1143+ av_freep(&pkt.side_data);
1144+ pkt.side_data_elems = 0;
1145+ }
1146+
1147+ return ret ? ret : pkt.size;
1148+}
1149+#endif
1150+
1151+#define MAX_CODED_FRAME_SIZE(width, height)\
1152+ (9*(width)*(height) + FF_MIN_BUFFER_SIZE)
1153+
1154+int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
1155+ AVPacket *avpkt,
1156+ const AVFrame *frame,
1157+ int *got_packet_ptr)
1158+{
1159+ int ret;
1160+ int user_packet = !!avpkt->data;
1161+
1162+ if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {
1163+ av_init_packet(avpkt);
1164+ avpkt->size = 0;
1165+ *got_packet_ptr = 0;
11441166 return 0;
1167+ }
1168+
1169+ if (av_image_check_size(avctx->width, avctx->height, 0, avctx))
1170+ return AVERROR(EINVAL);
1171+
1172+ if (avctx->codec->encode2) {
1173+ *got_packet_ptr = 0;
1174+ ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
1175+ if (!ret) {
1176+ if (!*got_packet_ptr)
1177+ avpkt->size = 0;
1178+ else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
1179+ avpkt->pts = avpkt->dts = frame->pts;
1180+ }
1181+ } else {
1182+ /* for compatibility with encoders not supporting encode2(), we need to
1183+ allocate a packet buffer if the user has not provided one or check
1184+ the size otherwise */
1185+ int buf_size = avpkt->size;
1186+
1187+ if (!user_packet)
1188+ buf_size = MAX_CODED_FRAME_SIZE(avctx->width, avctx->height);
1189+
1190+ if ((ret = ff_alloc_packet(avpkt, buf_size)))
1191+ return ret;
1192+
1193+ /* encode the frame */
1194+ ret = avctx->codec->encode(avctx, avpkt->data, avpkt->size, frame);
1195+ if (ret >= 0) {
1196+ if (!ret) {
1197+ /* no output. if the packet data was allocated by libavcodec,
1198+ free it */
1199+ if (!user_packet)
1200+ av_freep(&avpkt->data);
1201+ } else if (avctx->coded_frame) {
1202+ avpkt->pts = avctx->coded_frame->pts;
1203+ avpkt->flags |= AV_PKT_FLAG_KEY*!!avctx->coded_frame->key_frame;
1204+ }
1205+
1206+ avpkt->size = ret;
1207+ *got_packet_ptr = (ret > 0);
1208+ ret = 0;
1209+ }
1210+ }
1211+
1212+ if (!ret)
1213+ avctx->frame_number++;
1214+
1215+ emms_c();
1216+ return ret;
11451217 }
11461218
11471219 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
libavcodec/version.h+3−0
@@ -57,5 +57,8 @@ · 56 unmodified lines
5757 #ifndef FF_API_OLD_ENCODE_AUDIO
5858 #define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
5959 #endif
60+#ifndef FF_API_OLD_ENCODE_VIDEO
61+#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 55)
62+#endif
6063
6164 #endif /* AVCODEC_VERSION_H */
libavcodec/x86/h264_idct.asm+3−0
@@ -968,6 +968,9 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8 · 967 unmodified lines
968968
969969 %macro IDCT_DC_DEQUANT 2
970970 cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
971+ ; manually spill XMM registers for Win64 because
972+ ; the code here is initialized with INIT_MMX
973+ WIN64_SPILL_XMM %2
971974 movq m3, [r1+24]
972975 movq m2, [r1+16]
973976 movq m1, [r1+ 8]
libavcodec/x86/h264_intrapred.asm+3−0
@@ -1931,6 +1931,9 @@ cglobal pred8x8l_vertical_right_mmxext, 4,5 · 1930 unmodified lines
19311931
19321932 %macro PRED8x8L_VERTICAL_RIGHT 1
19331933 cglobal pred8x8l_vertical_right_%1, 4,5,7
1934+ ; manually spill XMM registers for Win64 because
1935+ ; the code here is initialized with INIT_MMX
1936+ WIN64_SPILL_XMM 7
19341937 sub r0, r3
19351938 lea r4, [r0+r3*2]
19361939 movq mm0, [r0+r3*1-8]
libavfilter/vf_crop.c+2−1
@@ -278,7 +278,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 277 unmodified lines
278278 ref2->data[0] += crop->y * ref2->linesize[0];
279279 ref2->data[0] += crop->x * crop->max_step[0];
280280
281− if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) {
281+ if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL ||
282+ av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PSEUDOPAL)) {
282283 for (i = 1; i < 3; i ++) {
283284 if (ref2->data[i]) {
284285 ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];
libavfilter/vf_pixdesctest.c+2−1
@@ -72,7 +72,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 71 unmodified lines
7272 }
7373
7474 /* copy palette */
75− if (priv->pix_desc->flags & PIX_FMT_PAL)
75+ if (priv->pix_desc->flags & PIX_FMT_PAL ||
76+ priv->pix_desc->flags & PIX_FMT_PSEUDOPAL)
7677 memcpy(outpicref->data[1], outpicref->data[1], 256*4);
7778
7879 avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
libavfilter/vf_scale.c+2−1
@@ -212,7 +212,8 @@ static int config_props(AVFilterLink *outlink) · 211 unmodified lines
212212 outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name,
213213 scale->flags);
214214
215− scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL;
215+ scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL ||
216+ av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PSEUDOPAL;
216217 if (outfmt == PIX_FMT_PAL8) outfmt = PIX_FMT_BGR8;
217218
218219 if (scale->sws)
libavutil/audioconvert.h+1−0
@@ -97,6 +97,7 @@ · 96 unmodified lines
9797 #define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
9898 #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
9999 #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
100+#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
100101 #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
101102 #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
102103
libavutil/avutil.h+1−1
@@ -155,7 +155,7 @@ · 154 unmodified lines
155155
156156 #define LIBAVUTIL_VERSION_MAJOR 51
157157 #define LIBAVUTIL_VERSION_MINOR 38
158−#define LIBAVUTIL_VERSION_MICRO 100
158+#define LIBAVUTIL_VERSION_MICRO 101
159159
160160 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
161161 LIBAVUTIL_VERSION_MINOR, \
libavutil/imgutils.c+6−3
@@ -116,7 +116,8 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh · 115 unmodified lines
116116 return AVERROR(EINVAL);
117117 size[0] = linesizes[0] * height;
118118
119− if (desc->flags & PIX_FMT_PAL) {
119+ if (desc->flags & PIX_FMT_PAL ||
120+ desc->flags & PIX_FMT_PSEUDOPAL) {
120121 size[0] = (size[0] + 3) & ~3;
121122 data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
122123 return size[0] + 256 * 4;
@@ -204,7 +205,8 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], · 81 unmodified lines
204205 av_free(buf);
205206 return ret;
206207 }
207− if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)
208+ if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL ||
209+ av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PSEUDOPAL)
208210 ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
209211
210212 return ret;
@@ -251,7 +253,8 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], · 40 unmodified lines
251253 if (desc->flags & PIX_FMT_HWACCEL)
252254 return;
253255
254− if (desc->flags & PIX_FMT_PAL) {
256+ if (desc->flags & PIX_FMT_PAL ||
257+ desc->flags & PIX_FMT_PSEUDOPAL) {
255258 av_image_copy_plane(dst_data[0], dst_linesizes[0],
256259 src_data[0], src_linesizes[0],
257260 width, height);
libavutil/pixdesc.c+4−4
@@ -327,7 +327,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 326 unmodified lines
327327 { 0, 0, 1, 3, 2 }, /* G */
328328 { 0, 0, 1, 0, 2 }, /* R */
329329 },
330− .flags = PIX_FMT_PAL | PIX_FMT_RGB,
330+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
331331 },
332332 [PIX_FMT_BGR4] = {
333333 .name = "bgr4",
@@ -351,7 +351,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 17 unmodified lines
351351 { 0, 0, 1, 1, 1 }, /* G */
352352 { 0, 0, 1, 0, 0 }, /* R */
353353 },
354− .flags = PIX_FMT_PAL | PIX_FMT_RGB,
354+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
355355 },
356356 [PIX_FMT_RGB8] = {
357357 .name = "rgb8",
@@ -363,7 +363,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 5 unmodified lines
363363 { 0, 0, 1, 3, 2 }, /* G */
364364 { 0, 0, 1, 0, 2 }, /* B */
365365 },
366− .flags = PIX_FMT_PAL | PIX_FMT_RGB,
366+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
367367 },
368368 [PIX_FMT_RGB4] = {
369369 .name = "rgb4",
@@ -387,7 +387,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 17 unmodified lines
387387 { 0, 0, 1, 1, 1 }, /* G */
388388 { 0, 0, 1, 0, 0 }, /* B */
389389 },
390− .flags = PIX_FMT_PAL | PIX_FMT_RGB,
390+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
391391 },
392392 [PIX_FMT_NV12] = {
393393 .name = "nv12",
libavutil/pixdesc.h+6−0
@@ -89,6 +89,12 @@ typedef struct AVPixFmtDescriptor{ · 88 unmodified lines
8989 #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
9090 #define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane
9191 #define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale)
92+/**
93+ * The pixel format is "pseudo-paletted". This means that Libav treats it as
94+ * paletted internally, but the palette is generated by the decoder and is not
95+ * stored in the file.
96+ */
97+#define PIX_FMT_PSEUDOPAL 64
9298
9399 /**
94100 * The array of all the pixel format descriptors.
libavutil/x86/x86inc.asm+7−4
@@ -40,6 +40,8 @@ · 39 unmodified lines
4040 %if ARCH_X86_64
4141 %ifidn __OUTPUT_FORMAT__,win32
4242 %define WIN64 1
43+ %elifidn __OUTPUT_FORMAT__,win64
44+ %define WIN64 1
4345 %else
4446 %define UNIX64 1
4547 %endif
@@ -290,7 +292,11 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56] · 244 unmodified lines
290292 push r5
291293 %assign stack_offset stack_offset+16
292294 %endif
293− WIN64_SPILL_XMM %3
295+ %if mmsize == 8
296+ %assign xmm_regs_used 0
297+ %else
298+ WIN64_SPILL_XMM %3
299+ %endif
294300 LOAD_IF_USED 4, %1
295301 LOAD_IF_USED 5, %1
296302 LOAD_IF_USED 6, %1
@@ -299,9 +305,6 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56] · 2 unmodified lines
299305
300306 %macro WIN64_SPILL_XMM 1
301307 %assign xmm_regs_used %1
302− %if mmsize == 8
303− %assign xmm_regs_used 0
304− %endif
305308 ASSERT xmm_regs_used <= 16
306309 %if xmm_regs_used > 6
307310 sub rsp, (xmm_regs_used-6)*16+16
libswscale/Makefile+1−2
@@ -11,7 +11,6 @@ OBJS = input.o options.o output.o rgb2rgb.o swscale.o \ · 10 unmodified lines
1111 OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \
1212 bfin/swscale_bfin.o \
1313 bfin/yuv2rgb_bfin.o
14−OBJS-$(CONFIG_MLIB) += mlib/yuv2rgb_mlib.o
1514 OBJS-$(HAVE_ALTIVEC) += ppc/swscale_altivec.o \
1615 ppc/yuv2rgb_altivec.o \
1716 ppc/yuv2yuv_altivec.o
@@ -29,4 +28,4 @@ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o · 11 unmodified lines
2928
3029 TESTPROGS = colorspace swscale
3130
32−DIRS = bfin mlib ppc sparc x86
31+DIRS = bfin ppc sparc x86
libswscale/mlib/yuv2rgb_mlib.c+0−89
@@ -1,89 +0,0 @@
1−/*
2− * software YUV to RGB converter using mediaLib
3− *
4− * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
5− *
6− * This file is part of FFmpeg.
7− *
8− * FFmpeg is free software; you can redistribute it and/or
9− * modify it under the terms of the GNU Lesser General Public
10− * License as published by the Free Software Foundation; either
11− * version 2.1 of the License, or (at your option) any later version.
12− *
13− * FFmpeg is distributed in the hope that it will be useful,
14− * but WITHOUT ANY WARRANTY; without even the implied warranty of
15− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16− * Lesser General Public License for more details.
17− *
18− * You should have received a copy of the GNU Lesser General Public
19− * License along with FFmpeg; if not, write to the Free Software
20− * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21− */
22−
23−#include <mlib_types.h>
24−#include <mlib_status.h>
25−#include <mlib_sys.h>
26−#include <mlib_video.h>
27−#include <inttypes.h>
28−#include <stdlib.h>
29−#include <assert.h>
30−
31−#include "libswscale/swscale.h"
32−#include "libswscale/swscale_internal.h"
33−
34−static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
35− int srcSliceH, uint8_t* dst[], int dstStride[])
36−{
37− if(c->srcFormat == PIX_FMT_YUV422P) {
38− srcStride[1] *= 2;
39− srcStride[2] *= 2;
40− }
41−
42− assert(srcStride[1] == srcStride[2]);
43−
44− mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
45− srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
46− return srcSliceH;
47−}
48−
49−static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
50− int srcSliceH, uint8_t* dst[], int dstStride[])
51−{
52− if(c->srcFormat == PIX_FMT_YUV422P) {
53− srcStride[1] *= 2;
54− srcStride[2] *= 2;
55− }
56−
57− assert(srcStride[1] == srcStride[2]);
58−
59− mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
60− srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
61− return srcSliceH;
62−}
63−
64−static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
65− int srcSliceH, uint8_t* dst[], int dstStride[])
66−{
67− if(c->srcFormat == PIX_FMT_YUV422P) {
68− srcStride[1] *= 2;
69− srcStride[2] *= 2;
70− }
71−
72− assert(srcStride[1] == srcStride[2]);
73−
74− mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
75− srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
76− return srcSliceH;
77−}
78−
79−
80−SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c)
81−{
82− switch(c->dstFormat) {
83− case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
84− case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
85− case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
86− default: return NULL;
87− }
88−}
89−
libswscale/swscale_internal.h+3−2
@@ -542,7 +542,6 @@ void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufI · 541 unmodified lines
542542
543543 SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c);
544544 SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
545−SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c);
546545 SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
547546 SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
548547 void ff_bfin_get_unscaled_swscale(SwsContext *c);
@@ -682,7 +681,9 @@ const char *sws_format_name(enum PixelFormat format); · 133 unmodified lines
682681 (av_pix_fmt_descriptors[x].nb_components >= 2 && \
683682 (av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
684683
685−#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)
684+#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || \
685+ (av_pix_fmt_descriptors[x].flags & PIX_FMT_PSEUDOPAL) || \
686+ (x) == PIX_FMT_Y400A)
686687
687688 extern const uint64_t ff_dither4[2];
688689 extern const uint64_t ff_dither8[2];
libswscale/x86/output.asm+1−0
@@ -319,6 +319,7 @@ yuv2planeX_fn 10, 7, 5 · 318 unmodified lines
319319
320320 %macro yuv2plane1_fn 3
321321 cglobal yuv2plane1_%1, %3, %3, %2, src, dst, dstw, dither, offset
322+ movsxdifnidn dstwq, dstwd
322323 add dstwq, mmsize - 1
323324 and dstwq, ~(mmsize - 1)
324325 %if %1 == 8
libswscale/yuv2rgb.c+0−2
@@ -511,8 +511,6 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) · 510 unmodified lines
511511 t = ff_yuv2rgb_init_mmx(c);
512512 } else if (HAVE_VIS) {
513513 t = ff_yuv2rgb_init_vis(c);
514− } else if (CONFIG_MLIB) {
515− t = ff_yuv2rgb_init_mlib(c);
516514 } else if (HAVE_ALTIVEC) {
517515 t = ff_yuv2rgb_init_altivec(c);
518516 } else if (ARCH_BFIN) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t