* 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
Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | API changes, most recent first: |
| 15 | 15 | |
| 16 | +2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h | |
| 17 | + Add av_opt_flag_is_set(). | |
| 18 | + | |
| 16 | 19 | 2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays |
| 17 | 20 | Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h. |
| 18 | 21 | |
| @@ -558,7 +558,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ · 557 unmodified lines | ||
| 558 | 558 | dirac.o mpeg12data.o vorbis_data.o |
| 559 | 559 | OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \ |
| 560 | 560 | vorbis_data.o |
| 561 | −OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o | |
| 561 | +OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o | |
| 562 | 562 | OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o |
| 563 | 563 | OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ |
| 564 | 564 | flacdec.o flacdata.o flac.o \ |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * 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 | 5 | * This file is part of FFmpeg. |
| 6 | 6 | * |
| @@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static) · 117 unmodified lines | ||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | static av_always_inline uint32_t bitswap_32(uint32_t x) { |
| 121 | − return av_reverse[x&0xFF]<<24 | |
| 122 | − | av_reverse[(x>>8)&0xFF]<<16 | |
| 123 | − | av_reverse[(x>>16)&0xFF]<<8 | |
| 124 | − | av_reverse[x>>24]; | |
| 121 | + return (uint32_t)av_reverse[x&0xFF]<<24 | |
| 122 | + | (uint32_t)av_reverse[(x>>8)&0xFF]<<16 | |
| 123 | + | (uint32_t)av_reverse[(x>>16)&0xFF]<<8 | |
| 124 | + | (uint32_t)av_reverse[x>>24]; | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | typedef struct { |
| @@ -58,11 +58,12 @@ static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *p_block, int strid · 57 unmodified lines | ||
| 58 | 58 | op_scale1(15); \ |
| 59 | 59 | } \ |
| 60 | 60 | } \ |
| 61 | −static 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){ \ | |
| 61 | +static 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 | 62 | int y; \ |
| 63 | − pixel *dst = (pixel*)p_dst; \ | |
| 64 | − pixel *src = (pixel*)p_src; \ | |
| 63 | + pixel *dst = (pixel*)_dst; \ | |
| 64 | + pixel *src = (pixel*)_src; \ | |
| 65 | 65 | stride >>= sizeof(pixel)-1; \ |
| 66 | + offset <<= (BIT_DEPTH-8); \ | |
| 66 | 67 | offset = ((offset + 1) | 1) << log2_denom; \ |
| 67 | 68 | for(y=0; y<H; y++, dst += stride, src += stride){ \ |
| 68 | 69 | op_scale2(0); \ |
| @@ -1331,19 +1331,17 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ · 1330 unmodified lines | ||
| 1331 | 1331 | avctx->ticks_per_frame=2; |
| 1332 | 1332 | //MPEG-2 aspect |
| 1333 | 1333 | if(s->aspect_ratio_info > 1){ |
| 1334 | − AVRational dar= | |
| 1334 | + AVRational dar = | |
| 1335 | 1335 | av_mul_q( |
| 1336 | − av_div_q( | |
| 1337 | − ff_mpeg2_aspect[s->aspect_ratio_info], | |
| 1338 | − (AVRational){s1->pan_scan.width, s1->pan_scan.height} | |
| 1339 | − ), | |
| 1336 | + av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], | |
| 1337 | + (AVRational){s1->pan_scan.width, s1->pan_scan.height}), | |
| 1340 | 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 example | |
| 1340 | + // we ignore the spec here and guess a bit as reality does not match the spec, see for example | |
| 1343 | 1341 | // res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg |
| 1344 | − //issue1613, 621, 562 | |
| 1345 | − 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}))){ | |
| 1342 | + // issue1613, 621, 562 | |
| 1343 | + if((s1->pan_scan.width == 0 ) || (s1->pan_scan.height == 0) || | |
| 1344 | + (av_cmp_q(dar,(AVRational){4,3}) && av_cmp_q(dar,(AVRational){16,9}))) { | |
| 1347 | 1345 | s->avctx->sample_aspect_ratio= |
| 1348 | 1346 | av_div_q( |
| 1349 | 1347 | ff_mpeg2_aspect[s->aspect_ratio_info], |
| @@ -836,6 +836,13 @@ DEBLOCK_LUMA_INTRA avx · 835 unmodified lines | ||
| 836 | 836 | mova [r0+2*r1], m2 |
| 837 | 837 | %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 | 846 | %macro DEBLOCK_CHROMA 1 |
| 840 | 847 | ;----------------------------------------------------------------------------- |
| 841 | 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 | 861 | LOAD_AB m4, m5, r2d, r3d |
| 855 | 862 | LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4 |
| 856 | 863 | pxor m4, m4 |
| 857 | − LOAD_TC m6, r4 | |
| 864 | + CHROMA_V_LOAD_TC m6, r4 | |
| 858 | 865 | psubw m6, [pw_3] |
| 859 | 866 | pmaxsw m6, m4 |
| 860 | 867 | pand m7, m6 |
| @@ -44,7 +44,7 @@ static int adts_aac_probe(AVProbeData *p) · 43 unmodified lines | ||
| 44 | 44 | uint32_t header = AV_RB16(buf2); |
| 45 | 45 | if((header&0xFFF6) != 0xFFF0) |
| 46 | 46 | break; |
| 47 | − fsize = (AV_RB32(buf2+3)>>13) & 0x1FFF; | |
| 47 | + fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF; | |
| 48 | 48 | if(fsize < 7) |
| 49 | 49 | break; |
| 50 | 50 | buf2 += fsize; |
| @@ -19,9 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | * 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 | 22 | #include <strings.h> |
| 26 | 23 | #include "libavutil/intreadwrite.h" |
| 27 | 24 | #include "libavutil/bswap.h" |
| @@ -160,10 +157,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 132 unmodified lines | ||
| 160 | 157 | int64_t last_pos= -1; |
| 161 | 158 | int64_t filesize= avio_size(s->pb); |
| 162 | 159 | |
| 163 | −#ifdef DEBUG_SEEK | |
| 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", | |
| 165 | − longs_pre_entry,index_type, entries_in_use, chunk_id, base); | |
| 166 | −#endif | |
| 160 | + av_dlog(s, "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); | |
| 167 | 162 | |
| 168 | 163 | if(stream_id >= s->nb_streams || stream_id < 0) |
| 169 | 164 | return -1; |
| @@ -1182,10 +1177,8 @@ static int avi_read_idx1(AVFormatContext *s, int size) · 1012 unmodified lines | ||
| 1182 | 1177 | flags = avio_rl32(pb); |
| 1183 | 1178 | pos = avio_rl32(pb); |
| 1184 | 1179 | len = avio_rl32(pb); |
| 1185 | −#if defined(DEBUG_SEEK) | |
| 1186 | − av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", | |
| 1187 | − i, tag, flags, pos, len); | |
| 1188 | −#endif | |
| 1180 | + av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", | |
| 1181 | + i, tag, flags, pos, len); | |
| 1189 | 1182 | if(i==0 && pos > avi->movi_list) |
| 1190 | 1183 | avi->movi_list= 0; //FIXME better check |
| 1191 | 1184 | pos += avi->movi_list; |
| @@ -1254,22 +1247,18 @@ static int avi_load_index(AVFormatContext *s) · 62 unmodified lines | ||
| 1254 | 1247 | |
| 1255 | 1248 | if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) |
| 1256 | 1249 | goto the_end; // maybe truncated file |
| 1257 | −#ifdef DEBUG_SEEK | |
| 1258 | − av_log(s, AV_LOG_DEBUG, "movi_end=0x%"PRIx64"\n", avi->movi_end); | |
| 1259 | −#endif | |
| 1250 | + av_dlog(s, "movi_end=0x%"PRIx64"\n", avi->movi_end); | |
| 1260 | 1251 | for(;;) { |
| 1261 | 1252 | if (url_feof(pb)) |
| 1262 | 1253 | break; |
| 1263 | 1254 | tag = avio_rl32(pb); |
| 1264 | 1255 | size = avio_rl32(pb); |
| 1265 | −#ifdef DEBUG_SEEK | |
| 1266 | − av_log(s, AV_LOG_DEBUG, "tag=%c%c%c%c size=0x%x\n", | |
| 1267 | − tag & 0xff, | |
| 1268 | − (tag >> 8) & 0xff, | |
| 1269 | − (tag >> 16) & 0xff, | |
| 1270 | − (tag >> 24) & 0xff, | |
| 1271 | − size); | |
| 1272 | −#endif | |
| 1256 | + av_dlog(s, "tag=%c%c%c%c size=0x%x\n", | |
| 1257 | + tag & 0xff, | |
| 1258 | + (tag >> 8) & 0xff, | |
| 1259 | + (tag >> 16) & 0xff, | |
| 1260 | + (tag >> 24) & 0xff, | |
| 1261 | + size); | |
| 1273 | 1262 | switch(tag) { |
| 1274 | 1263 | case MKTAG('i', 'd', 'x', '1'): |
| 1275 | 1264 | if (avi_read_idx1(s, size) < 0) |
| @@ -163,8 +163,6 @@ static int ffm_read_data(AVFormatContext *s, · 162 unmodified lines | ||
| 163 | 163 | return size1 - size; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | −//#define DEBUG_SEEK | |
| 167 | − | |
| 168 | 166 | /* ensure that acutal seeking happens between FFM_PACKET_SIZE |
| 169 | 167 | and file_size - FFM_PACKET_SIZE */ |
| 170 | 168 | static 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 | 174 | pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); |
| 177 | 175 | pos = FFMAX(pos, FFM_PACKET_SIZE); |
| 178 | −#ifdef DEBUG_SEEK | |
| 179 | − av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); | |
| 180 | −#endif | |
| 176 | + av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); | |
| 181 | 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 | 185 | ffm_seek1(s, pos); |
| 190 | 186 | avio_skip(pb, 4); |
| 191 | 187 | dts = avio_rb64(pb); |
| 192 | −#ifdef DEBUG_SEEK | |
| 193 | − av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); | |
| 194 | −#endif | |
| 188 | + av_dlog(s, "dts=%0.6f\n", dts / 1000000.0); | |
| 195 | 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 | 458 | int64_t pts_min, pts_max, pts; |
| 465 | 459 | double pos1; |
| 466 | 460 | |
| 467 | −#ifdef DEBUG_SEEK | |
| 468 | − av_log(s, AV_LOG_DEBUG, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0); | |
| 469 | −#endif | |
| 461 | + av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0); | |
| 470 | 462 | /* find the position using linear interpolation (better than |
| 471 | 463 | dichotomy in typical cases) */ |
| 472 | 464 | pos_min = FFM_PACKET_SIZE; |
| @@ -122,11 +122,12 @@ int ff_url_join(char *str, int size, const char *proto, · 121 unmodified lines | ||
| 122 | 122 | * @param dest_type the destination address type, may be NULL |
| 123 | 123 | * @param port the destination port of the media stream, 0 if unknown |
| 124 | 124 | * @param ttl the time to live of the stream, 0 if not multicast |
| 125 | − * @param flags the AVFormatContext->flags, modifying the generated SDP | |
| 125 | + * @param fmt the AVFormatContext, which might contain options modifying | |
| 126 | + * the generated SDP | |
| 126 | 127 | */ |
| 127 | 128 | void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, |
| 128 | 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 | 133 | * Write a packet to another muxer than the one the user originally |
| @@ -1537,8 +1537,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st) · 1536 unmodified lines | ||
| 1537 | 1537 | |
| 1538 | 1538 | /* adjust first dts according to edit list */ |
| 1539 | 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; | |
| 1541 | − current_dts = -rescaled; | |
| 1540 | + if (sc->time_offset < 0) | |
| 1541 | + sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale); | |
| 1542 | + current_dts = -sc->time_offset; | |
| 1542 | 1543 | if (sc->ctts_data && sc->stts_data && |
| 1543 | 1544 | sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) { |
| 1544 | 1545 | /* 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 | 2074 | if (flags & 0x001) data_offset = avio_rb32(pb); |
| 2074 | 2075 | if (flags & 0x004) first_sample_flags = avio_rb32(pb); |
| 2075 | − dts = st->duration; | |
| 2076 | + dts = st->duration - sc->time_offset; | |
| 2076 | 2077 | offset = frag->base_data_offset + data_offset; |
| 2077 | 2078 | distance = 0; |
| 2078 | 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 | 2102 | offset += sample_size; |
| 2102 | 2103 | } |
| 2103 | 2104 | frag->moof_offset = offset; |
| 2104 | − st->duration = dts; | |
| 2105 | + st->duration = dts + sc->time_offset; | |
| 2105 | 2106 | return 0; |
| 2106 | 2107 | } |
| 2107 | 2108 | |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "libavutil/avstring.h" |
| 35 | 35 | #include "libavutil/opt.h" |
| 36 | 36 | #include "libavutil/dict.h" |
| 37 | +#include "rtpenc.h" | |
| 37 | 38 | |
| 38 | 39 | #undef NDEBUG |
| 39 | 40 | #include <assert.h> |
| @@ -41,6 +42,7 @@ · 1 unmodified line | ||
| 41 | 42 | static const AVOption options[] = { |
| 42 | 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 | 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 | 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 | 1370 | char buf[1000] = ""; |
| 1369 | 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 | 1374 | av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index); |
| 1373 | 1375 | len = strlen(buf); |
| 1374 | 1376 | |
| @@ -111,6 +111,7 @@ typedef struct MOVMuxContext { · 110 unmodified lines | ||
| 111 | 111 | MOVTrack *tracks; |
| 112 | 112 | |
| 113 | 113 | int flags; |
| 114 | + int rtp_flags; | |
| 114 | 115 | } MOVMuxContext; |
| 115 | 116 | |
| 116 | 117 | #define FF_MOV_FLAG_RTP_HINT 1 |
| @@ -23,8 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "internal.h" |
| 24 | 24 | #include "mpeg.h" |
| 25 | 25 | |
| 26 | −//#define DEBUG_SEEK | |
| 27 | − | |
| 28 | 26 | #undef NDEBUG |
| 29 | 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 | 590 | for(;;) { |
| 593 | 591 | len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts); |
| 594 | 592 | if (len < 0) { |
| 595 | −#ifdef DEBUG_SEEK | |
| 596 | − av_log(s, AV_LOG_DEBUG, "none (ret=%d)\n", len); | |
| 597 | −#endif | |
| 593 | + av_dlog(s, "none (ret=%d)\n", len); | |
| 598 | 594 | return AV_NOPTS_VALUE; |
| 599 | 595 | } |
| 600 | 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 | 600 | avio_skip(s->pb, len); |
| 605 | 601 | } |
| 606 | −#ifdef DEBUG_SEEK | |
| 607 | − av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", | |
| 608 | − pos, dts, dts / 90000.0); | |
| 609 | −#endif | |
| 602 | + av_dlog(s, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", | |
| 603 | + pos, dts, dts / 90000.0); | |
| 610 | 604 | *ppos = pos; |
| 611 | 605 | return dts; |
| 612 | 606 | } |
| @@ -25,7 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "mpeg.h" |
| 26 | 26 | |
| 27 | 27 | #define MAX_PAYLOAD_SIZE 4096 |
| 28 | −//#define DEBUG_SEEK | |
| 29 | 28 | |
| 30 | 29 | #undef NDEBUG |
| 31 | 30 | #include <assert.h> |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | −//#define DEBUG | |
| 23 | −//#define DEBUG_SEEK | |
| 24 | 22 | //#define USE_SYNCPOINT_SEARCH |
| 25 | 23 | |
| 26 | 24 | #include "libavutil/crc.h" |
| @@ -22,9 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include "riff.h" |
| 23 | 23 | #include "libavutil/dict.h" |
| 24 | 24 | |
| 25 | −//#define DEBUG | |
| 26 | 25 | //#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!! |
| 27 | −//#define DEBUG_SEEK | |
| 28 | 26 | #define CHECK_SUBSEQUENT_NSVS |
| 29 | 27 | //#define DISABLE_AUDIO |
| 30 | 28 | |
| @@ -23,11 +23,24 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "mpegts.h" |
| 24 | 24 | #include "internal.h" |
| 25 | 25 | #include "libavutil/random_seed.h" |
| 26 | +#include "libavutil/opt.h" | |
| 26 | 27 | |
| 27 | 28 | #include "rtpenc.h" |
| 28 | 29 | |
| 29 | 30 | //#define DEBUG |
| 30 | 31 | |
| 32 | +static const AVOption options[] = { | |
| 33 | + FF_RTP_FLAG_OPTS(RTPMuxContext, flags), | |
| 34 | + { NULL }, | |
| 35 | +}; | |
| 36 | + | |
| 37 | +static 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 | 44 | #define RTCP_SR_SIZE 28 |
| 32 | 45 | |
| 33 | 46 | static int is_supported(enum CodecID id) |
| @@ -404,7 +417,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) · 370 unmodified lines | ||
| 404 | 417 | ff_rtp_send_mpegvideo(s1, pkt->data, size); |
| 405 | 418 | break; |
| 406 | 419 | case CODEC_ID_AAC: |
| 407 | − if (s1->flags & AVFMT_FLAG_MP4A_LATM) | |
| 420 | + if (s->flags & FF_RTP_FLAG_MP4A_LATM) | |
| 408 | 421 | ff_rtp_send_latm(s1, pkt->data, size); |
| 409 | 422 | else |
| 410 | 423 | ff_rtp_send_aac(s1, pkt->data, size); |
| @@ -458,4 +471,5 @@ AVOutputFormat ff_rtp_muxer = { · 47 unmodified lines | ||
| 458 | 471 | rtp_write_header, |
| 459 | 472 | rtp_write_packet, |
| 460 | 473 | rtp_write_trailer, |
| 474 | + .priv_class = &rtp_muxer_class, | |
| 461 | 475 | }; |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "rtp.h" |
| 26 | 26 | |
| 27 | 27 | struct RTPMuxContext { |
| 28 | + const AVClass *av_class; | |
| 28 | 29 | AVFormatContext *ic; |
| 29 | 30 | AVStream *st; |
| 30 | 31 | int payload_type; |
| @@ -56,10 +57,18 @@ struct RTPMuxContext { · 25 unmodified lines | ||
| 56 | 57 | * (1, 2 or 4) |
| 57 | 58 | */ |
| 58 | 59 | int nal_length_size; |
| 60 | + | |
| 61 | + int flags; | |
| 59 | 62 | }; |
| 60 | 63 | |
| 61 | 64 | typedef 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 | + | |
| 63 | 72 | void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m); |
| 64 | 73 | |
| 65 | 74 | void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size); |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "avio_internal.h" |
| 24 | 24 | #include "rtpenc_chain.h" |
| 25 | 25 | #include "avio_internal.h" |
| 26 | +#include "libavutil/opt.h" | |
| 26 | 27 | |
| 27 | 28 | AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
| 28 | 29 | URLContext *handle, int packet_size) |
| @@ -50,6 +51,13 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, · 21 unmodified lines | ||
| 50 | 51 | rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; |
| 51 | 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 | 61 | /* Set the synchronized start time. */ |
| 54 | 62 | rtpctx->start_time_realtime = s->start_time_realtime; |
| 55 | 63 | |
| @@ -22,7 +22,8 @@ · 21 unmodified lines | ||
| 22 | 22 | #include "avformat.h" |
| 23 | 23 | #include "rtpenc.h" |
| 24 | 24 | |
| 25 | −void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size) { | |
| 25 | +void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size) | |
| 26 | +{ | |
| 26 | 27 | /* MP4A-LATM |
| 27 | 28 | * The RTP payload format specification is described in RFC 3016 |
| 28 | 29 | * The encoding specifications are provided in ISO/IEC 14496-3 */ |
| @@ -344,6 +344,11 @@ typedef struct RTSPState { · 343 unmodified lines | ||
| 344 | 344 | * Do not begin to play the stream immediately. |
| 345 | 345 | */ |
| 346 | 346 | int initial_pause; |
| 347 | + | |
| 348 | + /** | |
| 349 | + * Option flags for the chained RTP muxer. | |
| 350 | + */ | |
| 351 | + int rtp_muxer_flags; | |
| 347 | 352 | } RTSPState; |
| 348 | 353 | |
| 349 | 354 | /** |
| @@ -33,9 +33,23 @@ · 32 unmodified lines | ||
| 33 | 33 | #include "libavutil/intreadwrite.h" |
| 34 | 34 | #include "libavutil/avstring.h" |
| 35 | 35 | #include "url.h" |
| 36 | +#include "libavutil/opt.h" | |
| 37 | +#include "rtpenc.h" | |
| 36 | 38 | |
| 37 | 39 | #define SDP_MAX_SIZE 16384 |
| 38 | 40 | |
| 41 | +static const AVOption options[] = { | |
| 42 | + FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags), | |
| 43 | + { NULL }, | |
| 44 | +}; | |
| 45 | + | |
| 46 | +static 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 | + | |
| 39 | 53 | int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) |
| 40 | 54 | { |
| 41 | 55 | RTSPState *rt = s->priv_data; |
| @@ -238,5 +252,6 @@ AVOutputFormat ff_rtsp_muxer = { · 196 unmodified lines | ||
| 238 | 252 | rtsp_write_packet, |
| 239 | 253 | rtsp_write_close, |
| 240 | 254 | .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER, |
| 255 | + .priv_class = &rtsp_muxer_class, | |
| 241 | 256 | }; |
| 242 | 257 | |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "libavutil/base64.h" |
| 24 | 24 | #include "libavutil/dict.h" |
| 25 | 25 | #include "libavutil/parseutils.h" |
| 26 | +#include "libavutil/opt.h" | |
| 26 | 27 | #include "libavcodec/xiph.h" |
| 27 | 28 | #include "libavcodec/mpeg4audio.h" |
| 28 | 29 | #include "avformat.h" |
| @@ -301,7 +302,8 @@ xiph_fail: · 272 unmodified lines | ||
| 301 | 302 | return NULL; |
| 302 | 303 | } |
| 303 | 304 | |
| 304 | −static int latm_context2profilelevel(AVCodecContext *c) { | |
| 305 | +static int latm_context2profilelevel(AVCodecContext *c) | |
| 306 | +{ | |
| 305 | 307 | /* MP4A-LATM |
| 306 | 308 | * The RTP payload format specification is described in RFC 3016 |
| 307 | 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 | 331 | return profile_level; |
| 330 | 332 | } |
| 331 | 333 | |
| 332 | −static char *latm_context2config(AVCodecContext *c) { | |
| 334 | +static char *latm_context2config(AVCodecContext *c) | |
| 335 | +{ | |
| 333 | 336 | /* MP4A-LATM |
| 334 | 337 | * The RTP payload format specification is described in RFC 3016 |
| 335 | 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 | 367 | return config; |
| 365 | 368 | } |
| 366 | 369 | |
| 367 | −static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, int flags) | |
| 370 | +static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, AVFormatContext *fmt) | |
| 368 | 371 | { |
| 369 | 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 | 402 | payload_type, config ? config : ""); |
| 400 | 403 | break; |
| 401 | 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 | 407 | config = latm_context2config(c); |
| 404 | 408 | if (!config) |
| 405 | 409 | return NULL; |
| @@ -523,7 +527,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, · 117 unmodified lines | ||
| 523 | 527 | return buff; |
| 524 | 528 | } |
| 525 | 529 | |
| 526 | −void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags) | |
| 530 | +void 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 | 532 | const char *type; |
| 529 | 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 | 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 | |
| 552 | 556 | int 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 | 600 | ff_sdp_write_media(buf, size, |
| 597 | 601 | ac[i]->streams[j]->codec, dst[0] ? dst : NULL, |
| 598 | 602 | dst_type, (port > 0) ? port + j * 2 : 0, ttl, |
| 599 | − ac[i]->flags); | |
| 603 | + ac[i]); | |
| 600 | 604 | if (port <= 0) { |
| 601 | 605 | av_strlcatf(buf, size, |
| 602 | 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 | 616 | return AVERROR(ENOSYS); |
| 613 | 617 | } |
| 614 | 618 | |
| 615 | −void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags) | |
| 619 | +void 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 | 622 | #endif |
| @@ -1449,8 +1449,6 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, · 1448 unmodified lines | ||
| 1449 | 1449 | wanted_timestamp, flags); |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | −#define DEBUG_SEEK | |
| 1453 | − | |
| 1454 | 1452 | int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){ |
| 1455 | 1453 | AVInputFormat *avif= s->iformat; |
| 1456 | 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 | 1460 | if (stream_index < 0) |
| 1463 | 1461 | return -1; |
| 1464 | 1462 | |
| 1465 | −#ifdef DEBUG_SEEK | |
| 1466 | − av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts); | |
| 1467 | −#endif | |
| 1463 | + av_dlog(s, "read_seek: %d %"PRId64"\n", stream_index, target_ts); | |
| 1468 | 1464 | |
| 1469 | 1465 | ts_max= |
| 1470 | 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 | 1477 | if(e->timestamp <= target_ts || e->pos == e->min_distance){ |
| 1482 | 1478 | pos_min= e->pos; |
| 1483 | 1479 | ts_min= e->timestamp; |
| 1484 | −#ifdef DEBUG_SEEK | |
| 1485 | − av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n", | |
| 1486 | − pos_min,ts_min); | |
| 1487 | −#endif | |
| 1480 | + av_dlog(s, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n", | |
| 1481 | + pos_min,ts_min); | |
| 1488 | 1482 | }else{ |
| 1489 | 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 | 1491 | pos_max= e->pos; |
| 1498 | 1492 | ts_max= e->timestamp; |
| 1499 | 1493 | pos_limit= pos_max - e->min_distance; |
| 1500 | −#ifdef DEBUG_SEEK | |
| 1501 | − av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n", | |
| 1502 | − pos_max,pos_limit, ts_max); | |
| 1503 | −#endif | |
| 1494 | + av_dlog(s, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n", | |
| 1495 | + pos_max,pos_limit, ts_max); | |
| 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 | 1514 | int64_t start_pos, filesize; |
| 1523 | 1515 | int no_change; |
| 1524 | 1516 | |
| 1525 | −#ifdef DEBUG_SEEK | |
| 1526 | − av_log(s, AV_LOG_DEBUG, "gen_seek: %d %"PRId64"\n", stream_index, target_ts); | |
| 1527 | −#endif | |
| 1517 | + av_dlog(s, "gen_seek: %d %"PRId64"\n", stream_index, target_ts); | |
| 1528 | 1518 | |
| 1529 | 1519 | if(ts_min == AV_NOPTS_VALUE){ |
| 1530 | 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 | 1557 | no_change=0; |
| 1568 | 1558 | while (pos_min < pos_limit) { |
| 1569 | −#ifdef DEBUG_SEEK | |
| 1570 | − av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n", | |
| 1571 | − pos_min, pos_max, | |
| 1572 | − ts_min, ts_max); | |
| 1573 | −#endif | |
| 1559 | + av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n", | |
| 1560 | + pos_min, pos_max, ts_min, ts_max); | |
| 1574 | 1561 | assert(pos_limit <= pos_max); |
| 1575 | 1562 | |
| 1576 | 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 | 1584 | no_change++; |
| 1598 | 1585 | else |
| 1599 | 1586 | no_change=0; |
| 1600 | −#ifdef DEBUG_SEEK | |
| 1601 | − av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n", | |
| 1602 | − pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit, | |
| 1603 | − start_pos, no_change); | |
| 1604 | −#endif | |
| 1587 | + av_dlog(s, "%"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, | |
| 1589 | + pos_limit, start_pos, no_change); | |
| 1605 | 1590 | if(ts == AV_NOPTS_VALUE){ |
| 1606 | 1591 | av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n"); |
| 1607 | 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 | 1606 | pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; |
| 1622 | 1607 | ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max; |
| 1623 | −#ifdef DEBUG_SEEK | |
| 1608 | +#if 1 | |
| 1624 | 1609 | pos_min = pos; |
| 1625 | 1610 | ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX); |
| 1626 | 1611 | pos_min++; |
| 1627 | 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", | |
| 1629 | − pos, ts_min, target_ts, ts_max); | |
| 1613 | + av_dlog(s, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n", | |
| 1614 | + pos, ts_min, target_ts, ts_max); | |
| 1630 | 1615 | #endif |
| 1631 | 1616 | *ts_ret= ts; |
| 1632 | 1617 | return pos; |
| @@ -2694,9 +2679,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id) · 1061 unmodified lines | ||
| 2694 | 2679 | AVProgram *program=NULL; |
| 2695 | 2680 | int i; |
| 2696 | 2681 | |
| 2697 | −#ifdef DEBUG_SI | |
| 2698 | − av_log(ac, AV_LOG_DEBUG, "new_program: id=0x%04x\n", id); | |
| 2699 | −#endif | |
| 2682 | + av_dlog(ac, "new_program: id=0x%04x\n", id); | |
| 2700 | 2683 | |
| 2701 | 2684 | for(i=0; i<ac->nb_programs; i++) |
| 2702 | 2685 | if(ac->programs[i]->id == id) |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | #define LIBAVFORMAT_VERSION_MAJOR 53 |
| 27 | 27 | #define LIBAVFORMAT_VERSION_MINOR 3 |
| 28 | −#define LIBAVFORMAT_VERSION_MICRO 0 | |
| 28 | +#define LIBAVFORMAT_VERSION_MICRO 1 | |
| 29 | 29 | |
| 30 | 30 | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| 31 | 31 | LIBAVFORMAT_VERSION_MINOR, \ |
| @@ -320,6 +320,16 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) · 319 unmodified lines | ||
| 320 | 320 | return num*intnum/den; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | +int 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 | + | |
| 323 | 333 | static void opt_list(void *obj, void *av_log_obj, const char *unit, |
| 324 | 334 | int req_flags, int rej_flags) |
| 325 | 335 | { |
| @@ -181,4 +181,14 @@ int av_set_options_string(void *ctx, const char *opts, · 180 unmodified lines | ||
| 181 | 181 | */ |
| 182 | 182 | void 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 | + */ | |
| 192 | +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); | |
| 193 | + | |
| 184 | 194 | #endif /* AVUTIL_OPT_H */ |
| @@ -878,6 +878,52 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 877 unmodified lines | ||
| 878 | 878 | }, |
| 879 | 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 | 927 | [PIX_FMT_DXVA2_VLD] = { |
| 882 | 928 | .name = "dxva2_vld", |
| 883 | 929 | .log2_chroma_w = 1, |
| @@ -136,15 +136,19 @@ enum PixelFormat { · 135 unmodified lines | ||
| 136 | 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-endian |
| 137 | 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-endian |
| 138 | 138 | |
| 139 | − //the following 6 formats have the disadvantage of needing 1 format for each bit depth, thus | |
| 139 | + //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus | |
| 140 | 140 | //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately |
| 141 | 141 | //is better |
| 142 | 142 | PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian |
| 143 | 143 | PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian |
| 144 | 144 | PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian |
| 145 | 145 | 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-endian | |
| 147 | − PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian | |
| 146 | + 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), 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 | 153 | 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 | 177 | #define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE) |
| 174 | 178 | |
| 175 | 179 | #define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE) |
| 180 | +#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE) | |
| 176 | 181 | #define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE) |
| 177 | 182 | #define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE) |
| 183 | +#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE) | |
| 178 | 184 | #define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE) |
| 179 | 185 | #define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE) |
| 180 | 186 | #define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE) |
| @@ -724,7 +724,117 @@ yuv2mono_1_c_template(SwsContext *c, const uint16_t *buf0, · 723 unmodified lines | ||
| 724 | 724 | YUV2PACKEDWRAPPER(yuv2mono, white, PIX_FMT_MONOWHITE); |
| 725 | 725 | YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); |
| 726 | 726 | |
| 727 | −#define YSCALE_YUV_2_PACKEDX_C(type,alpha) \ | |
| 727 | +static av_always_inline void | |
| 728 | +yuv2422_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 | + | |
| 779 | +static av_always_inline void | |
| 780 | +yuv2422_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 | + | |
| 802 | +static av_always_inline void | |
| 803 | +yuv2422_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 | + | |
| 834 | +YUV2PACKEDWRAPPER(yuv2422, yuyv, PIX_FMT_YUYV422); | |
| 835 | +YUV2PACKEDWRAPPER(yuv2422, uyvy, PIX_FMT_UYVY422); | |
| 836 | + | |
| 837 | +#define YSCALE_YUV_2_RGBX_C(type,alpha) \ | |
| 728 | 838 | for (i=0; i<(dstW>>1); i++) {\ |
| 729 | 839 | int j;\ |
| 730 | 840 | int Y1 = 1<<18;\ |
| @@ -766,7 +876,11 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 35 unmodified lines | ||
| 766 | 876 | A1 = av_clip_uint8(A1); \ |
| 767 | 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 | 885 | #define YSCALE_YUV_2_RGBX_FULL_C(rnd,alpha) \ |
| 772 | 886 | for (i=0; i<dstW; i++) {\ |
| @@ -807,13 +921,7 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 34 unmodified lines | ||
| 807 | 921 | B = av_clip_uintp2(B, 30); \ |
| 808 | 922 | } |
| 809 | 923 | |
| 810 | −#define YSCALE_YUV_2_RGBX_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) \ | |
| 924 | +#define YSCALE_YUV_2_RGB2_C(type,alpha) \ | |
| 817 | 925 | for (i=0; i<(dstW>>1); i++) { \ |
| 818 | 926 | const int i2= 2*i; \ |
| 819 | 927 | int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \ |
| @@ -825,15 +933,12 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 5 unmodified lines | ||
| 825 | 933 | if (alpha) {\ |
| 826 | 934 | A1= (abuf0[i2 ]*yalpha1+abuf1[i2 ]*yalpha)>>19; \ |
| 827 | 935 | A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19; \ |
| 828 | − } | |
| 829 | − | |
| 830 | −#define YSCALE_YUV_2_RGB2_C(type,alpha) \ | |
| 831 | − YSCALE_YUV_2_PACKED2_C(type,alpha)\ | |
| 936 | + }\ | |
| 832 | 937 | r = (type *)c->table_rV[V];\ |
| 833 | 938 | g = (type *)(c->table_gU[U] + c->table_gV[V]);\ |
| 834 | 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 | 942 | for (i=0; i<(dstW>>1); i++) {\ |
| 838 | 943 | const int i2= 2*i;\ |
| 839 | 944 | int Y1= buf0[i2 ]>>7;\ |
| @@ -845,15 +950,12 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 5 unmodified lines | ||
| 845 | 950 | if (alpha) {\ |
| 846 | 951 | A1= abuf0[i2 ]>>7;\ |
| 847 | 952 | A2= abuf0[i2+1]>>7;\ |
| 848 | − } | |
| 849 | − | |
| 850 | −#define YSCALE_YUV_2_RGB1_C(type,alpha) \ | |
| 851 | − YSCALE_YUV_2_PACKED1_C(type,alpha)\ | |
| 953 | + }\ | |
| 852 | 954 | r = (type *)c->table_rV[V];\ |
| 853 | 955 | g = (type *)(c->table_gU[U] + c->table_gV[V]);\ |
| 854 | 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 | 959 | for (i=0; i<(dstW>>1); i++) {\ |
| 858 | 960 | const int i2= 2*i;\ |
| 859 | 961 | int Y1= buf0[i2 ]>>7;\ |
| @@ -865,15 +967,12 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 5 unmodified lines | ||
| 865 | 967 | if (alpha) {\ |
| 866 | 968 | A1= abuf0[i2 ]>>7;\ |
| 867 | 969 | A2= abuf0[i2+1]>>7;\ |
| 868 | − } | |
| 869 | − | |
| 870 | −#define YSCALE_YUV_2_RGB1B_C(type,alpha) \ | |
| 871 | − YSCALE_YUV_2_PACKED1B_C(type,alpha)\ | |
| 970 | + }\ | |
| 872 | 971 | r = (type *)c->table_rV[V];\ |
| 873 | 972 | g = (type *)(c->table_gU[U] + c->table_gV[V]);\ |
| 874 | 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 | 976 | switch(c->dstFormat) {\ |
| 878 | 977 | case PIX_FMT_RGB48BE:\ |
| 879 | 978 | case PIX_FMT_RGB48LE:\ |
| @@ -1049,22 +1148,6 @@ YUV2PACKEDWRAPPER(yuv2mono, black, PIX_FMT_MONOBLACK); · 169 unmodified lines | ||
| 1049 | 1148 | }\ |
| 1050 | 1149 | }\ |
| 1051 | 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 | |
| 1070 | 1153 | static 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 | 1157 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) |
| 1075 | 1158 | { |
| 1076 | 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 | |
| 1080 | 1163 | static 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 | 1260 | int uvalpha1=4095-uvalpha; |
| 1178 | 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 | 1276 | int i; |
| 1194 | 1277 | |
| 1195 | 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 | 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 | 1969 | } else if (is16BPS(dstFormat)) { |
| 1887 | 1970 | *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c; |
| 1888 | 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 | 1973 | *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c; |
| 1891 | 1974 | } else { |
| 1892 | 1975 | *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c; |
| @@ -1919,6 +2002,16 @@ find_c_packed_planar_out_funcs(SwsContext *c, · 26 unmodified lines | ||
| 1919 | 2002 | *yuv2packed2 = yuv2monoblack_2_c; |
| 1920 | 2003 | *yuv2packedX = yuv2monoblack_X_c; |
| 1921 | 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 | 2015 | default: |
| 1923 | 2016 | *yuv2packed1 = yuv2packed1_c; |
| 1924 | 2017 | *yuv2packed2 = yuv2packed2_c; |
| @@ -2221,16 +2314,20 @@ static av_cold void sws_init_swScale_c(SwsContext *c) · 296 unmodified lines | ||
| 2221 | 2314 | case PIX_FMT_BGR4_BYTE: |
| 2222 | 2315 | case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break; |
| 2223 | 2316 | case PIX_FMT_GRAY16BE : |
| 2317 | + case PIX_FMT_YUV444P9BE: | |
| 2224 | 2318 | case PIX_FMT_YUV420P9BE: |
| 2319 | + case PIX_FMT_YUV444P10BE: | |
| 2225 | 2320 | case PIX_FMT_YUV422P10BE: |
| 2226 | 2321 | case PIX_FMT_YUV420P10BE: |
| 2227 | 2322 | case PIX_FMT_YUV420P16BE: |
| 2228 | 2323 | case PIX_FMT_YUV422P16BE: |
| 2229 | 2324 | case PIX_FMT_YUV444P16BE: c->hScale16= HAVE_BIGENDIAN ? hScale16_c : hScale16X_c; break; |
| 2230 | 2325 | case PIX_FMT_GRAY16LE : |
| 2326 | + case PIX_FMT_YUV444P9LE: | |
| 2231 | 2327 | case PIX_FMT_YUV420P9LE: |
| 2232 | 2328 | case PIX_FMT_YUV422P10LE: |
| 2233 | 2329 | case PIX_FMT_YUV420P10LE: |
| 2330 | + case PIX_FMT_YUV444P10LE: | |
| 2234 | 2331 | case PIX_FMT_YUV420P16LE: |
| 2235 | 2332 | case PIX_FMT_YUV422P16LE: |
| 2236 | 2333 | case PIX_FMT_YUV444P16LE: c->hScale16= HAVE_BIGENDIAN ? hScale16X_c : hScale16_c; break; |
| @@ -371,6 +371,12 @@ const char *sws_format_name(enum PixelFormat format); · 370 unmodified lines | ||
| 371 | 371 | #define isNBPS(x) ( \ |
| 372 | 372 | (x)==PIX_FMT_YUV420P9LE \ |
| 373 | 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 | 380 | || (x)==PIX_FMT_YUV420P10LE \ |
| 375 | 381 | || (x)==PIX_FMT_YUV420P10BE \ |
| 376 | 382 | || (x)==PIX_FMT_YUV422P10LE \ |
| @@ -392,13 +398,19 @@ const char *sws_format_name(enum PixelFormat format); · 15 unmodified lines | ||
| 392 | 398 | #define isPlanarYUV(x) ( \ |
| 393 | 399 | isPlanar8YUV(x) \ |
| 394 | 400 | || (x)==PIX_FMT_YUV420P9LE \ |
| 401 | + || (x)==PIX_FMT_YUV444P9LE \ | |
| 395 | 402 | || (x)==PIX_FMT_YUV420P10LE \ |
| 403 | + || (x)==PIX_FMT_YUV422P10LE \ | |
| 404 | + || (x)==PIX_FMT_YUV444P10LE \ | |
| 396 | 405 | || (x)==PIX_FMT_YUV420P16LE \ |
| 397 | 406 | || (x)==PIX_FMT_YUV422P10LE \ |
| 398 | 407 | || (x)==PIX_FMT_YUV422P16LE \ |
| 399 | 408 | || (x)==PIX_FMT_YUV444P16LE \ |
| 400 | 409 | || (x)==PIX_FMT_YUV420P9BE \ |
| 410 | + || (x)==PIX_FMT_YUV444P9BE \ | |
| 401 | 411 | || (x)==PIX_FMT_YUV420P10BE \ |
| 412 | + || (x)==PIX_FMT_YUV422P10BE \ | |
| 413 | + || (x)==PIX_FMT_YUV444P10BE \ | |
| 402 | 414 | || (x)==PIX_FMT_YUV420P16BE \ |
| 403 | 415 | || (x)==PIX_FMT_YUV422P10BE \ |
| 404 | 416 | || (x)==PIX_FMT_YUV422P16BE \ |
| @@ -112,12 +112,18 @@ const char *swscale_license(void) · 111 unmodified lines | ||
| 112 | 112 | || (x)==PIX_FMT_MONOWHITE \ |
| 113 | 113 | || (x)==PIX_FMT_MONOBLACK \ |
| 114 | 114 | || (x)==PIX_FMT_YUV420P9LE \ |
| 115 | + || (x)==PIX_FMT_YUV444P9LE \ | |
| 115 | 116 | || (x)==PIX_FMT_YUV420P10LE \ |
| 117 | + || (x)==PIX_FMT_YUV422P10LE \ | |
| 118 | + || (x)==PIX_FMT_YUV444P10LE \ | |
| 116 | 119 | || (x)==PIX_FMT_YUV420P16LE \ |
| 117 | 120 | || (x)==PIX_FMT_YUV422P16LE \ |
| 118 | 121 | || (x)==PIX_FMT_YUV444P16LE \ |
| 119 | 122 | || (x)==PIX_FMT_YUV420P9BE \ |
| 123 | + || (x)==PIX_FMT_YUV444P9BE \ | |
| 120 | 124 | || (x)==PIX_FMT_YUV420P10BE \ |
| 125 | + || (x)==PIX_FMT_YUV444P10BE \ | |
| 126 | + || (x)==PIX_FMT_YUV422P10BE \ | |
| 121 | 127 | || (x)==PIX_FMT_YUV420P16BE \ |
| 122 | 128 | || (x)==PIX_FMT_YUV422P16BE \ |
| 123 | 129 | || (x)==PIX_FMT_YUV444P16BE \ |