History

Merge remote-tracking branch 'qatar/master'

* qatar/master: bitstream: Properly promote av_reverse values before shifting. libavutil/swscale: YUV444P10/YUV444P9 support. H.264: Fix high bit depth explicit biweight h264: Fix 10-bit H.264 x86 chroma v loopfilter asm. Replace DEBUG_SEEK/DEBUG_SI + av_log combinations by av_dlog. Update copyright year for ac3enc_opts_template.c. adts: Adjust frame size mask to follow the specification. movenc: Add RTP muxer/hinter options movenc: Pass the RTP AVFormatContext to the SDP generation rtspenc: Add RTP muxer options rtspenc: Add an AVClass for setting muxer specific options rtpenc_chain: Pass the rtpflags options through to the chained muxer rtpenc: Declare the rtp flags private AVOptions in rtpenc.h sdp: Reindent after the previous commit rtpenc: MP4A-LATM payload support avoptions: Add an av_opt_flag_is_set function for inspecting flag fields sdp: Allow passing an AVFormatContext to the SDP generation mov: Fix wrong timestamp generation for fragmented movies that have time offset caused by the first edit list entry. mpeg12: more advanced ffmpeg mpeg2 aspect guessing code. swscale: split YUYV output out of yuv2packed[12X]_c(). Conflicts: doc/APIchanges libavcodec/Makefile libavcodec/h264dsp_template.c libavcodec/mpeg12.c libavformat/aacdec.c libavformat/avidec.c libavformat/internal.h libavformat/movenc.c libavformat/rtpenc.c libavformat/rtpenc_latm.c libavformat/sdp.c libavformat/version.h libavutil/avutil.h libavutil/pixfmt.h libswscale/swscale.c

Michael Niedermayer committed 15 years ago

Commit 45fb6472 parents 39dbe9b 19d824e34 files · +375 −165Browse files

Unified · Split

34 files
  1. doc/APIchanges +3 −0
  2. libavcodec/Makefile +1 −1
  3. libavcodec/ac3enc_opts_template.c +1 −1
  4. libavcodec/bitstream.c +4 −4
  5. libavcodec/h264dsp_template.c +4 −3
  6. libavcodec/mpeg12.c +7 −9
  7. libavcodec/x86/h264_deblock_10bit.asm +8 −1
  8. libavformat/aacdec.c +1 −1
  9. libavformat/avidec.c +11 −22
  10. libavformat/ffmdec.c +3 −11
  11. libavformat/internal.h +3 −2
  12. libavformat/mov.c +5 −4
  13. libavformat/movenc.c +3 −1
  14. libavformat/movenc.h +1 −0
  15. libavformat/mpeg.c +3 −9
  16. libavformat/mpegenc.c +0 −1
  17. libavformat/mpegts.c +0 −2
  18. libavformat/nsvdec.c +0 −2
  19. libavformat/rtpenc.c +15 −1
  20. libavformat/rtpenc.h +9 −0
  21. libavformat/rtpenc_chain.c +8 −0
  22. libavformat/rtpenc_latm.c +2 −1
  23. libavformat/rtsp.h +5 −0
  24. libavformat/rtspenc.c +15 −0
  25. libavformat/sdp.c +12 −8
  26. libavformat/utils.c +15 −32
  27. libavformat/version.h +1 −1
  28. libavutil/opt.c +10 −0
  29. libavutil/opt.h +10 −0
  30. libavutil/pixdesc.c +46 −0
  31. libavutil/pixfmt.h +9 −3
  32. libswscale/swscale.c +142 −45
  33. libswscale/swscale_internal.h +12 −0
  34. libswscale/utils.c +6 −0
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
17 Add av_opt_flag_is_set().
18
162011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays192011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
17 Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.20 Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.
18 21
libavcodec/Makefile+1−1
@@ -558,7 +558,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ · 557 unmodified lines
558 dirac.o mpeg12data.o vorbis_data.o558 dirac.o mpeg12data.o vorbis_data.o
559OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \559OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \
560 vorbis_data.o560 vorbis_data.o
561OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o561OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o
562OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o562OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
563OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \563OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
564 flacdec.o flacdata.o flac.o \564 flacdec.o flacdata.o flac.o \
libavcodec/ac3enc_opts_template.c+1−1
@@ -1,6 +1,6 @@
1/*1/*
2 * AC-3 encoder options2 * AC-3 encoder options
3 * Copyright (c) 2010 Justin Ruggles <justin.ruggles@gmail.com>3 * Copyright (c) 2011 Justin Ruggles <justin.ruggles@gmail.com>
4 *4 *
5 * This file is part of FFmpeg.5 * This file is part of FFmpeg.
6 *6 *
libavcodec/bitstream.c+4−4
@@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static) · 117 unmodified lines
118}118}
119 119
120static av_always_inline uint32_t bitswap_32(uint32_t x) {120static av_always_inline uint32_t bitswap_32(uint32_t x) {
121 return av_reverse[x&0xFF]<<24121 return (uint32_t)av_reverse[x&0xFF]<<24
122 | av_reverse[(x>>8)&0xFF]<<16122 | (uint32_t)av_reverse[(x>>8)&0xFF]<<16
123 | av_reverse[(x>>16)&0xFF]<<8123 | (uint32_t)av_reverse[(x>>16)&0xFF]<<8
124 | av_reverse[x>>24];124 | (uint32_t)av_reverse[x>>24];
125}125}
126 126
127typedef struct {127typedef struct {
libavcodec/h264dsp_template.c+4−3
@@ -58,11 +58,12 @@ static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *p_block, int strid · 57 unmodified lines
58 op_scale1(15); \58 op_scale1(15); \
59 } \59 } \
60} \60} \
61static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *p_dst, uint8_t *p_src, int stride, int log2_denom, int weightd, int weights, int offset){ \61static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *_dst, uint8_t *_src, int stride, int log2_denom, int weightd, int weights, int offset){ \
62 int y; \62 int y; \
63 pixel *dst = (pixel*)p_dst; \63 pixel *dst = (pixel*)_dst; \
64 pixel *src = (pixel*)p_src; \64 pixel *src = (pixel*)_src; \
65 stride >>= sizeof(pixel)-1; \65 stride >>= sizeof(pixel)-1; \
66 offset <<= (BIT_DEPTH-8); \
66 offset = ((offset + 1) | 1) << log2_denom; \67 offset = ((offset + 1) | 1) << log2_denom; \
67 for(y=0; y<H; y++, dst += stride, src += stride){ \68 for(y=0; y<H; y++, dst += stride, src += stride){ \
68 op_scale2(0); \69 op_scale2(0); \
libavcodec/mpeg12.c+7−9
@@ -1331,19 +1331,17 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ · 1330 unmodified lines
1331 avctx->ticks_per_frame=2;1331 avctx->ticks_per_frame=2;
1332 //MPEG-2 aspect1332 //MPEG-2 aspect
1333 if(s->aspect_ratio_info > 1){1333 if(s->aspect_ratio_info > 1){
1334 AVRational dar=1334 AVRational dar =
1335 av_mul_q(1335 av_mul_q(
1336 av_div_q(1336 av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
1337 ff_mpeg2_aspect[s->aspect_ratio_info],1337 (AVRational){s1->pan_scan.width, s1->pan_scan.height}),
1338 (AVRational){s1->pan_scan.width, s1->pan_scan.height}
1339 ),
1340 (AVRational){s->width, s->height});1338 (AVRational){s->width, s->height});
1341 1339
1342 //we ignore the spec here and guess a bit as reality does not match the spec, see for example1340 // we ignore the spec here and guess a bit as reality does not match the spec, see for example
1343 // res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg1341 // res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg
1344 //issue1613, 621, 5621342 // issue1613, 621, 562
1345 if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0)1343 if((s1->pan_scan.width == 0 ) || (s1->pan_scan.height == 0) ||
1346 || (av_cmp_q(dar,(AVRational){4,3})&&av_cmp_q(dar,(AVRational){16,9}))){1344 (av_cmp_q(dar,(AVRational){4,3}) && av_cmp_q(dar,(AVRational){16,9}))) {
1347 s->avctx->sample_aspect_ratio=1345 s->avctx->sample_aspect_ratio=
1348 av_div_q(1346 av_div_q(
1349 ff_mpeg2_aspect[s->aspect_ratio_info],1347 ff_mpeg2_aspect[s->aspect_ratio_info],
libavcodec/x86/h264_deblock_10bit.asm+8−1
@@ -836,6 +836,13 @@ DEBLOCK_LUMA_INTRA avx · 835 unmodified lines
836 mova [r0+2*r1], m2836 mova [r0+2*r1], m2
837%endmacro837%endmacro
838 838
839%macro CHROMA_V_LOAD_TC 2
840 movd %1, [%2]
841 punpcklbw %1, %1
842 punpcklwd %1, %1
843 psraw %1, 6
844%endmacro
845
839%macro DEBLOCK_CHROMA 1846%macro DEBLOCK_CHROMA 1
840;-----------------------------------------------------------------------------847;-----------------------------------------------------------------------------
841; void deblock_v_chroma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 )848; void deblock_v_chroma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
@@ -854,7 +861,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16) · 12 unmodified lines
854 LOAD_AB m4, m5, r2d, r3d861 LOAD_AB m4, m5, r2d, r3d
855 LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4862 LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
856 pxor m4, m4863 pxor m4, m4
857 LOAD_TC m6, r4864 CHROMA_V_LOAD_TC m6, r4
858 psubw m6, [pw_3]865 psubw m6, [pw_3]
859 pmaxsw m6, m4866 pmaxsw m6, m4
860 pand m7, m6867 pand m7, m6
libavformat/aacdec.c+1−1
@@ -44,7 +44,7 @@ static int adts_aac_probe(AVProbeData *p) · 43 unmodified lines
44 uint32_t header = AV_RB16(buf2);44 uint32_t header = AV_RB16(buf2);
45 if((header&0xFFF6) != 0xFFF0)45 if((header&0xFFF6) != 0xFFF0)
46 break;46 break;
47 fsize = (AV_RB32(buf2+3)>>13) & 0x1FFF;47 fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF;
48 if(fsize < 7)48 if(fsize < 7)
49 break;49 break;
50 buf2 += fsize;50 buf2 += fsize;
libavformat/avidec.c+11−22
@@ -19,9 +19,6 @@ · 18 unmodified lines
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */20 */
21 21
22//#define DEBUG
23//#define DEBUG_SEEK
24
25#include <strings.h>22#include <strings.h>
26#include "libavutil/intreadwrite.h"23#include "libavutil/intreadwrite.h"
27#include "libavutil/bswap.h"24#include "libavutil/bswap.h"
@@ -160,10 +157,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 132 unmodified lines
160 int64_t last_pos= -1;157 int64_t last_pos= -1;
161 int64_t filesize= avio_size(s->pb);158 int64_t filesize= avio_size(s->pb);
162 159
163#ifdef DEBUG_SEEK160 av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
164 av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",161 longs_pre_entry,index_type, entries_in_use, chunk_id, base);
165 longs_pre_entry,index_type, entries_in_use, chunk_id, base);
166#endif
167 162
168 if(stream_id >= s->nb_streams || stream_id < 0)163 if(stream_id >= s->nb_streams || stream_id < 0)
169 return -1;164 return -1;
@@ -1182,10 +1177,8 @@ static int avi_read_idx1(AVFormatContext *s, int size) · 1012 unmodified lines
1182 flags = avio_rl32(pb);1177 flags = avio_rl32(pb);
1183 pos = avio_rl32(pb);1178 pos = avio_rl32(pb);
1184 len = avio_rl32(pb);1179 len = avio_rl32(pb);
1185#if defined(DEBUG_SEEK)1180 av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
1186 av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",1181 i, tag, flags, pos, len);
1187 i, tag, flags, pos, len);
1188#endif
1189 if(i==0 && pos > avi->movi_list)1182 if(i==0 && pos > avi->movi_list)
1190 avi->movi_list= 0; //FIXME better check1183 avi->movi_list= 0; //FIXME better check
1191 pos += avi->movi_list;1184 pos += avi->movi_list;
@@ -1254,22 +1247,18 @@ static int avi_load_index(AVFormatContext *s) · 62 unmodified lines
1254 1247
1255 if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)1248 if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
1256 goto the_end; // maybe truncated file1249 goto the_end; // maybe truncated file
1257#ifdef DEBUG_SEEK1250 av_dlog(s, "movi_end=0x%"PRIx64"\n", avi->movi_end);
1258 av_log(s, AV_LOG_DEBUG, "movi_end=0x%"PRIx64"\n", avi->movi_end);
1259#endif
1260 for(;;) {1251 for(;;) {
1261 if (url_feof(pb))1252 if (url_feof(pb))
1262 break;1253 break;
1263 tag = avio_rl32(pb);1254 tag = avio_rl32(pb);
1264 size = avio_rl32(pb);1255 size = avio_rl32(pb);
1265#ifdef DEBUG_SEEK1256 av_dlog(s, "tag=%c%c%c%c size=0x%x\n",
1266 av_log(s, AV_LOG_DEBUG, "tag=%c%c%c%c size=0x%x\n",1257 tag & 0xff,
1267 tag & 0xff,1258 (tag >> 8) & 0xff,
1268 (tag >> 8) & 0xff,1259 (tag >> 16) & 0xff,
1269 (tag >> 16) & 0xff,1260 (tag >> 24) & 0xff,
1270 (tag >> 24) & 0xff,1261 size);
1271 size);
1272#endif
1273 switch(tag) {1262 switch(tag) {
1274 case MKTAG('i', 'd', 'x', '1'):1263 case MKTAG('i', 'd', 'x', '1'):
1275 if (avi_read_idx1(s, size) < 0)1264 if (avi_read_idx1(s, size) < 0)
libavformat/ffmdec.c+3−11
@@ -163,8 +163,6 @@ static int ffm_read_data(AVFormatContext *s, · 162 unmodified lines
163 return size1 - size;163 return size1 - size;
164}164}
165 165
166//#define DEBUG_SEEK
167
168/* ensure that acutal seeking happens between FFM_PACKET_SIZE166/* ensure that acutal seeking happens between FFM_PACKET_SIZE
169 and file_size - FFM_PACKET_SIZE */167 and file_size - FFM_PACKET_SIZE */
170static void ffm_seek1(AVFormatContext *s, int64_t pos1)168static void ffm_seek1(AVFormatContext *s, int64_t pos1)
@@ -175,9 +173,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) · 4 unmodified lines
175 173
176 pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);174 pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
177 pos = FFMAX(pos, FFM_PACKET_SIZE);175 pos = FFMAX(pos, FFM_PACKET_SIZE);
178#ifdef DEBUG_SEEK176 av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
179 av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
180#endif
181 avio_seek(pb, pos, SEEK_SET);177 avio_seek(pb, pos, SEEK_SET);
182}178}
183 179
@@ -189,9 +185,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) · 5 unmodified lines
189 ffm_seek1(s, pos);185 ffm_seek1(s, pos);
190 avio_skip(pb, 4);186 avio_skip(pb, 4);
191 dts = avio_rb64(pb);187 dts = avio_rb64(pb);
192#ifdef DEBUG_SEEK188 av_dlog(s, "dts=%0.6f\n", dts / 1000000.0);
193 av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
194#endif
195 return dts;189 return dts;
196}190}
197 191
@@ -464,9 +458,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in · 266 unmodified lines
464 int64_t pts_min, pts_max, pts;458 int64_t pts_min, pts_max, pts;
465 double pos1;459 double pos1;
466 460
467#ifdef DEBUG_SEEK461 av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
468 av_log(s, AV_LOG_DEBUG, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
469#endif
470 /* find the position using linear interpolation (better than462 /* find the position using linear interpolation (better than
471 dichotomy in typical cases) */463 dichotomy in typical cases) */
472 pos_min = FFM_PACKET_SIZE;464 pos_min = FFM_PACKET_SIZE;
libavformat/internal.h+3−2
@@ -122,11 +122,12 @@ int ff_url_join(char *str, int size, const char *proto, · 121 unmodified lines
122 * @param dest_type the destination address type, may be NULL122 * @param dest_type the destination address type, may be NULL
123 * @param port the destination port of the media stream, 0 if unknown123 * @param port the destination port of the media stream, 0 if unknown
124 * @param ttl the time to live of the stream, 0 if not multicast124 * @param ttl the time to live of the stream, 0 if not multicast
125 * @param flags the AVFormatContext->flags, modifying the generated SDP125 * @param fmt the AVFormatContext, which might contain options modifying
126 * the generated SDP
126 */127 */
127void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,128void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
128 const char *dest_addr, const char *dest_type,129 const char *dest_addr, const char *dest_type,
129 int port, int ttl, int flags);130 int port, int ttl, AVFormatContext *fmt);
130 131
131/**132/**
132 * Write a packet to another muxer than the one the user originally133 * Write a packet to another muxer than the one the user originally
libavformat/mov.c+5−4
@@ -1537,8 +1537,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st) · 1536 unmodified lines
1537 1537
1538 /* adjust first dts according to edit list */1538 /* adjust first dts according to edit list */
1539 if (sc->time_offset && mov->time_scale > 0) {1539 if (sc->time_offset && mov->time_scale > 0) {
1540 int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset;1540 if (sc->time_offset < 0)
1541 current_dts = -rescaled;1541 sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale);
1542 current_dts = -sc->time_offset;
1542 if (sc->ctts_data && sc->stts_data &&1543 if (sc->ctts_data && sc->stts_data &&
1543 sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {1544 sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {
1544 /* more than 16 frames delay, dts are likely wrong1545 /* more than 16 frames delay, dts are likely wrong
@@ -2072,7 +2073,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 527 unmodified lines
2072 2073
2073 if (flags & 0x001) data_offset = avio_rb32(pb);2074 if (flags & 0x001) data_offset = avio_rb32(pb);
2074 if (flags & 0x004) first_sample_flags = avio_rb32(pb);2075 if (flags & 0x004) first_sample_flags = avio_rb32(pb);
2075 dts = st->duration;2076 dts = st->duration - sc->time_offset;
2076 offset = frag->base_data_offset + data_offset;2077 offset = frag->base_data_offset + data_offset;
2077 distance = 0;2078 distance = 0;
2078 av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);2079 av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
@@ -2101,7 +2102,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 22 unmodified lines
2101 offset += sample_size;2102 offset += sample_size;
2102 }2103 }
2103 frag->moof_offset = offset;2104 frag->moof_offset = offset;
2104 st->duration = dts;2105 st->duration = dts + sc->time_offset;
2105 return 0;2106 return 0;
2106}2107}
2107 2108
libavformat/movenc.c+3−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include "libavutil/avstring.h"34#include "libavutil/avstring.h"
35#include "libavutil/opt.h"35#include "libavutil/opt.h"
36#include "libavutil/dict.h"36#include "libavutil/dict.h"
37#include "rtpenc.h"
37 38
38#undef NDEBUG39#undef NDEBUG
39#include <assert.h>40#include <assert.h>
@@ -41,6 +42,7 @@ · 1 unmodified line
41static const AVOption options[] = {42static const AVOption options[] = {
42 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },43 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
43 { "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },44 { "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
45 FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
44 { NULL },46 { NULL },
45};47};
46 48
@@ -1368,7 +1370,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index) · 1321 unmodified lines
1368 char buf[1000] = "";1370 char buf[1000] = "";
1369 int len;1371 int len;
1370 1372
1371 ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx->flags);1373 ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx);
1372 av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);1374 av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
1373 len = strlen(buf);1375 len = strlen(buf);
1374 1376
libavformat/movenc.h+1−0
@@ -111,6 +111,7 @@ typedef struct MOVMuxContext { · 110 unmodified lines
111 MOVTrack *tracks;111 MOVTrack *tracks;
112 112
113 int flags;113 int flags;
114 int rtp_flags;
114} MOVMuxContext;115} MOVMuxContext;
115 116
116#define FF_MOV_FLAG_RTP_HINT 1117#define FF_MOV_FLAG_RTP_HINT 1
libavformat/mpeg.c+3−9
@@ -23,8 +23,6 @@ · 22 unmodified lines
23#include "internal.h"23#include "internal.h"
24#include "mpeg.h"24#include "mpeg.h"
25 25
26//#define DEBUG_SEEK
27
28#undef NDEBUG26#undef NDEBUG
29#include <assert.h>27#include <assert.h>
30 28
@@ -592,9 +590,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, · 561 unmodified lines
592 for(;;) {590 for(;;) {
593 len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);591 len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
594 if (len < 0) {592 if (len < 0) {
595#ifdef DEBUG_SEEK593 av_dlog(s, "none (ret=%d)\n", len);
596 av_log(s, AV_LOG_DEBUG, "none (ret=%d)\n", len);
597#endif
598 return AV_NOPTS_VALUE;594 return AV_NOPTS_VALUE;
599 }595 }
600 if (startcode == s->streams[stream_index]->id &&596 if (startcode == s->streams[stream_index]->id &&
@@ -603,10 +599,8 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, · 2 unmodified lines
603 }599 }
604 avio_skip(s->pb, len);600 avio_skip(s->pb, len);
605 }601 }
606#ifdef DEBUG_SEEK602 av_dlog(s, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
607 av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",603 pos, dts, dts / 90000.0);
608 pos, dts, dts / 90000.0);
609#endif
610 *ppos = pos;604 *ppos = pos;
611 return dts;605 return dts;
612}606}
libavformat/mpegenc.c+0−1
@@ -25,7 +25,6 @@ · 24 unmodified lines
25#include "mpeg.h"25#include "mpeg.h"
26 26
27#define MAX_PAYLOAD_SIZE 409627#define MAX_PAYLOAD_SIZE 4096
28//#define DEBUG_SEEK
29 28
30#undef NDEBUG29#undef NDEBUG
31#include <assert.h>30#include <assert.h>
libavformat/mpegts.c+0−2
@@ -19,8 +19,6 @@ · 18 unmodified lines
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */20 */
21 21
22//#define DEBUG
23//#define DEBUG_SEEK
24//#define USE_SYNCPOINT_SEARCH22//#define USE_SYNCPOINT_SEARCH
25 23
26#include "libavutil/crc.h"24#include "libavutil/crc.h"
libavformat/nsvdec.c+0−2
@@ -22,9 +22,7 @@ · 21 unmodified lines
22#include "riff.h"22#include "riff.h"
23#include "libavutil/dict.h"23#include "libavutil/dict.h"
24 24
25//#define DEBUG
26//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!25//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!
27//#define DEBUG_SEEK
28#define CHECK_SUBSEQUENT_NSVS26#define CHECK_SUBSEQUENT_NSVS
29//#define DISABLE_AUDIO27//#define DISABLE_AUDIO
30 28
libavformat/rtpenc.c+15−1
@@ -23,11 +23,24 @@ · 22 unmodified lines
23#include "mpegts.h"23#include "mpegts.h"
24#include "internal.h"24#include "internal.h"
25#include "libavutil/random_seed.h"25#include "libavutil/random_seed.h"
26#include "libavutil/opt.h"
26 27
27#include "rtpenc.h"28#include "rtpenc.h"
28 29
29//#define DEBUG30//#define DEBUG
30 31
32static const AVOption options[] = {
33 FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
34 { NULL },
35};
36
37static const AVClass rtp_muxer_class = {
38 .class_name = "RTP muxer",
39 .item_name = av_default_item_name,
40 .option = options,
41 .version = LIBAVUTIL_VERSION_INT,
42};
43
31#define RTCP_SR_SIZE 2844#define RTCP_SR_SIZE 28
32 45
33static int is_supported(enum CodecID id)46static int is_supported(enum CodecID id)
@@ -404,7 +417,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) · 370 unmodified lines
404 ff_rtp_send_mpegvideo(s1, pkt->data, size);417 ff_rtp_send_mpegvideo(s1, pkt->data, size);
405 break;418 break;
406 case CODEC_ID_AAC:419 case CODEC_ID_AAC:
407 if (s1->flags & AVFMT_FLAG_MP4A_LATM)420 if (s->flags & FF_RTP_FLAG_MP4A_LATM)
408 ff_rtp_send_latm(s1, pkt->data, size);421 ff_rtp_send_latm(s1, pkt->data, size);
409 else422 else
410 ff_rtp_send_aac(s1, pkt->data, size);423 ff_rtp_send_aac(s1, pkt->data, size);
@@ -458,4 +471,5 @@ AVOutputFormat ff_rtp_muxer = { · 47 unmodified lines
458 rtp_write_header,471 rtp_write_header,
459 rtp_write_packet,472 rtp_write_packet,
460 rtp_write_trailer,473 rtp_write_trailer,
474 .priv_class = &rtp_muxer_class,
461};475};
libavformat/rtpenc.h+9−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
25#include "rtp.h"25#include "rtp.h"
26 26
27struct RTPMuxContext {27struct RTPMuxContext {
28 const AVClass *av_class;
28 AVFormatContext *ic;29 AVFormatContext *ic;
29 AVStream *st;30 AVStream *st;
30 int payload_type;31 int payload_type;
@@ -56,10 +57,18 @@ struct RTPMuxContext { · 25 unmodified lines
56 * (1, 2 or 4)57 * (1, 2 or 4)
57 */58 */
58 int nal_length_size;59 int nal_length_size;
60
61 int flags;
59};62};
60 63
61typedef struct RTPMuxContext RTPMuxContext;64typedef struct RTPMuxContext RTPMuxContext;
62 65
66#define FF_RTP_FLAG_MP4A_LATM 1
67
68#define FF_RTP_FLAG_OPTS(ctx, fieldname) \
69 { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
70 { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, FF_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \
71
63void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);72void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
64 73
65void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);74void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
libavformat/rtpenc_chain.c+8−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
23#include "avio_internal.h"23#include "avio_internal.h"
24#include "rtpenc_chain.h"24#include "rtpenc_chain.h"
25#include "avio_internal.h"25#include "avio_internal.h"
26#include "libavutil/opt.h"
26 27
27AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,28AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
28 URLContext *handle, int packet_size)29 URLContext *handle, int packet_size)
@@ -50,6 +51,13 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, · 21 unmodified lines
50 rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;51 rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
51 rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM;52 rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM;
52 53
54 av_set_parameters(rtpctx, NULL);
55 /* Copy the rtpflags values straight through */
56 if (s->oformat->priv_class &&
57 av_find_opt(s->priv_data, "rtpflags", NULL, 0, 0))
58 av_set_int(rtpctx->priv_data, "rtpflags",
59 av_get_int(s->priv_data, "rtpflags", NULL));
60
53 /* Set the synchronized start time. */61 /* Set the synchronized start time. */
54 rtpctx->start_time_realtime = s->start_time_realtime;62 rtpctx->start_time_realtime = s->start_time_realtime;
55 63
libavformat/rtpenc_latm.c+2−1
@@ -22,7 +22,8 @@ · 21 unmodified lines
22#include "avformat.h"22#include "avformat.h"
23#include "rtpenc.h"23#include "rtpenc.h"
24 24
25void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size) {25void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size)
26{
26 /* MP4A-LATM27 /* MP4A-LATM
27 * The RTP payload format specification is described in RFC 301628 * The RTP payload format specification is described in RFC 3016
28 * The encoding specifications are provided in ISO/IEC 14496-3 */29 * The encoding specifications are provided in ISO/IEC 14496-3 */
libavformat/rtsp.h+5−0
@@ -344,6 +344,11 @@ typedef struct RTSPState { · 343 unmodified lines
344 * Do not begin to play the stream immediately.344 * Do not begin to play the stream immediately.
345 */345 */
346 int initial_pause;346 int initial_pause;
347
348 /**
349 * Option flags for the chained RTP muxer.
350 */
351 int rtp_muxer_flags;
347} RTSPState;352} RTSPState;
348 353
349/**354/**
libavformat/rtspenc.c+15−0
@@ -33,9 +33,23 @@ · 32 unmodified lines
33#include "libavutil/intreadwrite.h"33#include "libavutil/intreadwrite.h"
34#include "libavutil/avstring.h"34#include "libavutil/avstring.h"
35#include "url.h"35#include "url.h"
36#include "libavutil/opt.h"
37#include "rtpenc.h"
36 38
37#define SDP_MAX_SIZE 1638439#define SDP_MAX_SIZE 16384
38 40
41static const AVOption options[] = {
42 FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
43 { NULL },
44};
45
46static const AVClass rtsp_muxer_class = {
47 .class_name = "RTSP muxer",
48 .item_name = av_default_item_name,
49 .option = options,
50 .version = LIBAVUTIL_VERSION_INT,
51};
52
39int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)53int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
40{54{
41 RTSPState *rt = s->priv_data;55 RTSPState *rt = s->priv_data;
@@ -238,5 +252,6 @@ AVOutputFormat ff_rtsp_muxer = { · 196 unmodified lines
238 rtsp_write_packet,252 rtsp_write_packet,
239 rtsp_write_close,253 rtsp_write_close,
240 .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,254 .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
255 .priv_class = &rtsp_muxer_class,
241};256};
242 257
libavformat/sdp.c+12−8
@@ -23,6 +23,7 @@ · 22 unmodified lines
23#include "libavutil/base64.h"23#include "libavutil/base64.h"
24#include "libavutil/dict.h"24#include "libavutil/dict.h"
25#include "libavutil/parseutils.h"25#include "libavutil/parseutils.h"
26#include "libavutil/opt.h"
26#include "libavcodec/xiph.h"27#include "libavcodec/xiph.h"
27#include "libavcodec/mpeg4audio.h"28#include "libavcodec/mpeg4audio.h"
28#include "avformat.h"29#include "avformat.h"
@@ -301,7 +302,8 @@ xiph_fail: · 272 unmodified lines
301 return NULL;302 return NULL;
302}303}
303 304
304static int latm_context2profilelevel(AVCodecContext *c) {305static int latm_context2profilelevel(AVCodecContext *c)
306{
305 /* MP4A-LATM307 /* MP4A-LATM
306 * The RTP payload format specification is described in RFC 3016308 * The RTP payload format specification is described in RFC 3016
307 * The encoding specifications are provided in ISO/IEC 14496-3 */309 * The encoding specifications are provided in ISO/IEC 14496-3 */
@@ -329,7 +331,8 @@ static int latm_context2profilelevel(AVCodecContext *c) { · 21 unmodified lines
329 return profile_level;331 return profile_level;
330}332}
331 333
332static char *latm_context2config(AVCodecContext *c) {334static char *latm_context2config(AVCodecContext *c)
335{
333 /* MP4A-LATM336 /* MP4A-LATM
334 * The RTP payload format specification is described in RFC 3016337 * The RTP payload format specification is described in RFC 3016
335 * The encoding specifications are provided in ISO/IEC 14496-3 */338 * The encoding specifications are provided in ISO/IEC 14496-3 */
@@ -364,7 +367,7 @@ static char *latm_context2config(AVCodecContext *c) { · 28 unmodified lines
364 return config;367 return config;
365}368}
366 369
367static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, int flags)370static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, AVFormatContext *fmt)
368{371{
369 char *config = NULL;372 char *config = NULL;
370 373
@@ -399,7 +402,8 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, · 28 unmodified lines
399 payload_type, config ? config : "");402 payload_type, config ? config : "");
400 break;403 break;
401 case CODEC_ID_AAC:404 case CODEC_ID_AAC:
402 if (flags & AVFMT_FLAG_MP4A_LATM) {405 if (fmt && fmt->oformat->priv_class &&
406 av_opt_flag_is_set(fmt->priv_data, "rtpflags", "latm")) {
403 config = latm_context2config(c);407 config = latm_context2config(c);
404 if (!config)408 if (!config)
405 return NULL;409 return NULL;
@@ -523,7 +527,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, · 117 unmodified lines
523 return buff;527 return buff;
524}528}
525 529
526void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags)530void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
527{531{
528 const char *type;532 const char *type;
529 int payload_type;533 int payload_type;
@@ -546,7 +550,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des · 16 unmodified lines
546 av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000);550 av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000);
547 }551 }
548 552
549 sdp_write_media_attributes(buff, size, c, payload_type, flags);553 sdp_write_media_attributes(buff, size, c, payload_type, fmt);
550}554}
551 555
552int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)556int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
@@ -596,7 +600,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) · 43 unmodified lines
596 ff_sdp_write_media(buf, size,600 ff_sdp_write_media(buf, size,
597 ac[i]->streams[j]->codec, dst[0] ? dst : NULL,601 ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
598 dst_type, (port > 0) ? port + j * 2 : 0, ttl,602 dst_type, (port > 0) ? port + j * 2 : 0, ttl,
599 ac[i]->flags);603 ac[i]);
600 if (port <= 0) {604 if (port <= 0) {
601 av_strlcatf(buf, size,605 av_strlcatf(buf, size,
602 "a=control:streamid=%d\r\n", i + j);606 "a=control:streamid=%d\r\n", i + j);
@@ -612,7 +616,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) · 9 unmodified lines
612 return AVERROR(ENOSYS);616 return AVERROR(ENOSYS);
613}617}
614 618
615void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags)619void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
616{620{
617}621}
618#endif622#endif
libavformat/utils.c+15−32
@@ -1449,8 +1449,6 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, · 1448 unmodified lines
1449 wanted_timestamp, flags);1449 wanted_timestamp, flags);
1450}1450}
1451 1451
1452#define DEBUG_SEEK
1453
1454int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){1452int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
1455 AVInputFormat *avif= s->iformat;1453 AVInputFormat *avif= s->iformat;
1456 int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;1454 int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
@@ -1462,9 +1460,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts · 5 unmodified lines
1462 if (stream_index < 0)1460 if (stream_index < 0)
1463 return -1;1461 return -1;
1464 1462
1465#ifdef DEBUG_SEEK1463 av_dlog(s, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
1466 av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
1467#endif
1468 1464
1469 ts_max=1465 ts_max=
1470 ts_min= AV_NOPTS_VALUE;1466 ts_min= AV_NOPTS_VALUE;
@@ -1481,10 +1477,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts · 10 unmodified lines
1481 if(e->timestamp <= target_ts || e->pos == e->min_distance){1477 if(e->timestamp <= target_ts || e->pos == e->min_distance){
1482 pos_min= e->pos;1478 pos_min= e->pos;
1483 ts_min= e->timestamp;1479 ts_min= e->timestamp;
1484#ifdef DEBUG_SEEK1480 av_dlog(s, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
1485 av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",1481 pos_min,ts_min);
1486 pos_min,ts_min);
1487#endif
1488 }else{1482 }else{
1489 assert(index==0);1483 assert(index==0);
1490 }1484 }
@@ -1497,10 +1491,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts · 6 unmodified lines
1497 pos_max= e->pos;1491 pos_max= e->pos;
1498 ts_max= e->timestamp;1492 ts_max= e->timestamp;
1499 pos_limit= pos_max - e->min_distance;1493 pos_limit= pos_max - e->min_distance;
1500#ifdef DEBUG_SEEK1494 av_dlog(s, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
1501 av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",1495 pos_max,pos_limit, ts_max);
1502 pos_max,pos_limit, ts_max);
1503#endif
1504 }1496 }
1505 }1497 }
1506 1498
@@ -1522,9 +1514,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i · 15 unmodified lines
1522 int64_t start_pos, filesize;1514 int64_t start_pos, filesize;
1523 int no_change;1515 int no_change;
1524 1516
1525#ifdef DEBUG_SEEK1517 av_dlog(s, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
1526 av_log(s, AV_LOG_DEBUG, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
1527#endif
1528 1518
1529 if(ts_min == AV_NOPTS_VALUE){1519 if(ts_min == AV_NOPTS_VALUE){
1530 pos_min = s->data_offset;1520 pos_min = s->data_offset;
@@ -1566,11 +1556,8 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i · 35 unmodified lines
1566 1556
1567 no_change=0;1557 no_change=0;
1568 while (pos_min < pos_limit) {1558 while (pos_min < pos_limit) {
1569#ifdef DEBUG_SEEK1559 av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",
1570 av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",1560 pos_min, pos_max, ts_min, ts_max);
1571 pos_min, pos_max,
1572 ts_min, ts_max);
1573#endif
1574 assert(pos_limit <= pos_max);1561 assert(pos_limit <= pos_max);
1575 1562
1576 if(no_change==0){1563 if(no_change==0){
@@ -1597,11 +1584,9 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i · 20 unmodified lines
1597 no_change++;1584 no_change++;
1598 else1585 else
1599 no_change=0;1586 no_change=0;
1600#ifdef DEBUG_SEEK1587 av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n",
1601 av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n",1588 pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts,
1602 pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit,1589 pos_limit, start_pos, no_change);
1603 start_pos, no_change);
1604#endif
1605 if(ts == AV_NOPTS_VALUE){1590 if(ts == AV_NOPTS_VALUE){
1606 av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n");1591 av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n");
1607 return -1;1592 return -1;
@@ -1620,13 +1605,13 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i · 12 unmodified lines
1620 1605
1621 pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;1606 pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
1622 ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max;1607 ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max;
1623#ifdef DEBUG_SEEK1608#if 1
1624 pos_min = pos;1609 pos_min = pos;
1625 ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX);1610 ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
1626 pos_min++;1611 pos_min++;
1627 ts_max = read_timestamp(s, stream_index, &pos_min, INT64_MAX);1612 ts_max = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
1628 av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",1613 av_dlog(s, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",
1629 pos, ts_min, target_ts, ts_max);1614 pos, ts_min, target_ts, ts_max);
1630#endif1615#endif
1631 *ts_ret= ts;1616 *ts_ret= ts;
1632 return pos;1617 return pos;
@@ -2694,9 +2679,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id) · 1061 unmodified lines
2694 AVProgram *program=NULL;2679 AVProgram *program=NULL;
2695 int i;2680 int i;
2696 2681
2697#ifdef DEBUG_SI2682 av_dlog(ac, "new_program: id=0x%04x\n", id);
2698 av_log(ac, AV_LOG_DEBUG, "new_program: id=0x%04x\n", id);
2699#endif
2700 2683
2701 for(i=0; i<ac->nb_programs; i++)2684 for(i=0; i<ac->nb_programs; i++)
2702 if(ac->programs[i]->id == id)2685 if(ac->programs[i]->id == id)
libavformat/version.h+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
25 25
26#define LIBAVFORMAT_VERSION_MAJOR 5326#define LIBAVFORMAT_VERSION_MAJOR 53
27#define LIBAVFORMAT_VERSION_MINOR 327#define LIBAVFORMAT_VERSION_MINOR 3
28#define LIBAVFORMAT_VERSION_MICRO 028#define LIBAVFORMAT_VERSION_MICRO 1
29 29
30#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \30#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
31 LIBAVFORMAT_VERSION_MINOR, \31 LIBAVFORMAT_VERSION_MINOR, \
libavutil/opt.c+10−0
@@ -320,6 +320,16 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) · 319 unmodified lines
320 return num*intnum/den;320 return num*intnum/den;
321}321}
322 322
323int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
324{
325 const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0);
326 const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0);
327
328 if (!field || !flag || flag->type != FF_OPT_TYPE_CONST)
329 return 0;
330 return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl;
331}
332
323static void opt_list(void *obj, void *av_log_obj, const char *unit,333static void opt_list(void *obj, void *av_log_obj, const char *unit,
324 int req_flags, int rej_flags)334 int req_flags, int rej_flags)
325{335{
libavutil/opt.h+10−0
@@ -181,4 +181,14 @@ int av_set_options_string(void *ctx, const char *opts, · 180 unmodified lines
181 */181 */
182void av_opt_free(void *obj);182void av_opt_free(void *obj);
183 183
184/**
185 * Check whether a particular flag is set in a flags field.
186 *
187 * @param field_name the name of the flag field option
188 * @param flag_name the name of the flag to check
189 * @return non-zero if the flag is set, zero if the flag isn't set,
190 * isn't of the right type, or the flags field doesn't exist.
191 */
192int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
193
184#endif /* AVUTIL_OPT_H */194#endif /* AVUTIL_OPT_H */
libavutil/pixdesc.c+46−0
@@ -878,6 +878,52 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 877 unmodified lines
878 },878 },
879 .flags = PIX_FMT_BE,879 .flags = PIX_FMT_BE,
880 },880 },
881 [PIX_FMT_YUV444P10LE] = {
882 .name = "yuv444p10le",
883 .nb_components= 3,
884 .log2_chroma_w= 0,
885 .log2_chroma_h= 0,
886 .comp = {
887 {0,1,1,0,9}, /* Y */
888 {1,1,1,0,9}, /* U */
889 {2,1,1,0,9}, /* V */
890 },
891 },
892 [PIX_FMT_YUV444P10BE] = {
893 .name = "yuv444p10be",
894 .nb_components= 3,
895 .log2_chroma_w= 0,
896 .log2_chroma_h= 0,
897 .comp = {
898 {0,1,1,0,9}, /* Y */
899 {1,1,1,0,9}, /* U */
900 {2,1,1,0,9}, /* V */
901 },
902 .flags = PIX_FMT_BE,
903 },
904 [PIX_FMT_YUV444P9LE] = {
905 .name = "yuv444p9le",
906 .nb_components= 3,
907 .log2_chroma_w= 0,
908 .log2_chroma_h= 0,
909 .comp = {
910 {0,1,1,0,8}, /* Y */
911 {1,1,1,0,8}, /* U */
912 {2,1,1,0,8}, /* V */
913 },
914 },
915 [PIX_FMT_YUV444P9BE] = {
916 .name = "yuv444p9be",
917 .nb_components= 3,
918 .log2_chroma_w= 0,
919 .log2_chroma_h= 0,
920 .comp = {
921 {0,1,1,0,9}, /* Y */
922 {1,1,1,0,9}, /* U */
923 {2,1,1,0,9}, /* V */
924 },
925 .flags = PIX_FMT_BE,
926 },
881 [PIX_FMT_DXVA2_VLD] = {927 [PIX_FMT_DXVA2_VLD] = {
882 .name = "dxva2_vld",928 .name = "dxva2_vld",
883 .log2_chroma_w = 1,929 .log2_chroma_w = 1,
libavutil/pixfmt.h+9−3
@@ -136,15 +136,19 @@ enum PixelFormat { · 135 unmodified lines
136 PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian136 PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
137 PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian137 PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
138 138
139 //the following 6 formats have the disadvantage of needing 1 format for each bit depth, thus139 //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus
140 //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately140 //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately
141 //is better141 //is better
142 PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian142 PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
143 PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian143 PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
144 PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian144 PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
145 PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian145 PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
146 PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian146 PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
147 PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian147 PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
148 PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
149 PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
150 PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
151 PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
148 152
149 PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions153 PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
150};154};
@@ -173,8 +177,10 @@ enum PixelFormat { · 22 unmodified lines
173#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)177#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
174 178
175#define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE)179#define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
180#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
176#define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE)181#define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
177#define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE)182#define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
183#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
178#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)184#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
179#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)185#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
180#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)186#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
libswscale/swscale.c+142−45
@@ -724,7 +724,117 @@ yuv2mono_1_c_template(SwsContext *c, const uint16_t *buf0, · 723 unmodified lines
724YUV2PACKEDWRAPPER(yuv2mono, white, PIX_FMT_MONOWHITE);724YUV2PACKEDWRAPPER(yuv2mono, white, PIX_FMT_MONOWHITE);
725YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK);725YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK);
726 726
727#define YSCALE_YUV_2_PACKEDX_C(type,alpha) \727static av_always_inline void
728yuv2422_X_c_template(SwsContext *c, const int16_t *lumFilter,
729 const int16_t **lumSrc, int lumFilterSize,
730 const int16_t *chrFilter, const int16_t **chrUSrc,
731 const int16_t **chrVSrc, int chrFilterSize,
732 const int16_t **alpSrc, uint8_t *dest, int dstW,
733 int y, enum PixelFormat target)
734{
735 int i;
736
737#define output_pixels(pos, Y1, U, Y2, V) \
738 if (target == PIX_FMT_YUYV422) { \
739 dest[pos + 0] = Y1; \
740 dest[pos + 1] = U; \
741 dest[pos + 2] = Y2; \
742 dest[pos + 3] = V; \
743 } else { \
744 dest[pos + 0] = U; \
745 dest[pos + 1] = Y1; \
746 dest[pos + 2] = V; \
747 dest[pos + 3] = Y2; \
748 }
749
750 for (i = 0; i < (dstW >> 1); i++) {
751 int j;
752 int Y1 = 1 << 18;
753 int Y2 = 1 << 18;
754 int U = 1 << 18;
755 int V = 1 << 18;
756
757 for (j = 0; j < lumFilterSize; j++) {
758 Y1 += lumSrc[j][i * 2] * lumFilter[j];
759 Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
760 }
761 for (j = 0; j < chrFilterSize; j++) {
762 U += chrUSrc[j][i] * chrFilter[j];
763 V += chrVSrc[j][i] * chrFilter[j];
764 }
765 Y1 >>= 19;
766 Y2 >>= 19;
767 U >>= 19;
768 V >>= 19;
769 if ((Y1 | Y2 | U | V) & 0x100) {
770 Y1 = av_clip_uint8(Y1);
771 Y2 = av_clip_uint8(Y2);
772 U = av_clip_uint8(U);
773 V = av_clip_uint8(V);
774 }
775 output_pixels(4*i, Y1, U, Y2, V);
776 }
777}
778
779static av_always_inline void
780yuv2422_2_c_template(SwsContext *c, const uint16_t *buf0,
781 const uint16_t *buf1, const uint16_t *ubuf0,
782 const uint16_t *ubuf1, const uint16_t *vbuf0,
783 const uint16_t *vbuf1, const uint16_t *abuf0,
784 const uint16_t *abuf1, uint8_t *dest, int dstW,
785 int yalpha, int uvalpha, int y,
786 enum PixelFormat target)
787{
788 int yalpha1 = 4095 - yalpha;
789 int uvalpha1 = 4095 - uvalpha;
790 int i;
791
792 for (i = 0; i < (dstW >> 1); i++) {
793 int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
794 int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
795 int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
796 int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
797
798 output_pixels(i * 4, Y1, U, Y2, V);
799 }
800}
801
802static av_always_inline void
803yuv2422_1_c_template(SwsContext *c, const uint16_t *buf0,
804 const uint16_t *ubuf0, const uint16_t *ubuf1,
805 const uint16_t *vbuf0, const uint16_t *vbuf1,
806 const uint16_t *abuf0, uint8_t *dest, int dstW,
807 int uvalpha, enum PixelFormat dstFormat,
808 int flags, int y, enum PixelFormat target)
809{
810 int i;
811
812 if (uvalpha < 2048) {
813 for (i = 0; i < (dstW >> 1); i++) {
814 int Y1 = buf0[i * 2] >> 7;
815 int Y2 = buf0[i * 2 + 1] >> 7;
816 int U = ubuf1[i] >> 7;
817 int V = vbuf1[i] >> 7;
818
819 output_pixels(i * 4, Y1, U, Y2, V);
820 }
821 } else {
822 for (i = 0; i < (dstW >> 1); i++) {
823 int Y1 = buf0[i * 2] >> 7;
824 int Y2 = buf0[i * 2 + 1] >> 7;
825 int U = (ubuf0[i] + ubuf1[i]) >> 8;
826 int V = (vbuf0[i] + vbuf1[i]) >> 8;
827
828 output_pixels(i * 4, Y1, U, Y2, V);
829 }
830 }
831#undef output_pixels
832}
833
834YUV2PACKEDWRAPPER(yuv2422, yuyv, PIX_FMT_YUYV422);
835YUV2PACKEDWRAPPER(yuv2422, uyvy, PIX_FMT_UYVY422);
836
837#define YSCALE_YUV_2_RGBX_C(type,alpha) \
728 for (i=0; i<(dstW>>1); i++) {\838 for (i=0; i<(dstW>>1); i++) {\
729 int j;\839 int j;\
730 int Y1 = 1<<18;\840 int Y1 = 1<<18;\
@@ -766,7 +876,11 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 35 unmodified lines
766 A1 = av_clip_uint8(A1); \876 A1 = av_clip_uint8(A1); \
767 A2 = av_clip_uint8(A2); \877 A2 = av_clip_uint8(A2); \
768 }\878 }\
769 }879 }\
880 /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/\
881 r = (type *)c->table_rV[V]; \
882 g = (type *)(c->table_gU[U] + c->table_gV[V]); \
883 b = (type *)c->table_bU[U];
770 884
771#define YSCALE_YUV_2_RGBX_FULL_C(rnd,alpha) \885#define YSCALE_YUV_2_RGBX_FULL_C(rnd,alpha) \
772 for (i=0; i<dstW; i++) {\886 for (i=0; i<dstW; i++) {\
@@ -807,13 +921,7 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 34 unmodified lines
807 B = av_clip_uintp2(B, 30); \921 B = av_clip_uintp2(B, 30); \
808 }922 }
809 923
810#define YSCALE_YUV_2_RGBX_C(type,alpha) \924#define YSCALE_YUV_2_RGB2_C(type,alpha) \
811 YSCALE_YUV_2_PACKEDX_C(type,alpha) /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/\
812 r = (type *)c->table_rV[V]; \
813 g = (type *)(c->table_gU[U] + c->table_gV[V]); \
814 b = (type *)c->table_bU[U];
815
816#define YSCALE_YUV_2_PACKED2_C(type,alpha) \
817 for (i=0; i<(dstW>>1); i++) { \925 for (i=0; i<(dstW>>1); i++) { \
818 const int i2= 2*i; \926 const int i2= 2*i; \
819 int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \927 int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \
@@ -825,15 +933,12 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 5 unmodified lines
825 if (alpha) {\933 if (alpha) {\
826 A1= (abuf0[i2 ]*yalpha1+abuf1[i2 ]*yalpha)>>19; \934 A1= (abuf0[i2 ]*yalpha1+abuf1[i2 ]*yalpha)>>19; \
827 A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19; \935 A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19; \
828 }936 }\
829
830#define YSCALE_YUV_2_RGB2_C(type,alpha) \
831 YSCALE_YUV_2_PACKED2_C(type,alpha)\
832 r = (type *)c->table_rV[V];\937 r = (type *)c->table_rV[V];\
833 g = (type *)(c->table_gU[U] + c->table_gV[V]);\938 g = (type *)(c->table_gU[U] + c->table_gV[V]);\
834 b = (type *)c->table_bU[U];939 b = (type *)c->table_bU[U];
835 940
836#define YSCALE_YUV_2_PACKED1_C(type,alpha) \941#define YSCALE_YUV_2_RGB1_C(type,alpha) \
837 for (i=0; i<(dstW>>1); i++) {\942 for (i=0; i<(dstW>>1); i++) {\
838 const int i2= 2*i;\943 const int i2= 2*i;\
839 int Y1= buf0[i2 ]>>7;\944 int Y1= buf0[i2 ]>>7;\
@@ -845,15 +950,12 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 5 unmodified lines
845 if (alpha) {\950 if (alpha) {\
846 A1= abuf0[i2 ]>>7;\951 A1= abuf0[i2 ]>>7;\
847 A2= abuf0[i2+1]>>7;\952 A2= abuf0[i2+1]>>7;\
848 }953 }\
849
850#define YSCALE_YUV_2_RGB1_C(type,alpha) \
851 YSCALE_YUV_2_PACKED1_C(type,alpha)\
852 r = (type *)c->table_rV[V];\954 r = (type *)c->table_rV[V];\
853 g = (type *)(c->table_gU[U] + c->table_gV[V]);\955 g = (type *)(c->table_gU[U] + c->table_gV[V]);\
854 b = (type *)c->table_bU[U];956 b = (type *)c->table_bU[U];
855 957
856#define YSCALE_YUV_2_PACKED1B_C(type,alpha) \958#define YSCALE_YUV_2_RGB1B_C(type,alpha) \
857 for (i=0; i<(dstW>>1); i++) {\959 for (i=0; i<(dstW>>1); i++) {\
858 const int i2= 2*i;\960 const int i2= 2*i;\
859 int Y1= buf0[i2 ]>>7;\961 int Y1= buf0[i2 ]>>7;\
@@ -865,15 +967,12 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 5 unmodified lines
865 if (alpha) {\967 if (alpha) {\
866 A1= abuf0[i2 ]>>7;\968 A1= abuf0[i2 ]>>7;\
867 A2= abuf0[i2+1]>>7;\969 A2= abuf0[i2+1]>>7;\
868 }970 }\
869
870#define YSCALE_YUV_2_RGB1B_C(type,alpha) \
871 YSCALE_YUV_2_PACKED1B_C(type,alpha)\
872 r = (type *)c->table_rV[V];\971 r = (type *)c->table_rV[V];\
873 g = (type *)(c->table_gU[U] + c->table_gV[V]);\972 g = (type *)(c->table_gU[U] + c->table_gV[V]);\
874 b = (type *)c->table_bU[U];973 b = (type *)c->table_bU[U];
875 974
876#define YSCALE_YUV_2_ANYRGB_C(func, func2)\975#define YSCALE_YUV_2_ANYRGB_C(func)\
877 switch(c->dstFormat) {\976 switch(c->dstFormat) {\
878 case PIX_FMT_RGB48BE:\977 case PIX_FMT_RGB48BE:\
879 case PIX_FMT_RGB48LE:\978 case PIX_FMT_RGB48LE:\
@@ -1049,22 +1148,6 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 169 unmodified lines
1049 }\1148 }\
1050 }\1149 }\
1051 break;\1150 break;\
1052 case PIX_FMT_YUYV422:\
1053 func2\
1054 ((uint8_t*)dest)[2*i2+0]= Y1;\
1055 ((uint8_t*)dest)[2*i2+1]= U;\
1056 ((uint8_t*)dest)[2*i2+2]= Y2;\
1057 ((uint8_t*)dest)[2*i2+3]= V;\
1058 } \
1059 break;\
1060 case PIX_FMT_UYVY422:\
1061 func2\
1062 ((uint8_t*)dest)[2*i2+0]= U;\
1063 ((uint8_t*)dest)[2*i2+1]= Y1;\
1064 ((uint8_t*)dest)[2*i2+2]= V;\
1065 ((uint8_t*)dest)[2*i2+3]= Y2;\
1066 } \
1067 break;\
1068 }1151 }
1069 1152
1070static void yuv2packedX_c(SwsContext *c, const int16_t *lumFilter,1153static void yuv2packedX_c(SwsContext *c, const int16_t *lumFilter,
@@ -1074,7 +1157,7 @@ static void yuv2packedX_c(SwsContext *c, const int16_t *lumFilter, · 3 unmodified lines
1074 const int16_t **alpSrc, uint8_t *dest, int dstW, int y)1157 const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
1075{1158{
1076 int i;1159 int i;
1077 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void,0))1160 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C)
1078}1161}
1079 1162
1080static void yuv2rgbX_c_full(SwsContext *c, const int16_t *lumFilter,1163static void yuv2rgbX_c_full(SwsContext *c, const int16_t *lumFilter,
@@ -1177,7 +1260,7 @@ static void yuv2packed2_c(SwsContext *c, const uint16_t *buf0, · 96 unmodified lines
1177 int uvalpha1=4095-uvalpha;1260 int uvalpha1=4095-uvalpha;
1178 int i;1261 int i;
1179 1262
1180 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C(void,0))1263 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C)
1181}1264}
1182 1265
1183/**1266/**
@@ -1193,9 +1276,9 @@ static void yuv2packed1_c(SwsContext *c, const uint16_t *buf0, · 9 unmodified lines
1193 int i;1276 int i;
1194 1277
1195 if (uvalpha < 2048) {1278 if (uvalpha < 2048) {
1196 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0))1279 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C)
1197 } else {1280 } else {
1198 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0))1281 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C)
1199 }1282 }
1200}1283}
1201 1284
@@ -1886,7 +1969,7 @@ find_c_packed_planar_out_funcs(SwsContext *c, · 684 unmodified lines
1886 } else if (is16BPS(dstFormat)) {1969 } else if (is16BPS(dstFormat)) {
1887 *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c;1970 *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c;
1888 } else if (is9_OR_10BPS(dstFormat)) {1971 } else if (is9_OR_10BPS(dstFormat)) {
1889 if (dstFormat == PIX_FMT_YUV420P9BE || dstFormat == PIX_FMT_YUV420P9LE) {1972 if (av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1 == 8) {
1890 *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c;1973 *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c;
1891 } else {1974 } else {
1892 *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c;1975 *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c;
@@ -1919,6 +2002,16 @@ find_c_packed_planar_out_funcs(SwsContext *c, · 26 unmodified lines
1919 *yuv2packed2 = yuv2monoblack_2_c;2002 *yuv2packed2 = yuv2monoblack_2_c;
1920 *yuv2packedX = yuv2monoblack_X_c;2003 *yuv2packedX = yuv2monoblack_X_c;
1921 break;2004 break;
2005 case PIX_FMT_YUYV422:
2006 *yuv2packed1 = yuv2422yuyv_1_c;
2007 *yuv2packed2 = yuv2422yuyv_2_c;
2008 *yuv2packedX = yuv2422yuyv_X_c;
2009 break;
2010 case PIX_FMT_UYVY422:
2011 *yuv2packed1 = yuv2422uyvy_1_c;
2012 *yuv2packed2 = yuv2422uyvy_2_c;
2013 *yuv2packedX = yuv2422uyvy_X_c;
2014 break;
1922 default:2015 default:
1923 *yuv2packed1 = yuv2packed1_c;2016 *yuv2packed1 = yuv2packed1_c;
1924 *yuv2packed2 = yuv2packed2_c;2017 *yuv2packed2 = yuv2packed2_c;
@@ -2221,16 +2314,20 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 296 unmodified lines
2221 case PIX_FMT_BGR4_BYTE:2314 case PIX_FMT_BGR4_BYTE:
2222 case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;2315 case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;
2223 case PIX_FMT_GRAY16BE :2316 case PIX_FMT_GRAY16BE :
2317 case PIX_FMT_YUV444P9BE:
2224 case PIX_FMT_YUV420P9BE:2318 case PIX_FMT_YUV420P9BE:
2319 case PIX_FMT_YUV444P10BE:
2225 case PIX_FMT_YUV422P10BE:2320 case PIX_FMT_YUV422P10BE:
2226 case PIX_FMT_YUV420P10BE:2321 case PIX_FMT_YUV420P10BE:
2227 case PIX_FMT_YUV420P16BE:2322 case PIX_FMT_YUV420P16BE:
2228 case PIX_FMT_YUV422P16BE:2323 case PIX_FMT_YUV422P16BE:
2229 case PIX_FMT_YUV444P16BE: c->hScale16= HAVE_BIGENDIAN ? hScale16_c : hScale16X_c; break;2324 case PIX_FMT_YUV444P16BE: c->hScale16= HAVE_BIGENDIAN ? hScale16_c : hScale16X_c; break;
2230 case PIX_FMT_GRAY16LE :2325 case PIX_FMT_GRAY16LE :
2326 case PIX_FMT_YUV444P9LE:
2231 case PIX_FMT_YUV420P9LE:2327 case PIX_FMT_YUV420P9LE:
2232 case PIX_FMT_YUV422P10LE:2328 case PIX_FMT_YUV422P10LE:
2233 case PIX_FMT_YUV420P10LE:2329 case PIX_FMT_YUV420P10LE:
2330 case PIX_FMT_YUV444P10LE:
2234 case PIX_FMT_YUV420P16LE:2331 case PIX_FMT_YUV420P16LE:
2235 case PIX_FMT_YUV422P16LE:2332 case PIX_FMT_YUV422P16LE:
2236 case PIX_FMT_YUV444P16LE: c->hScale16= HAVE_BIGENDIAN ? hScale16X_c : hScale16_c; break;2333 case PIX_FMT_YUV444P16LE: c->hScale16= HAVE_BIGENDIAN ? hScale16X_c : hScale16_c; break;
libswscale/swscale_internal.h+12−0
@@ -371,6 +371,12 @@ const char *sws_format_name(enum PixelFormat format); · 370 unmodified lines
371#define isNBPS(x) ( \371#define isNBPS(x) ( \
372 (x)==PIX_FMT_YUV420P9LE \372 (x)==PIX_FMT_YUV420P9LE \
373 || (x)==PIX_FMT_YUV420P9BE \373 || (x)==PIX_FMT_YUV420P9BE \
374 || (x)==PIX_FMT_YUV444P9BE \
375 || (x)==PIX_FMT_YUV444P9LE \
376 || (x)==PIX_FMT_YUV422P10BE \
377 || (x)==PIX_FMT_YUV422P10LE \
378 || (x)==PIX_FMT_YUV444P10BE \
379 || (x)==PIX_FMT_YUV444P10LE \
374 || (x)==PIX_FMT_YUV420P10LE \380 || (x)==PIX_FMT_YUV420P10LE \
375 || (x)==PIX_FMT_YUV420P10BE \381 || (x)==PIX_FMT_YUV420P10BE \
376 || (x)==PIX_FMT_YUV422P10LE \382 || (x)==PIX_FMT_YUV422P10LE \
@@ -392,13 +398,19 @@ const char *sws_format_name(enum PixelFormat format); · 15 unmodified lines
392#define isPlanarYUV(x) ( \398#define isPlanarYUV(x) ( \
393 isPlanar8YUV(x) \399 isPlanar8YUV(x) \
394 || (x)==PIX_FMT_YUV420P9LE \400 || (x)==PIX_FMT_YUV420P9LE \
401 || (x)==PIX_FMT_YUV444P9LE \
395 || (x)==PIX_FMT_YUV420P10LE \402 || (x)==PIX_FMT_YUV420P10LE \
403 || (x)==PIX_FMT_YUV422P10LE \
404 || (x)==PIX_FMT_YUV444P10LE \
396 || (x)==PIX_FMT_YUV420P16LE \405 || (x)==PIX_FMT_YUV420P16LE \
397 || (x)==PIX_FMT_YUV422P10LE \406 || (x)==PIX_FMT_YUV422P10LE \
398 || (x)==PIX_FMT_YUV422P16LE \407 || (x)==PIX_FMT_YUV422P16LE \
399 || (x)==PIX_FMT_YUV444P16LE \408 || (x)==PIX_FMT_YUV444P16LE \
400 || (x)==PIX_FMT_YUV420P9BE \409 || (x)==PIX_FMT_YUV420P9BE \
410 || (x)==PIX_FMT_YUV444P9BE \
401 || (x)==PIX_FMT_YUV420P10BE \411 || (x)==PIX_FMT_YUV420P10BE \
412 || (x)==PIX_FMT_YUV422P10BE \
413 || (x)==PIX_FMT_YUV444P10BE \
402 || (x)==PIX_FMT_YUV420P16BE \414 || (x)==PIX_FMT_YUV420P16BE \
403 || (x)==PIX_FMT_YUV422P10BE \415 || (x)==PIX_FMT_YUV422P10BE \
404 || (x)==PIX_FMT_YUV422P16BE \416 || (x)==PIX_FMT_YUV422P16BE \
libswscale/utils.c+6−0
@@ -112,12 +112,18 @@ const char *swscale_license(void) · 111 unmodified lines
112 || (x)==PIX_FMT_MONOWHITE \112 || (x)==PIX_FMT_MONOWHITE \
113 || (x)==PIX_FMT_MONOBLACK \113 || (x)==PIX_FMT_MONOBLACK \
114 || (x)==PIX_FMT_YUV420P9LE \114 || (x)==PIX_FMT_YUV420P9LE \
115 || (x)==PIX_FMT_YUV444P9LE \
115 || (x)==PIX_FMT_YUV420P10LE \116 || (x)==PIX_FMT_YUV420P10LE \
117 || (x)==PIX_FMT_YUV422P10LE \
118 || (x)==PIX_FMT_YUV444P10LE \
116 || (x)==PIX_FMT_YUV420P16LE \119 || (x)==PIX_FMT_YUV420P16LE \
117 || (x)==PIX_FMT_YUV422P16LE \120 || (x)==PIX_FMT_YUV422P16LE \
118 || (x)==PIX_FMT_YUV444P16LE \121 || (x)==PIX_FMT_YUV444P16LE \
119 || (x)==PIX_FMT_YUV420P9BE \122 || (x)==PIX_FMT_YUV420P9BE \
123 || (x)==PIX_FMT_YUV444P9BE \
120 || (x)==PIX_FMT_YUV420P10BE \124 || (x)==PIX_FMT_YUV420P10BE \
125 || (x)==PIX_FMT_YUV444P10BE \
126 || (x)==PIX_FMT_YUV422P10BE \
121 || (x)==PIX_FMT_YUV420P16BE \127 || (x)==PIX_FMT_YUV420P16BE \
122 || (x)==PIX_FMT_YUV422P16BE \128 || (x)==PIX_FMT_YUV422P16BE \
123 || (x)==PIX_FMT_YUV444P16BE \129 || (x)==PIX_FMT_YUV444P16BE \

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