* 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
Unified · Split
| @@ -205,7 +205,6 @@ External library support: · 204 unmodified lines | ||
| 205 | 205 | --enable-libxvid enable Xvid encoding via xvidcore, |
| 206 | 206 | native MPEG-4/Xvid encoder exists [no] |
| 207 | 207 | --enable-openal enable OpenAL 1.1 capture support [no] |
| 208 | − --enable-mlib enable Sun medialib [no] | |
| 209 | 208 | --enable-openssl enable openssl [no] |
| 210 | 209 | --enable-zlib enable zlib [autodetect] |
| 211 | 210 | |
| @@ -1062,7 +1061,6 @@ CONFIG_LIST=" · 850 unmodified lines | ||
| 1062 | 1061 | lsp |
| 1063 | 1062 | mdct |
| 1064 | 1063 | memalign_hack |
| 1065 | − mlib | |
| 1066 | 1064 | mpegaudiodsp |
| 1067 | 1065 | network |
| 1068 | 1066 | nonfree |
| @@ -3179,7 +3177,6 @@ enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32 · 2110 unmodified lines | ||
| 3179 | 3177 | die "ERROR: openal not found"; } && |
| 3180 | 3178 | { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" || |
| 3181 | 3179 | die "ERROR: openal version must be 1.1 or compatible"; } |
| 3182 | −enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib | |
| 3183 | 3180 | enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || |
| 3184 | 3181 | check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || |
| 3185 | 3182 | 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 | ||
| 3478 | 3475 | echo "threading support ${thread_type-no}" |
| 3479 | 3476 | echo "safe bitstream reader ${safe_bitstream_reader-no}" |
| 3480 | 3477 | echo "SDL support ${sdl-no}" |
| 3481 | −echo "Sun medialib support ${mlib-no}" | |
| 3482 | 3478 | echo "libdxva2 enabled ${dxva2-no}" |
| 3483 | 3479 | echo "libva enabled ${vaapi-no}" |
| 3484 | 3480 | echo "libvdpau enabled ${vdpau-no}" |
| @@ -25,6 +25,12 @@ API changes, most recent first: · 24 unmodified lines | ||
| 25 | 25 | 2012-01-24 - xxxxxxx - lavfi 2.60.100 |
| 26 | 26 | Add avfilter_graph_dump. |
| 27 | 27 | |
| 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 | + | |
| 28 | 34 | 2012-02-01 - 316fc74 - lavc 54.01.0 |
| 29 | 35 | Add av_fast_padded_malloc() as alternative for av_realloc() when aligned |
| 30 | 36 | memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE |
| @@ -1385,9 +1385,6 @@ static void do_subtitle_out(AVFormatContext *s, · 1384 unmodified lines | ||
| 1385 | 1385 | } |
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | −static int bit_buffer_size = 1024 * 256; | |
| 1389 | −static uint8_t *bit_buffer = NULL; | |
| 1390 | − | |
| 1391 | 1388 | static void do_video_resample(OutputStream *ost, |
| 1392 | 1389 | InputStream *ist, |
| 1393 | 1390 | AVFrame *in_picture, |
| @@ -1513,6 +1510,8 @@ static void do_video_out(AVFormatContext *s, · 119 unmodified lines | ||
| 1513 | 1510 | for (i = 0; i < nb_frames; i++) { |
| 1514 | 1511 | AVPacket pkt; |
| 1515 | 1512 | av_init_packet(&pkt); |
| 1513 | + pkt.data = NULL; | |
| 1514 | + pkt.size = 0; | |
| 1516 | 1515 | |
| 1517 | 1516 | if (s->oformat->flags & AVFMT_RAWPICTURE && |
| 1518 | 1517 | enc->codec->id == CODEC_ID_RAWVIDEO) { |
| @@ -1528,6 +1527,7 @@ static void do_video_out(AVFormatContext *s, · 9 unmodified lines | ||
| 1528 | 1527 | |
| 1529 | 1528 | write_frame(s, &pkt, ost); |
| 1530 | 1529 | } else { |
| 1530 | + int got_packet; | |
| 1531 | 1531 | AVFrame big_picture; |
| 1532 | 1532 | |
| 1533 | 1533 | big_picture = *final_picture; |
| @@ -1552,29 +1552,27 @@ static void do_video_out(AVFormatContext *s, · 18 unmodified lines | ||
| 1552 | 1552 | big_picture.pict_type = AV_PICTURE_TYPE_I; |
| 1553 | 1553 | ost->forced_kf_index++; |
| 1554 | 1554 | } |
| 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); | |
| 1558 | 1556 | if (ret < 0) { |
| 1559 | 1557 | av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); |
| 1560 | 1558 | exit_program(1); |
| 1561 | 1559 | } |
| 1562 | 1560 | |
| 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); | |
| 1570 | 1569 | |
| 1571 | − if (enc->coded_frame->key_frame) | |
| 1572 | − pkt.flags |= AV_PKT_FLAG_KEY; | |
| 1573 | 1570 | if (format_video_sync == VSYNC_DROP) |
| 1574 | 1571 | pkt.pts = pkt.dts = AV_NOPTS_VALUE; |
| 1572 | + | |
| 1575 | 1573 | write_frame(s, &pkt, ost); |
| 1576 | − *frame_size = ret; | |
| 1577 | − video_size += ret; | |
| 1574 | + *frame_size = pkt.size; | |
| 1575 | + video_size += pkt.size; | |
| 1578 | 1576 | |
| 1579 | 1577 | /* if two pass, output log */ |
| 1580 | 1578 | if (ost->logfile && enc->stats_out) { |
| @@ -1789,7 +1787,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) · 208 unmodified lines | ||
| 1789 | 1787 | |
| 1790 | 1788 | for (;;) { |
| 1791 | 1789 | AVPacket pkt; |
| 1792 | − int fifo_bytes; | |
| 1790 | + int fifo_bytes, got_packet; | |
| 1793 | 1791 | av_init_packet(&pkt); |
| 1794 | 1792 | pkt.data = NULL; |
| 1795 | 1793 | pkt.size = 0; |
| @@ -1822,25 +1820,23 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) · 26 unmodified lines | ||
| 1822 | 1820 | } |
| 1823 | 1821 | break; |
| 1824 | 1822 | 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); | |
| 1826 | 1824 | if (ret < 0) { |
| 1827 | 1825 | av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); |
| 1828 | 1826 | exit_program(1); |
| 1829 | 1827 | } |
| 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; | |
| 1833 | 1829 | if (ost->logfile && enc->stats_out) { |
| 1834 | 1830 | fprintf(ost->logfile, "%s", enc->stats_out); |
| 1835 | 1831 | } |
| 1836 | − if (ret <= 0) { | |
| 1832 | + if (!got_packet) { | |
| 1837 | 1833 | stop_encoding = 1; |
| 1838 | 1834 | break; |
| 1839 | 1835 | } |
| 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); | |
| 1844 | 1840 | write_frame(os, &pkt, ost); |
| 1845 | 1841 | break; |
| 1846 | 1842 | default: |
| @@ -2668,19 +2664,6 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, · 821 unmodified lines | ||
| 2668 | 2664 | } |
| 2669 | 2665 | } |
| 2670 | 2666 | } |
| 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); | |
| 2684 | 2667 | } |
| 2685 | 2668 | |
| 2686 | 2669 | /* open each encoder */ |
| @@ -3118,7 +3101,6 @@ static int transcode(OutputFile *output_files, int nb_output_files, · 431 unmodified lines | ||
| 3118 | 3101 | ret = 0; |
| 3119 | 3102 | |
| 3120 | 3103 | fail: |
| 3121 | − av_freep(&bit_buffer); | |
| 3122 | 3104 | av_freep(&no_packet); |
| 3123 | 3105 | |
| 3124 | 3106 | if (output_streams) { |
| @@ -718,8 +718,6 @@ OBJS-$(HAVE_PTHREADS) += pthread.o · 717 unmodified lines | ||
| 718 | 718 | OBJS-$(HAVE_W32THREADS) += pthread.o |
| 719 | 719 | OBJS-$(HAVE_OS2THREADS) += pthread.o |
| 720 | 720 | |
| 721 | −OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \ | |
| 722 | − | |
| 723 | 721 | # inverse.o contains the ff_inverse table definition, which is used by |
| 724 | 722 | # the FASTDIV macro (from libavutil); since referencing the external |
| 725 | 723 | # 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 | ||
| 749 | 747 | dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ |
| 750 | 748 | pcm_tablegen qdm2_tablegen sinewin_tablegen |
| 751 | 749 | |
| 752 | −DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86 | |
| 750 | +DIRS = alpha arm bfin ppc ps2 sh4 sparc x86 | |
| 753 | 751 | |
| 754 | 752 | CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) |
| 755 | 753 | |
| @@ -189,10 +189,10 @@ static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID]) · 188 unmodified lines | ||
| 189 | 189 | * @return Returns error status. 0 - OK, !0 - error |
| 190 | 190 | */ |
| 191 | 191 | static av_cold int che_configure(AACContext *ac, |
| 192 | − enum ChannelPosition che_pos[4][MAX_ELEM_ID], | |
| 192 | + enum ChannelPosition che_pos, | |
| 193 | 193 | int type, int id, int *channels) |
| 194 | 194 | { |
| 195 | − if (che_pos[type][id]) { | |
| 195 | + if (che_pos) { | |
| 196 | 196 | if (!ac->che[type][id]) { |
| 197 | 197 | if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement)))) |
| 198 | 198 | return AVERROR(ENOMEM); |
| @@ -222,22 +222,21 @@ static av_cold int che_configure(AACContext *ac, · 23 unmodified lines | ||
| 222 | 222 | * @return Returns error status. 0 - OK, !0 - error |
| 223 | 223 | */ |
| 224 | 224 | static av_cold int output_configure(AACContext *ac, |
| 225 | − enum ChannelPosition che_pos[4][MAX_ELEM_ID], | |
| 226 | 225 | enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], |
| 227 | 226 | int channel_config, enum OCStatus oc_type) |
| 228 | 227 | { |
| 229 | 228 | AVCodecContext *avctx = ac->avctx; |
| 230 | 229 | int i, type, channels = 0, ret; |
| 231 | 230 | |
| 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])); | |
| 234 | 233 | |
| 235 | 234 | if (channel_config) { |
| 236 | 235 | 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))) | |
| 241 | 240 | return ret; |
| 242 | 241 | } |
| 243 | 242 | |
| @@ -249,14 +248,12 @@ static av_cold int output_configure(AACContext *ac, · 5 unmodified lines | ||
| 249 | 248 | * current program configuration. |
| 250 | 249 | * |
| 251 | 250 | * 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 ] | |
| 255 | 251 | */ |
| 256 | 252 | |
| 257 | 253 | for (i = 0; i < MAX_ELEM_ID; i++) { |
| 258 | 254 | 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))) | |
| 260 | 257 | return ret; |
| 261 | 258 | } |
| 262 | 259 | } |
| @@ -456,7 +453,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, · 193 unmodified lines | ||
| 456 | 453 | } else if (m4ac->sbr == 1 && m4ac->ps == -1) |
| 457 | 454 | m4ac->ps = 1; |
| 458 | 455 | |
| 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))) | |
| 460 | 457 | return ret; |
| 461 | 458 | |
| 462 | 459 | if (extension_flag) { |
| @@ -629,7 +626,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) · 166 unmodified lines | ||
| 629 | 626 | if (ac->m4ac.chan_config) { |
| 630 | 627 | int ret = set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config); |
| 631 | 628 | 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); | |
| 633 | 630 | else if (avctx->err_recognition & AV_EF_EXPLODE) |
| 634 | 631 | return AVERROR_INVALIDDATA; |
| 635 | 632 | } |
| @@ -1733,7 +1730,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, · 1097 unmodified lines | ||
| 1733 | 1730 | } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) { |
| 1734 | 1731 | ac->m4ac.sbr = 1; |
| 1735 | 1732 | 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); | |
| 1737 | 1734 | } else { |
| 1738 | 1735 | ac->m4ac.sbr = 1; |
| 1739 | 1736 | } |
| @@ -2116,7 +2113,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) · 376 unmodified lines | ||
| 2116 | 2113 | ac->m4ac.chan_config = hdr_info.chan_config; |
| 2117 | 2114 | if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config)) |
| 2118 | 2115 | 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, | |
| 2120 | 2117 | FFMAX(ac->output_configured, OC_TRIAL_FRAME))) |
| 2121 | 2118 | return -7; |
| 2122 | 2119 | } else if (ac->output_configured != OC_LOCKED) { |
| @@ -2176,7 +2173,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, · 53 unmodified lines | ||
| 2176 | 2173 | |
| 2177 | 2174 | if (set_default_channel_config(ac->avctx, new_che_pos, 2)<0) |
| 2178 | 2175 | 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) | |
| 2180 | 2177 | return -1; |
| 2181 | 2178 | } |
| 2182 | 2179 | 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 | ||
| 2220 | 2217 | if (ac->output_configured > OC_TRIAL_PCE) |
| 2221 | 2218 | av_log(avctx, AV_LOG_INFO, |
| 2222 | 2219 | "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); | |
| 2224 | 2221 | if (!err) |
| 2225 | 2222 | ac->m4ac.chan_config = 0; |
| 2226 | 2223 | break; |
| @@ -87,7 +87,7 @@ static const uint8_t aac_channel_layout_map[7][5][2] = { · 86 unmodified lines | ||
| 87 | 87 | { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, }, |
| 88 | 88 | { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, }, |
| 89 | 89 | { { 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 }, }, | |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | static const uint64_t aac_channel_layout[8] = { |
| @@ -97,7 +97,7 @@ static const uint64_t aac_channel_layout[8] = { · 3 unmodified lines | ||
| 97 | 97 | AV_CH_LAYOUT_4POINT0, |
| 98 | 98 | AV_CH_LAYOUT_5POINT0_BACK, |
| 99 | 99 | AV_CH_LAYOUT_5POINT1_BACK, |
| 100 | − AV_CH_LAYOUT_7POINT1_WIDE, | |
| 100 | + AV_CH_LAYOUT_7POINT1_WIDE_BACK, | |
| 101 | 101 | 0, |
| 102 | 102 | }; |
| 103 | 103 | |
| @@ -1735,7 +1735,6 @@ typedef struct AVCodecContext { · 1734 unmodified lines | ||
| 1735 | 1735 | #define FF_DCT_FASTINT 1 |
| 1736 | 1736 | #define FF_DCT_INT 2 |
| 1737 | 1737 | #define FF_DCT_MMX 3 |
| 1738 | −#define FF_DCT_MLIB 4 | |
| 1739 | 1738 | #define FF_DCT_ALTIVEC 5 |
| 1740 | 1739 | #define FF_DCT_FAAN 6 |
| 1741 | 1740 | |
| @@ -1786,7 +1785,6 @@ typedef struct AVCodecContext { · 44 unmodified lines | ||
| 1786 | 1785 | #define FF_IDCT_SIMPLEMMX 3 |
| 1787 | 1786 | #define FF_IDCT_LIBMPEG2MMX 4 |
| 1788 | 1787 | #define FF_IDCT_PS2 5 |
| 1789 | −#define FF_IDCT_MLIB 6 | |
| 1790 | 1788 | #define FF_IDCT_ARM 7 |
| 1791 | 1789 | #define FF_IDCT_ALTIVEC 8 |
| 1792 | 1790 | #define FF_IDCT_SH4 9 |
| @@ -3960,7 +3958,10 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, · 2167 unmodified lines | ||
| 3960 | 3958 | enum AVSampleFormat sample_fmt, const uint8_t *buf, |
| 3961 | 3959 | int buf_size, int align); |
| 3962 | 3960 | |
| 3961 | +#if FF_API_OLD_ENCODE_VIDEO | |
| 3963 | 3962 | /** |
| 3963 | + * @deprecated use avcodec_encode_video2() instead. | |
| 3964 | + * | |
| 3964 | 3965 | * Encode a video frame from pict into buf. |
| 3965 | 3966 | * The input picture should be |
| 3966 | 3967 | * 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 | ||
| 3972 | 3973 | * @return On error a negative value is returned, on success zero or the number |
| 3973 | 3974 | * of bytes used from the output buffer. |
| 3974 | 3975 | */ |
| 3976 | +attribute_deprecated | |
| 3975 | 3977 | int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
| 3976 | 3978 | 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 | + | |
| 3977 | 4014 | int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
| 3978 | 4015 | const AVSubtitle *sub); |
| 3979 | 4016 | |
| @@ -3184,7 +3184,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) · 3183 unmodified lines | ||
| 3184 | 3184 | |
| 3185 | 3185 | if (HAVE_MMX) dsputil_init_mmx (c, avctx); |
| 3186 | 3186 | if (ARCH_ARM) dsputil_init_arm (c, avctx); |
| 3187 | − if (CONFIG_MLIB) dsputil_init_mlib (c, avctx); | |
| 3188 | 3187 | if (HAVE_VIS) dsputil_init_vis (c, avctx); |
| 3189 | 3188 | if (ARCH_ALPHA) dsputil_init_alpha (c, avctx); |
| 3190 | 3189 | if (ARCH_PPC) dsputil_init_ppc (c, avctx); |
| @@ -644,7 +644,6 @@ static inline int get_penalty_factor(int lambda, int lambda2, int type){ · 643 unmodified lines | ||
| 644 | 644 | void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); |
| 645 | 645 | void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); |
| 646 | 646 | void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); |
| 647 | −void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx); | |
| 648 | 647 | void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx); |
| 649 | 648 | void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx); |
| 650 | 649 | void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); |
| @@ -656,25 +655,9 @@ void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); · 5 unmodified lines | ||
| 656 | 655 | void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); |
| 657 | 656 | void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); |
| 658 | 657 | |
| 659 | − | |
| 660 | −#if ARCH_ARM | |
| 661 | − | |
| 662 | − | |
| 663 | −#if HAVE_NEON | |
| 658 | +#if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMI || HAVE_MMX | |
| 664 | 659 | # 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 | |
| 678 | 661 | # define STRIDE_ALIGN 8 |
| 679 | 662 | #endif |
| 680 | 663 | |
| @@ -361,15 +361,9 @@ int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height) · 360 unmodified lines | ||
| 361 | 361 | AVPicture dummy_pict; |
| 362 | 362 | if(av_image_check_size(width, height, 0, NULL)) |
| 363 | 363 | 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) | |
| 370 | 365 | // do not include palette for these pseudo-paletted formats |
| 371 | 366 | return width * height; |
| 372 | − } | |
| 373 | 367 | return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height); |
| 374 | 368 | } |
| 375 | 369 | |
| @@ -88,12 +88,23 @@ static void X264_log(void *p, int level, const char *fmt, va_list args) · 87 unmodified lines | ||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 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) | |
| 93 | 93 | { |
| 94 | 94 | 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; | |
| 97 | 108 | |
| 98 | 109 | /* Write the SEI as part of the first frame. */ |
| 99 | 110 | 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 | ||
| 108 | 119 | } |
| 109 | 120 | |
| 110 | 121 | 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 | − } | |
| 123 | 122 | memcpy(p, nals[i].p_payload, nals[i].i_payload); |
| 124 | 123 | p += nals[i].i_payload; |
| 125 | 124 | } |
| 126 | 125 | |
| 127 | − return p - buf; | |
| 126 | + return 1; | |
| 128 | 127 | } |
| 129 | 128 | |
| 130 | 129 | static int avfmt2_num_planes(int avfmt) |
| @@ -146,15 +145,13 @@ static int avfmt2_num_planes(int avfmt) · 15 unmodified lines | ||
| 146 | 145 | } |
| 147 | 146 | } |
| 148 | 147 | |
| 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) | |
| 151 | 150 | { |
| 152 | 151 | X264Context *x4 = ctx->priv_data; |
| 153 | − AVFrame *frame = data; | |
| 154 | 152 | x264_nal_t *nal; |
| 155 | − int nnal, i; | |
| 153 | + int nnal, i, ret; | |
| 156 | 154 | x264_picture_t pic_out; |
| 157 | − int bufsize; | |
| 158 | 155 | |
| 159 | 156 | x264_picture_init( &x4->pic ); |
| 160 | 157 | 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 | ||
| 187 | 184 | } |
| 188 | 185 | |
| 189 | 186 | do { |
| 190 | − bufsize = orig_bufsize; | |
| 191 | 187 | if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) |
| 192 | 188 | return -1; |
| 193 | 189 | |
| 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) | |
| 196 | 192 | return -1; |
| 197 | − } while (!bufsize && !frame && x264_encoder_delayed_frames(x4->enc)); | |
| 193 | + } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc)); | |
| 198 | 194 | |
| 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; | |
| 201 | 197 | |
| 202 | 198 | switch (pic_out.i_type) { |
| 203 | 199 | case X264_TYPE_IDR: |
| @@ -213,11 +209,12 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf, · 9 unmodified lines | ||
| 213 | 209 | break; |
| 214 | 210 | } |
| 215 | 211 | |
| 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) | |
| 218 | 214 | x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; |
| 219 | 215 | |
| 220 | − return bufsize; | |
| 216 | + *got_packet = ret; | |
| 217 | + return 0; | |
| 221 | 218 | } |
| 222 | 219 | |
| 223 | 220 | static av_cold int X264_close(AVCodecContext *avctx) |
| @@ -485,16 +482,25 @@ static av_cold int X264_init(AVCodecContext *avctx) · 261 unmodified lines | ||
| 485 | 482 | |
| 486 | 483 | if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { |
| 487 | 484 | x264_nal_t *nal; |
| 485 | + uint8_t *p; | |
| 488 | 486 | int nnal, s, i; |
| 489 | 487 | |
| 490 | 488 | s = x264_encoder_headers(x4->enc, &nal, &nnal); |
| 489 | + avctx->extradata = p = av_malloc(s); | |
| 491 | 490 | |
| 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) { | |
| 494 | 494 | 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; | |
| 498 | 504 | } |
| 499 | 505 | |
| 500 | 506 | return 0; |
| @@ -634,7 +640,7 @@ AVCodec ff_libx264_encoder = { · 133 unmodified lines | ||
| 634 | 640 | .id = CODEC_ID_H264, |
| 635 | 641 | .priv_data_size = sizeof(X264Context), |
| 636 | 642 | .init = X264_init, |
| 637 | − .encode = X264_frame, | |
| 643 | + .encode2 = X264_frame, | |
| 638 | 644 | .close = X264_close, |
| 639 | 645 | .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, |
| 640 | 646 | .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), |
| @@ -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 | −} | |
| @@ -191,8 +191,6 @@ av_cold int ff_dct_common_init(MpegEncContext *s) · 190 unmodified lines | ||
| 191 | 191 | MPV_common_init_mmx(s); |
| 192 | 192 | #elif ARCH_ALPHA |
| 193 | 193 | MPV_common_init_axp(s); |
| 194 | −#elif CONFIG_MLIB | |
| 195 | − MPV_common_init_mlib(s); | |
| 196 | 194 | #elif HAVE_MMI |
| 197 | 195 | MPV_common_init_mmi(s); |
| 198 | 196 | #elif ARCH_ARM |
| @@ -705,7 +705,6 @@ int MPV_encode_end(AVCodecContext *avctx); · 704 unmodified lines | ||
| 705 | 705 | int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data); |
| 706 | 706 | void MPV_common_init_mmx(MpegEncContext *s); |
| 707 | 707 | void MPV_common_init_axp(MpegEncContext *s); |
| 708 | −void MPV_common_init_mlib(MpegEncContext *s); | |
| 709 | 708 | void MPV_common_init_mmi(MpegEncContext *s); |
| 710 | 709 | void MPV_common_init_arm(MpegEncContext *s); |
| 711 | 710 | void MPV_common_init_altivec(MpegEncContext *s); |
| @@ -206,7 +206,6 @@ static const AVOption options[]={ · 205 unmodified lines | ||
| 206 | 206 | {"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"}, |
| 207 | 207 | {"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"}, |
| 208 | 208 | {"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"}, | |
| 210 | 209 | {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"}, |
| 211 | 210 | {"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"}, |
| 212 | 211 | {"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 | ||
| 221 | 220 | {"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, |
| 222 | 221 | {"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, |
| 223 | 222 | {"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"}, | |
| 225 | 223 | {"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, |
| 226 | 224 | {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, |
| 227 | 225 | {"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, |
| @@ -187,8 +187,7 @@ static int raw_decode(AVCodecContext *avctx, · 186 unmodified lines | ||
| 187 | 187 | |
| 188 | 188 | avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height); |
| 189 | 189 | 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)) { | |
| 192 | 191 | frame->data[1]= context->palette; |
| 193 | 192 | } |
| 194 | 193 | if (avctx->pix_fmt == PIX_FMT_PAL8) { |
| @@ -244,18 +244,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, · 243 unmodified lines | ||
| 244 | 244 | |
| 245 | 245 | for (i = 0; i < 4; i++) |
| 246 | 246 | 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 | |
| 259 | 247 | } |
| 260 | 248 | |
| 261 | 249 | 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 | ||
| 1125 | 1113 | } |
| 1126 | 1114 | #endif |
| 1127 | 1115 | |
| 1116 | +#if FF_API_OLD_ENCODE_VIDEO | |
| 1128 | 1117 | int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
| 1129 | 1118 | const AVFrame *pict) |
| 1130 | 1119 | { |
| 1120 | + AVPacket pkt; | |
| 1121 | + int ret, got_packet = 0; | |
| 1122 | + | |
| 1131 | 1123 | if(buf_size < FF_MIN_BUFFER_SIZE){ |
| 1132 | 1124 | av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n"); |
| 1133 | 1125 | return -1; |
| 1134 | 1126 | } |
| 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; | |
| 1141 | 1127 | |
| 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; | |
| 1144 | 1166 | 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; | |
| 1145 | 1217 | } |
| 1146 | 1218 | |
| 1147 | 1219 | int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
| @@ -57,5 +57,8 @@ · 56 unmodified lines | ||
| 57 | 57 | #ifndef FF_API_OLD_ENCODE_AUDIO |
| 58 | 58 | #define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55) |
| 59 | 59 | #endif |
| 60 | +#ifndef FF_API_OLD_ENCODE_VIDEO | |
| 61 | +#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 55) | |
| 62 | +#endif | |
| 60 | 63 | |
| 61 | 64 | #endif /* AVCODEC_VERSION_H */ |
| @@ -968,6 +968,9 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8 · 967 unmodified lines | ||
| 968 | 968 | |
| 969 | 969 | %macro IDCT_DC_DEQUANT 2 |
| 970 | 970 | 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 | |
| 971 | 974 | movq m3, [r1+24] |
| 972 | 975 | movq m2, [r1+16] |
| 973 | 976 | movq m1, [r1+ 8] |
| @@ -1931,6 +1931,9 @@ cglobal pred8x8l_vertical_right_mmxext, 4,5 · 1930 unmodified lines | ||
| 1931 | 1931 | |
| 1932 | 1932 | %macro PRED8x8L_VERTICAL_RIGHT 1 |
| 1933 | 1933 | 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 | |
| 1934 | 1937 | sub r0, r3 |
| 1935 | 1938 | lea r4, [r0+r3*2] |
| 1936 | 1939 | movq mm0, [r0+r3*1-8] |
| @@ -278,7 +278,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 277 unmodified lines | ||
| 278 | 278 | ref2->data[0] += crop->y * ref2->linesize[0]; |
| 279 | 279 | ref2->data[0] += crop->x * crop->max_step[0]; |
| 280 | 280 | |
| 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)) { | |
| 282 | 283 | for (i = 1; i < 3; i ++) { |
| 283 | 284 | if (ref2->data[i]) { |
| 284 | 285 | ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i]; |
| @@ -72,7 +72,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 71 unmodified lines | ||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /* 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) | |
| 76 | 77 | memcpy(outpicref->data[1], outpicref->data[1], 256*4); |
| 77 | 78 | |
| 78 | 79 | avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0)); |
| @@ -212,7 +212,8 @@ static int config_props(AVFilterLink *outlink) · 211 unmodified lines | ||
| 212 | 212 | outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name, |
| 213 | 213 | scale->flags); |
| 214 | 214 | |
| 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; | |
| 216 | 217 | if (outfmt == PIX_FMT_PAL8) outfmt = PIX_FMT_BGR8; |
| 217 | 218 | |
| 218 | 219 | if (scale->sws) |
| @@ -97,6 +97,7 @@ · 96 unmodified lines | ||
| 97 | 97 | #define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) |
| 98 | 98 | #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) |
| 99 | 99 | #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) | |
| 100 | 101 | #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) |
| 101 | 102 | #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) |
| 102 | 103 | |
| @@ -155,7 +155,7 @@ · 154 unmodified lines | ||
| 155 | 155 | |
| 156 | 156 | #define LIBAVUTIL_VERSION_MAJOR 51 |
| 157 | 157 | #define LIBAVUTIL_VERSION_MINOR 38 |
| 158 | −#define LIBAVUTIL_VERSION_MICRO 100 | |
| 158 | +#define LIBAVUTIL_VERSION_MICRO 101 | |
| 159 | 159 | |
| 160 | 160 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| 161 | 161 | LIBAVUTIL_VERSION_MINOR, \ |
| @@ -116,7 +116,8 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh · 115 unmodified lines | ||
| 116 | 116 | return AVERROR(EINVAL); |
| 117 | 117 | size[0] = linesizes[0] * height; |
| 118 | 118 | |
| 119 | − if (desc->flags & PIX_FMT_PAL) { | |
| 119 | + if (desc->flags & PIX_FMT_PAL || | |
| 120 | + desc->flags & PIX_FMT_PSEUDOPAL) { | |
| 120 | 121 | size[0] = (size[0] + 3) & ~3; |
| 121 | 122 | data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */ |
| 122 | 123 | return size[0] + 256 * 4; |
| @@ -204,7 +205,8 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], · 81 unmodified lines | ||
| 204 | 205 | av_free(buf); |
| 205 | 206 | return ret; |
| 206 | 207 | } |
| 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) | |
| 208 | 210 | ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); |
| 209 | 211 | |
| 210 | 212 | return ret; |
| @@ -251,7 +253,8 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], · 40 unmodified lines | ||
| 251 | 253 | if (desc->flags & PIX_FMT_HWACCEL) |
| 252 | 254 | return; |
| 253 | 255 | |
| 254 | − if (desc->flags & PIX_FMT_PAL) { | |
| 256 | + if (desc->flags & PIX_FMT_PAL || | |
| 257 | + desc->flags & PIX_FMT_PSEUDOPAL) { | |
| 255 | 258 | av_image_copy_plane(dst_data[0], dst_linesizes[0], |
| 256 | 259 | src_data[0], src_linesizes[0], |
| 257 | 260 | width, height); |
| @@ -327,7 +327,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 326 unmodified lines | ||
| 327 | 327 | { 0, 0, 1, 3, 2 }, /* G */ |
| 328 | 328 | { 0, 0, 1, 0, 2 }, /* R */ |
| 329 | 329 | }, |
| 330 | − .flags = PIX_FMT_PAL | PIX_FMT_RGB, | |
| 330 | + .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL, | |
| 331 | 331 | }, |
| 332 | 332 | [PIX_FMT_BGR4] = { |
| 333 | 333 | .name = "bgr4", |
| @@ -351,7 +351,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 17 unmodified lines | ||
| 351 | 351 | { 0, 0, 1, 1, 1 }, /* G */ |
| 352 | 352 | { 0, 0, 1, 0, 0 }, /* R */ |
| 353 | 353 | }, |
| 354 | − .flags = PIX_FMT_PAL | PIX_FMT_RGB, | |
| 354 | + .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL, | |
| 355 | 355 | }, |
| 356 | 356 | [PIX_FMT_RGB8] = { |
| 357 | 357 | .name = "rgb8", |
| @@ -363,7 +363,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 5 unmodified lines | ||
| 363 | 363 | { 0, 0, 1, 3, 2 }, /* G */ |
| 364 | 364 | { 0, 0, 1, 0, 2 }, /* B */ |
| 365 | 365 | }, |
| 366 | − .flags = PIX_FMT_PAL | PIX_FMT_RGB, | |
| 366 | + .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL, | |
| 367 | 367 | }, |
| 368 | 368 | [PIX_FMT_RGB4] = { |
| 369 | 369 | .name = "rgb4", |
| @@ -387,7 +387,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 17 unmodified lines | ||
| 387 | 387 | { 0, 0, 1, 1, 1 }, /* G */ |
| 388 | 388 | { 0, 0, 1, 0, 0 }, /* B */ |
| 389 | 389 | }, |
| 390 | − .flags = PIX_FMT_PAL | PIX_FMT_RGB, | |
| 390 | + .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL, | |
| 391 | 391 | }, |
| 392 | 392 | [PIX_FMT_NV12] = { |
| 393 | 393 | .name = "nv12", |
| @@ -89,6 +89,12 @@ typedef struct AVPixFmtDescriptor{ · 88 unmodified lines | ||
| 89 | 89 | #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. |
| 90 | 90 | #define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane |
| 91 | 91 | #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 | |
| 92 | 98 | |
| 93 | 99 | /** |
| 94 | 100 | * The array of all the pixel format descriptors. |
| @@ -40,6 +40,8 @@ · 39 unmodified lines | ||
| 40 | 40 | %if ARCH_X86_64 |
| 41 | 41 | %ifidn __OUTPUT_FORMAT__,win32 |
| 42 | 42 | %define WIN64 1 |
| 43 | + %elifidn __OUTPUT_FORMAT__,win64 | |
| 44 | + %define WIN64 1 | |
| 43 | 45 | %else |
| 44 | 46 | %define UNIX64 1 |
| 45 | 47 | %endif |
| @@ -290,7 +292,11 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56] · 244 unmodified lines | ||
| 290 | 292 | push r5 |
| 291 | 293 | %assign stack_offset stack_offset+16 |
| 292 | 294 | %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 | |
| 294 | 300 | LOAD_IF_USED 4, %1 |
| 295 | 301 | LOAD_IF_USED 5, %1 |
| 296 | 302 | LOAD_IF_USED 6, %1 |
| @@ -299,9 +305,6 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56] · 2 unmodified lines | ||
| 299 | 305 | |
| 300 | 306 | %macro WIN64_SPILL_XMM 1 |
| 301 | 307 | %assign xmm_regs_used %1 |
| 302 | − %if mmsize == 8 | |
| 303 | − %assign xmm_regs_used 0 | |
| 304 | − %endif | |
| 305 | 308 | ASSERT xmm_regs_used <= 16 |
| 306 | 309 | %if xmm_regs_used > 6 |
| 307 | 310 | sub rsp, (xmm_regs_used-6)*16+16 |
| @@ -11,7 +11,6 @@ OBJS = input.o options.o output.o rgb2rgb.o swscale.o \ · 10 unmodified lines | ||
| 11 | 11 | OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \ |
| 12 | 12 | bfin/swscale_bfin.o \ |
| 13 | 13 | bfin/yuv2rgb_bfin.o |
| 14 | −OBJS-$(CONFIG_MLIB) += mlib/yuv2rgb_mlib.o | |
| 15 | 14 | OBJS-$(HAVE_ALTIVEC) += ppc/swscale_altivec.o \ |
| 16 | 15 | ppc/yuv2rgb_altivec.o \ |
| 17 | 16 | ppc/yuv2yuv_altivec.o |
| @@ -29,4 +28,4 @@ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o · 11 unmodified lines | ||
| 29 | 28 | |
| 30 | 29 | TESTPROGS = colorspace swscale |
| 31 | 30 | |
| 32 | −DIRS = bfin mlib ppc sparc x86 | |
| 31 | +DIRS = bfin ppc sparc x86 | |
| @@ -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 | − | |
| @@ -542,7 +542,6 @@ void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufI · 541 unmodified lines | ||
| 542 | 542 | |
| 543 | 543 | SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c); |
| 544 | 544 | SwsFunc ff_yuv2rgb_init_vis(SwsContext *c); |
| 545 | −SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c); | |
| 546 | 545 | SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c); |
| 547 | 546 | SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c); |
| 548 | 547 | void ff_bfin_get_unscaled_swscale(SwsContext *c); |
| @@ -682,7 +681,9 @@ const char *sws_format_name(enum PixelFormat format); · 133 unmodified lines | ||
| 682 | 681 | (av_pix_fmt_descriptors[x].nb_components >= 2 && \ |
| 683 | 682 | (av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR)) |
| 684 | 683 | |
| 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) | |
| 686 | 687 | |
| 687 | 688 | extern const uint64_t ff_dither4[2]; |
| 688 | 689 | extern const uint64_t ff_dither8[2]; |
| @@ -319,6 +319,7 @@ yuv2planeX_fn 10, 7, 5 · 318 unmodified lines | ||
| 319 | 319 | |
| 320 | 320 | %macro yuv2plane1_fn 3 |
| 321 | 321 | cglobal yuv2plane1_%1, %3, %3, %2, src, dst, dstw, dither, offset |
| 322 | + movsxdifnidn dstwq, dstwd | |
| 322 | 323 | add dstwq, mmsize - 1 |
| 323 | 324 | and dstwq, ~(mmsize - 1) |
| 324 | 325 | %if %1 == 8 |
| @@ -511,8 +511,6 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) · 510 unmodified lines | ||
| 511 | 511 | t = ff_yuv2rgb_init_mmx(c); |
| 512 | 512 | } else if (HAVE_VIS) { |
| 513 | 513 | t = ff_yuv2rgb_init_vis(c); |
| 514 | − } else if (CONFIG_MLIB) { | |
| 515 | − t = ff_yuv2rgb_init_mlib(c); | |
| 516 | 514 | } else if (HAVE_ALTIVEC) { |
| 517 | 515 | t = ff_yuv2rgb_init_altivec(c); |
| 518 | 516 | } else if (ARCH_BFIN) { |