[libav-devel] [PATCH] asvenc: Forward the error instead of asserting on it
Bug-Id: CID 732997 CC: libav-sta...@libav.org --- Now w/out the silly typo. libavcodec/asvenc.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index 98baaec..d865c2e 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -107,7 +107,7 @@ static inline void asv1_encode_block(ASV1Context *a, int16_t block[64]) put_bits(a-pb, ff_asv_ccp_tab[16][1], ff_asv_ccp_tab[16][0]); } -static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) +static inline int asv2_encode_block(ASV1Context *a, int16_t block[64]) { int i; int count = 0; @@ -141,7 +141,8 @@ static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) a-q_intra_matrix[index + 9] + (1 15)) 16)) ccp |= 1; -assert(i || ccp 8); +if (!i ccp = 8) +return AVERROR_BUG; if (i) put_bits(a-pb, ff_asv_ac_ccp_tab[ccp][1], ff_asv_ac_ccp_tab[ccp][0]); else @@ -158,13 +159,15 @@ static inline void asv2_encode_block(ASV1Context *a, int16_t block[64]) asv2_put_level(a-pb, block[index + 9]); } } + +return 0; } #define MAX_MB_SIZE (30 * 16 * 16 * 3 / 2 / 8) static inline int encode_mb(ASV1Context *a, int16_t block[6][64]) { -int i; +int i, ret; if (a-pb.buf_end - a-pb.buf - (put_bits_count(a-pb) 3) MAX_MB_SIZE) { av_log(a-avctx, AV_LOG_ERROR, encoded frame too large\n); @@ -175,8 +178,11 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]) for (i = 0; i 6; i++) asv1_encode_block(a, block[i]); } else { -for (i = 0; i 6; i++) -asv2_encode_block(a, block[i]); +for (i = 0; i 6; i++) { +ret = asv2_encode_block(a, block[i]); +if (ret 0) +return ret; +} } return 0; } -- 2.1.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] oggdec: add support for VP8 demuxing
On 12/12/14 21:57, Vittorio Giovara wrote: From: James Almer jamr...@gmail.com Signed-off-by: James Almer jamr...@gmail.com Signed-off-by: Michael Niedermayer michae...@gmx.at Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com --- Changelog | 1 + libavformat/Makefile | 1 + libavformat/oggdec.c | 1 + libavformat/oggdec.h | 1 + libavformat/oggparsevp8.c | 142 ++ libavformat/version.h | 4 +- 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 libavformat/oggparsevp8.c diff --git a/Changelog b/Changelog index 6af2e8a..581f377 100644 --- a/Changelog +++ b/Changelog @@ -7,6 +7,7 @@ version next: - avplay now exits by default at the end of playback - XCB-based screen-grabber - creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer +- VP8 in Ogg demuxing Looks fine to me. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCHv2 0/10] VDPAU H.264 High 4:4:4 support
The following changes since commit e737a4aaafcb1d761b7f96043c2f83ce742c64ae: dashenc: Change the duration fields to 64 bit (2014-12-10 22:51:51 +0200) are waiting for review up to. vdpau: add support for the H.264 High 4:4:4 Predictive profile (2014-12-13 18:39:01 +0200) Updates since last changes: - resync with libvdpau git tree, - address comments from Luca and Vittorio, - misc minor fixes. Rémi Denis-Courmont (10): vdpau: revector macro to reduce line span vdpau: add mapping for H.264 Extended profile vdpau: add mapping for H.264 Constrained Baseline profile and fallback vdpau: add helper for surface chroma type and size avconv_vdpau: allocate video surface of VDPAU-specified size libavcodec: add AV_HWACCEL_ALLOW_HIGH_DEPTH flag vdpau: add common support for other surface chroma types h264: factor hwaccel pixel formats list vdpau: add support for 4:2:2 and 4:4:4 chroma sampling in H.264 vdpau: add support for the H.264 High 4:4:4 Predictive profile avconv_vdpau.c | 9 +++- doc/APIchanges | 6 +++ libavcodec/avcodec.h| 6 +++ libavcodec/h264_slice.c | 89 +++- libavcodec/vdpau.c | 107 +++- libavcodec/vdpau.h | 20 + libavcodec/vdpau_h264.c | 57 ++- libavcodec/vdpau_internal.h | 17 --- libavcodec/vdpau_mpeg12.c | 6 ++- libavcodec/vdpau_mpeg4.c| 6 ++- libavcodec/vdpau_vc1.c | 3 +- libavcodec/version.h| 2 +- 12 files changed, 236 insertions(+), 92 deletions(-) -- Rémi Denis-Courmont http://www.remlab.net/ ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 03/10] vdpau: add mapping for H.264 Constrained Baseline profile and fallback
Old VDPAU drivers do not support this newly defined profile, so falling back to Main profile is necessary for backward binary compatibility. --- libavcodec/vdpau.c | 9 + libavcodec/vdpau_h264.c | 4 2 files changed, 13 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 1e891ed..ccb3352 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -125,6 +125,15 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, status = decoder_query_caps(vdctx-device, profile, supported, max_level, max_mb, max_width, max_height); +#ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE +if (status != VDP_STATUS_OK profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) { +/* Run-time backward compatibility for libvdpau 0.8 and earlier */ +profile = VDP_DECODER_PROFILE_H264_MAIN; +status = decoder_query_caps(vdctx-device, profile, supported, +max_level, max_mb, +max_width, max_height); +} +#endif if (status != VDP_STATUS_OK) return vdpau_error(status); diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index d18a970..5ed1fff 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -213,6 +213,10 @@ static int vdpau_h264_init(AVCodecContext *avctx) profile = VDP_DECODER_PROFILE_H264_BASELINE; break; case FF_PROFILE_H264_CONSTRAINED_BASELINE: +#ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE +profile = VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE; +break; +#endif case FF_PROFILE_H264_MAIN: profile = VDP_DECODER_PROFILE_H264_MAIN; break; -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 07/10] vdpau: add common support for other surface chroma types
--- libavcodec/vdpau.c | 38 ++ libavcodec/vdpau_h264.c | 2 +- libavcodec/vdpau_internal.h | 3 ++- libavcodec/vdpau_mpeg12.c | 6 -- libavcodec/vdpau_mpeg4.c| 6 -- libavcodec/vdpau_vc1.c | 3 ++- 6 files changed, 43 insertions(+), 15 deletions(-) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 8d9a649..463e600 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -67,20 +67,38 @@ static int vdpau_error(VdpStatus status) int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, uint32_t *width, uint32_t *height) { -/* XXX: only 8-bits YCbCr 4:2:0 is supported yet */ -if (type) -*type = VDP_CHROMA_TYPE_420; +VdpChromaType t = VDP_CHROMA_TYPE_420; +uint32_t w = avctx-coded_width; +uint32_t h = avctx-coded_height; + /* See vdpau/vdpau.h for per-type alignment constraints. */ +switch (t) +{ +case VDP_CHROMA_TYPE_420: +w = (w + 1) ~1; +h = (h + 3) ~3; +break; +case VDP_CHROMA_TYPE_422: +w = (w + 1) ~1; +h = (h + 1) ~1; +break; +case VDP_CHROMA_TYPE_444: +h = (h + 1) ~1; +break; +} + +if (type) +*type = t; if (width) -*width = (avctx-coded_width + 1) ~1; +*width = w; if (height) -*height = (avctx-coded_height + 3) ~3; +*height = h; return 0; } int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, - int level) + int level, VdpChromaType type) { VDPAUHWContext *hwctx = avctx-hwaccel_context; VDPAUContext *vdctx = avctx-internal-hwaccel_priv_data; @@ -91,10 +109,10 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, VdpStatus status; VdpBool supported; uint32_t max_level, max_mb, max_width, max_height; -VdpChromaType type; uint32_t width; uint32_t height; +vdctx-chroma_type = type; vdctx-width= UINT32_MAX; vdctx-height = UINT32_MAX; hwctx-reset= 0; @@ -114,6 +132,10 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, else if (level 0) return AVERROR(ENOTSUP); +if (!(hwctx-flags AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) +type != VDP_CHROMA_TYPE_420) +return AVERROR(ENOSYS); + status = vdctx-get_proc_address(vdctx-device, VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, func); @@ -122,7 +144,7 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, else surface_query_caps = func; -av_vdpau_get_surface_parameters(avctx, type, width, height); +av_vdpau_get_surface_parameters(avctx, NULL, width, height); status = surface_query_caps(vdctx-device, type, supported, max_width, max_height); diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 5ed1fff..6774882 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -235,7 +235,7 @@ static int vdpau_h264_init(AVCodecContext *avctx) if ((avctx-profile FF_PROFILE_H264_INTRA) avctx-level == 11) level = VDP_DECODER_LEVEL_H264_1b; -return ff_vdpau_common_init(avctx, profile, level); +return ff_vdpau_common_init(avctx, profile, level, VDP_CHROMA_TYPE_420); } AVHWAccel ff_h264_vdpau_hwaccel = { diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 16493b0..bcdeb90 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -77,6 +77,7 @@ typedef struct VDPAUContext { */ VdpDecoderRender *render; +VdpChromaType chroma_type; uint32_t width; uint32_t height; } VDPAUContext; @@ -104,7 +105,7 @@ struct vdpau_picture_context { }; int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, - int level); + int level, VdpChromaType type); int ff_vdpau_common_uninit(AVCodecContext *avctx); int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic, diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index 421abe9..bafe83c 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -98,7 +98,8 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, static int vdpau_mpeg1_init(AVCodecContext *avctx) { return ff_vdpau_common_init(avctx, VDP_DECODER_PROFILE_MPEG1, -VDP_DECODER_LEVEL_MPEG1_NA); +VDP_DECODER_LEVEL_MPEG1_NA, +VDP_CHROMA_TYPE_420); } AVHWAccel ff_mpeg1_vdpau_hwaccel = { @@ -132,7 +133,8 @@ static int vdpau_mpeg2_init(AVCodecContext *avctx) return AVERROR(EINVAL); } -
[libav-devel] [PATCH 10/10] vdpau: add support for the H.264 High 4:4:4 Predictive profile
--- libavcodec/vdpau_h264.c | 19 +++ libavcodec/vdpau_internal.h | 11 +-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 578b711..b7f79bf 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -123,6 +123,9 @@ static int vdpau_h264_start_frame(AVCodecContext *avctx, H264Picture *pic = h-cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic-hwaccel_picture_private; VdpPictureInfoH264 *info = pic_ctx-info.h264; +#ifdef VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE +VdpPictureInfoH264Predictive *info2 = pic_ctx-info.h264_predictive; +#endif /* init VdpPictureInfoH264 */ info-slice_count= 0; @@ -149,6 +152,10 @@ static int vdpau_h264_start_frame(AVCodecContext *avctx, info-log2_max_pic_order_cnt_lsb_minus4 = h-sps.poc_type ? 0 : h-sps.log2_max_poc_lsb - 4; info-delta_pic_order_always_zero_flag = h-sps.delta_pic_order_always_zero_flag; info-direct_8x8_inference_flag = h-sps.direct_8x8_inference_flag; +#ifdef VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE +info2-qpprime_y_zero_transform_bypass_flag = h-sps.transform_bypass; +info2-separate_colour_plane_flag= h-sps.residual_color_transform_flag; +#endif info-entropy_coding_mode_flag = h-pps.cabac; info-pic_order_present_flag = h-pps.pic_order_present; info-deblocking_filter_control_present_flag = h-pps.deblocking_filter_parameters_present; @@ -255,6 +262,18 @@ static int vdpau_h264_init(AVCodecContext *avctx) profile = VDP_DECODER_PROFILE_H264_EXTENDED; break; #endif +case FF_PROFILE_H264_HIGH_10: +/* XXX: High 10 can be treated as High so long as only 8-bits per + * formats are supported. */ +profile = VDP_DECODER_PROFILE_H264_HIGH; +break; +#ifdef VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE +case FF_PROFILE_H264_HIGH_422: +case FF_PROFILE_H264_HIGH_444_PREDICTIVE: +case FF_PROFILE_H264_CAVLC_444: +profile = VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE; +break; +#endif default: return AVERROR(ENOTSUP); } diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 05b3361..39b 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -37,16 +37,15 @@ static inline uintptr_t ff_vdpau_get_surface_id(AVFrame *pic) return (uintptr_t)pic-data[3]; } -#if !FF_API_BUFS_VDPAU -union AVVDPAUPictureInfo { +union VDPAUPictureInfo { VdpPictureInfoH264h264; VdpPictureInfoMPEG1Or2mpeg; VdpPictureInfoVC1 vc1; VdpPictureInfoMPEG4Part2 mpeg4; -}; -#else -#include vdpau.h +#ifdef VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE +VdpPictureInfoH264Predictive h264_predictive; #endif +}; typedef struct VDPAUHWContext { AVVDPAUContext context; @@ -86,7 +85,7 @@ struct vdpau_picture_context { /** * VDPAU picture information. */ -union AVVDPAUPictureInfo info; +union VDPAUPictureInfo info; /** * Allocated size of the bitstream_buffers table. -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 09/10] vdpau: add support for 4:2:2 and 4:4:4 chroma sampling in H.264
--- libavcodec/h264_slice.c | 6 +++--- libavcodec/vdpau.c | 11 +++ libavcodec/vdpau_h264.c | 29 - libavcodec/vdpau_internal.h | 3 +++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index fe9c0e9..6379d29 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -970,6 +970,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h) *fmt++ = AV_PIX_FMT_YUV420P10; break; case 8: +#if CONFIG_H264_VDPAU_HWACCEL +*fmt++ = AV_PIX_FMT_VDPAU; +#endif if (CHROMA444(h)) { if (h-avctx-colorspace == AVCOL_SPC_RGB) *fmt++ = AV_PIX_FMT_GBRP; @@ -993,9 +996,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h) *fmt++ = AV_PIX_FMT_VDA_VLD; *fmt++ = AV_PIX_FMT_VDA; #endif -#if CONFIG_H264_VDPAU_HWACCEL -*fmt++ = AV_PIX_FMT_VDPAU; -#endif if (h-avctx-codec-pix_fmts) choices = h-avctx-codec-pix_fmts; else if (h-avctx-color_range == AVCOL_RANGE_JPEG) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 463e600..e22ab1e 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -70,6 +70,17 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, VdpChromaType t = VDP_CHROMA_TYPE_420; uint32_t w = avctx-coded_width; uint32_t h = avctx-coded_height; +int val = 0; + +switch (avctx-codec_id) +{ +case AV_CODEC_ID_H264: +val = ff_vdpau_h264_get_chroma_type(avctx, t); +break; +} + +if (val 0) +return val; /* See vdpau/vdpau.h for per-type alignment constraints. */ switch (t) diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 6774882..578b711 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -203,10 +203,37 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx) return 0; } +int ff_vdpau_h264_get_chroma_type(const AVCodecContext *avctx, + VdpChromaType *type) +{ +const H264Context *h = avctx-priv_data; + +switch (h-sps.chroma_format_idc) { +case 1: +*type = VDP_CHROMA_TYPE_420; +break; +case 2: +*type = VDP_CHROMA_TYPE_422; +break; +case 3: +*type = VDP_CHROMA_TYPE_444; +break; +default: +return AVERROR(ENOSYS); +} +return 0; +} + static int vdpau_h264_init(AVCodecContext *avctx) { VdpDecoderProfile profile; uint32_t level = avctx-level; +VdpChromaType type; +int val; + +val = ff_vdpau_h264_get_chroma_type(avctx, type); +if (val 0) +return val; switch (avctx-profile ~FF_PROFILE_H264_INTRA) { case FF_PROFILE_H264_BASELINE: @@ -235,7 +262,7 @@ static int vdpau_h264_init(AVCodecContext *avctx) if ((avctx-profile FF_PROFILE_H264_INTRA) avctx-level == 11) level = VDP_DECODER_LEVEL_H264_1b; -return ff_vdpau_common_init(avctx, profile, level, VDP_CHROMA_TYPE_420); +return ff_vdpau_common_init(avctx, profile, level, type); } AVHWAccel ff_h264_vdpau_hwaccel = { diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index bcdeb90..05b3361 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -116,4 +116,7 @@ int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx); int ff_vdpau_add_buffer(struct vdpau_picture_context *pic, const uint8_t *buf, uint32_t buf_size); +int ff_vdpau_h264_get_chroma_type(const AVCodecContext *avctx, + VdpChromaType *type); + #endif /* AVCODEC_VDPAU_INTERNAL_H */ -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 02/10] vdpau: add mapping for H.264 Extended profile
--- libavcodec/vdpau.c | 3 +++ libavcodec/vdpau_h264.c | 5 + 2 files changed, 8 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index fd3ae62..1e891ed 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -291,6 +291,9 @@ do { \ case FF_PROFILE_H264_CONSTRAINED_BASELINE: case FF_PROFILE_H264_MAIN: PROFILE(H264_MAIN); case FF_PROFILE_H264_HIGH: PROFILE(H264_HIGH); +#ifdef VDP_DECODER_PROFILE_H264_EXTENDED +case FF_PROFILE_H264_EXTENDED: PROFILE(H264_EXTENDED); +#endif default: return AVERROR(EINVAL); } case AV_CODEC_ID_WMV3: diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 4103328..d18a970 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -219,6 +219,11 @@ static int vdpau_h264_init(AVCodecContext *avctx) case FF_PROFILE_H264_HIGH: profile = VDP_DECODER_PROFILE_H264_HIGH; break; +#ifdef VDP_DECODER_PROFILE_H264_EXTENDED +case FF_PROFILE_H264_EXTENDED: +profile = VDP_DECODER_PROFILE_H264_EXTENDED; +break; +#endif default: return AVERROR(ENOTSUP); } -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 04/10] vdpau: add helper for surface chroma type and size
Since the VDPAU pixel format does not distinguish between different VDPAU video surface chroma types, we need another way to pass this data to the application. Originally VDPAU in libavcodec only supported decoding to 8-bits YUV with 4:2:0 chroma sampling. Correspondingly, applications assumed that libavcodec expected VDP_CHROMA_TYPE_420 video surfaces for output. However some of the new HEVC profiles proposed for addition to VDPAU would require different depth and/or sampling: http://lists.freedesktop.org/archives/vdpau/2014-July/000167.html ...as would lossless AVC profiles: http://lists.freedesktop.org/archives/vdpau/2014-November/000241.html To preserve backward binary compatibility with existing applications, a new av_vdpau_bind_context() flag is introduced in a further change. --- doc/APIchanges | 3 +++ libavcodec/vdpau.c | 25 + libavcodec/vdpau.h | 20 libavcodec/version.h | 2 +- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 3d1b72f..066779a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2014-08-09 API changes, most recent first: +201x-xx-xx - xxx - lavc 56.7.0 - vdpau.h + Add av_vdpau_get_surface_parameters(). + 2014-11-xx - xxx - lavf 56.06.3 - avformat.h Add AVFormatContext.avoid_negative_ts. diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index ccb3352..edf09f1 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -64,6 +64,21 @@ static int vdpau_error(VdpStatus status) } } +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, +uint32_t *width, uint32_t *height) +{ +/* XXX: only 8-bits YCbCr 4:2:0 is supported yet */ +if (type) +*type = VDP_CHROMA_TYPE_420; +/* See vdpau/vdpau.h for per-type alignment constraints. */ +if (width) +*width = (avctx-coded_width + 1) ~1; +if (height) +*height = (avctx-coded_height + 3) ~3; + +return 0; +} + int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level) { @@ -76,9 +91,9 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, VdpStatus status; VdpBool supported; uint32_t max_level, max_mb, max_width, max_height; -/* See vdpau/vdpau.h for alignment constraints. */ -uint32_t width = (avctx-coded_width + 1) ~1; -uint32_t height = (avctx-coded_height + 3) ~3; +VdpChromaType type; +uint32_t width; +uint32_t height; vdctx-width= UINT32_MAX; vdctx-height = UINT32_MAX; @@ -107,7 +122,9 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, else surface_query_caps = func; -status = surface_query_caps(vdctx-device, VDP_CHROMA_TYPE_420, supported, +av_vdpau_get_surface_parameters(avctx, type, width, height); + +status = surface_query_caps(vdctx-device, type, supported, max_width, max_height); if (status != VDP_STATUS_OK) return vdpau_error(status); diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h index 24c3b02..4e5c351 100644 --- a/libavcodec/vdpau.h +++ b/libavcodec/vdpau.h @@ -151,6 +151,26 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, VdpGetProcAddress *get_proc_address, unsigned flags); /** + * Gets the parameters to create an adequate VDPAU video surface for the codec + * context using VDPAU hardware decoding acceleration. + * + * @note Behavior is undefined if the context was not successfully bound to a + * VDPAU device using av_vdpau_bind_context(). + * + * @param avctx the codec context being used for decoding the stream + * @param type storage space for the VDPAU video surface chroma type + * (or NULL to ignore) + * @param width storage space for the VDPAU video surface pixel width + * (or NULL to ignore) + * @param height storage space for the VDPAU video surface pixel height + * (or NULL to ignore) + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, +uint32_t *width, uint32_t *height); + +/** * Allocate an AVVDPAUContext. * * @return Newly-allocated AVVDPAUContext or NULL on failure. diff --git a/libavcodec/version.h b/libavcodec/version.h index fd774a7..f51c9d7 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include libavutil/version.h #define LIBAVCODEC_VERSION_MAJOR 56 -#define LIBAVCODEC_VERSION_MINOR 6 +#define LIBAVCODEC_VERSION_MINOR 7 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.1.3 ___ libav-devel mailing
[libav-devel] [PATCH 08/10] h264: factor hwaccel pixel formats list
This is to avoid proliferation of similar tables in following changes. --- libavcodec/h264_slice.c | 89 +++-- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 42d0c95..fe9c0e9 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -143,42 +143,6 @@ static const uint8_t dequant8_coeff_init[6][6] = { { 36, 32, 58, 34, 46, 43 }, }; -static const enum AVPixelFormat h264_hwaccel_pixfmt_list_420[] = { -#if CONFIG_H264_DXVA2_HWACCEL -AV_PIX_FMT_DXVA2_VLD, -#endif -#if CONFIG_H264_VAAPI_HWACCEL -AV_PIX_FMT_VAAPI_VLD, -#endif -#if CONFIG_H264_VDA_HWACCEL -AV_PIX_FMT_VDA_VLD, -AV_PIX_FMT_VDA, -#endif -#if CONFIG_H264_VDPAU_HWACCEL -AV_PIX_FMT_VDPAU, -#endif -AV_PIX_FMT_YUV420P, -AV_PIX_FMT_NONE -}; - -static const enum AVPixelFormat h264_hwaccel_pixfmt_list_jpeg_420[] = { -#if CONFIG_H264_DXVA2_HWACCEL -AV_PIX_FMT_DXVA2_VLD, -#endif -#if CONFIG_H264_VAAPI_HWACCEL -AV_PIX_FMT_VAAPI_VLD, -#endif -#if CONFIG_H264_VDA_HWACCEL -AV_PIX_FMT_VDA_VLD, -AV_PIX_FMT_VDA, -#endif -#if CONFIG_H264_VDPAU_HWACCEL -AV_PIX_FMT_VDPAU, -#endif -AV_PIX_FMT_YUVJ420P, -AV_PIX_FMT_NONE -}; - static void release_unused_pictures(H264Context *h, int remove_current) { @@ -975,54 +939,69 @@ static int clone_slice(H264Context *dst, H264Context *src) static enum AVPixelFormat get_pixel_format(H264Context *h) { -enum AVPixelFormat pix_fmts[2]; +#define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ + CONFIG_H264_VAAPI_HWACCEL + \ + (CONFIG_H264_VDA_HWACCEL * 2) + \ + CONFIG_H264_VDPAU_HWACCEL) +enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; const enum AVPixelFormat *choices = pix_fmts; -pix_fmts[1] = AV_PIX_FMT_NONE; - switch (h-sps.bit_depth_luma) { case 9: if (CHROMA444(h)) { if (h-avctx-colorspace == AVCOL_SPC_RGB) { -pix_fmts[0] = AV_PIX_FMT_GBRP9; +*fmt++ = AV_PIX_FMT_GBRP9; } else -pix_fmts[0] = AV_PIX_FMT_YUV444P9; +*fmt++ = AV_PIX_FMT_YUV444P9; } else if (CHROMA422(h)) -pix_fmts[0] = AV_PIX_FMT_YUV422P9; +*fmt++ = AV_PIX_FMT_YUV422P9; else -pix_fmts[0] = AV_PIX_FMT_YUV420P9; +*fmt++ = AV_PIX_FMT_YUV420P9; break; case 10: if (CHROMA444(h)) { if (h-avctx-colorspace == AVCOL_SPC_RGB) { -pix_fmts[0] = AV_PIX_FMT_GBRP10; +*fmt++ = AV_PIX_FMT_GBRP10; } else -pix_fmts[0] = AV_PIX_FMT_YUV444P10; +*fmt++ = AV_PIX_FMT_YUV444P10; } else if (CHROMA422(h)) -pix_fmts[0] = AV_PIX_FMT_YUV422P10; +*fmt++ = AV_PIX_FMT_YUV422P10; else -pix_fmts[0] = AV_PIX_FMT_YUV420P10; +*fmt++ = AV_PIX_FMT_YUV420P10; break; case 8: if (CHROMA444(h)) { if (h-avctx-colorspace == AVCOL_SPC_RGB) -pix_fmts[0] = AV_PIX_FMT_GBRP; +*fmt++ = AV_PIX_FMT_GBRP; else if (h-avctx-color_range == AVCOL_RANGE_JPEG) -pix_fmts[0] = AV_PIX_FMT_YUVJ444P; +*fmt++ = AV_PIX_FMT_YUVJ444P; else -pix_fmts[0] = AV_PIX_FMT_YUV444P; +*fmt++ = AV_PIX_FMT_YUV444P; } else if (CHROMA422(h)) { if (h-avctx-color_range == AVCOL_RANGE_JPEG) -pix_fmts[0] = AV_PIX_FMT_YUVJ422P; +*fmt++ = AV_PIX_FMT_YUVJ422P; else -pix_fmts[0] = AV_PIX_FMT_YUV422P; +*fmt++ = AV_PIX_FMT_YUV422P; } else { +#if CONFIG_H264_DXVA2_HWACCEL +*fmt++ = AV_PIX_FMT_DXVA2_VLD; +#endif +#if CONFIG_H264_VAAPI_HWACCEL +*fmt++ = AV_PIX_FMT_VAAPI_VLD; +#endif +#if CONFIG_H264_VDA_HWACCEL +*fmt++ = AV_PIX_FMT_VDA_VLD; +*fmt++ = AV_PIX_FMT_VDA; +#endif +#if CONFIG_H264_VDPAU_HWACCEL +*fmt++ = AV_PIX_FMT_VDPAU; +#endif if (h-avctx-codec-pix_fmts) choices = h-avctx-codec-pix_fmts; else if (h-avctx-color_range == AVCOL_RANGE_JPEG) -choices = h264_hwaccel_pixfmt_list_jpeg_420; +*fmt++ = AV_PIX_FMT_YUVJ420P; else -choices = h264_hwaccel_pixfmt_list_420; +*fmt++ = AV_PIX_FMT_YUV420P; } break; default: @@ -1031,6 +1010,8 @@ static enum AVPixelFormat get_pixel_format(H264Context *h) return AVERROR_INVALIDDATA; } +*fmt = AV_PIX_FMT_NONE; + return ff_get_format(h-avctx, choices); } -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org
[libav-devel] [PATCH 06/10] libavcodec: add AV_HWACCEL_ALLOW_HIGH_DEPTH flag
This can be used by the application to signal its ability to cope with video surface of types other than 8-bits YUV 4:2:0. --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 6 ++ libavcodec/vdpau.c | 2 +- libavcodec/version.h | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 066779a..db9d3cc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2014-08-09 API changes, most recent first: +201x-xx-xx - xxx - lavc 56.8.0 - vdpau.h + Add AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH flag to av_vdpau_bind_context(). + 201x-xx-xx - xxx - lavc 56.7.0 - vdpau.h Add av_vdpau_get_surface_parameters(). diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7df64ae..7666d4f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3045,6 +3045,12 @@ typedef struct AVHWAccel { #define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 0) /** + * Hardware acceleration can output YUV pixel formats with a different chroma + * sampling than 4:2:0 and/or other than 8 bits per component. + */ +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 1) + +/** * @} */ diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index edf09f1..8d9a649 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -345,7 +345,7 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, { VDPAUHWContext *hwctx; -if (flags ~AV_HWACCEL_FLAG_IGNORE_LEVEL) +if (flags ~(AV_HWACCEL_FLAG_IGNORE_LEVEL|AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH)) return AVERROR(EINVAL); if (av_reallocp(avctx-hwaccel_context, sizeof(*hwctx))) diff --git a/libavcodec/version.h b/libavcodec/version.h index f51c9d7..5d8f9a1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include libavutil/version.h #define LIBAVCODEC_VERSION_MAJOR 56 -#define LIBAVCODEC_VERSION_MINOR 7 +#define LIBAVCODEC_VERSION_MINOR 8 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 05/10] avconv_vdpau: allocate video surface of VDPAU-specified size
--- avconv_vdpau.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/avconv_vdpau.c b/avconv_vdpau.c index 37b50f6..1bd1f48 100644 --- a/avconv_vdpau.c +++ b/avconv_vdpau.c @@ -90,9 +90,14 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) VDPAUContext*ctx = ist-hwaccel_ctx; VdpVideoSurface *surface; VdpStatus err; +VdpChromaType chroma; +uint32_t width, height; av_assert0(frame-format == AV_PIX_FMT_VDPAU); +if (av_vdpau_get_surface_parameters(s, chroma, width, height)) +return AVERROR(ENOSYS); + surface = av_malloc(sizeof(*surface)); if (!surface) return AVERROR(ENOMEM); @@ -108,8 +113,8 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) // properly we should keep a pool of surfaces instead of creating // them anew for each frame, but since we don't care about speed // much in this code, we don't bother -err = ctx-video_surface_create(ctx-device, VDP_CHROMA_TYPE_420, -frame-width, frame-height, surface); +err = ctx-video_surface_create(ctx-device, chroma, width, height, +surface); if (err != VDP_STATUS_OK) { av_log(NULL, AV_LOG_ERROR, Error allocating a VDPAU video surface: %s\n, ctx-get_error_string(err)); -- 2.1.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] Fwd: Bug#773055: libav-tools: avconv -target pal-svcd fails with Unable to parse option value scan_offset
Control: forwarded -1 libav-devel@libav.org Hi, This looks like an easy target to fix. Can someone have a look at this? Is this critical and applicable for earlier releases as well? Best, Reinhard -- Forwarded message -- From: Andreas Weber andy.weber...@gmail.com Date: Sat, Dec 13, 2014 at 2:48 PM Subject: Bug#773055: libav-tools: avconv -target pal-svcd fails with Unable to parse option value scan_offset To: Debian Bug Tracking System sub...@bugs.debian.org Package: libav-tools Version: 6:11-2 Severity: normal Tags: upstream Dear Maintainer, avconv -i in.mp4 -target pal-svcd out.mpg fails with: [mpeg2video @ 0x14b63c0] [Eval @ 0x73fcfd50] Undefined constant or missing '(' in 'scan_offset' [mpeg2video @ 0x14b63c0] Unable to parse option value scan_offset [mpeg2video @ 0x14b63c0] Error setting option flags to value +scan_offset. Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height After fixing avconv_opt.c: --- avconv_opt.c_orig 2014-12-13 20:34:41.795060988 +0100 +++ avconv_opt.c2014-12-13 20:26:00.579042876 +0100 @@ -1825,7 +1825,7 @@ opt_default(NULL, maxrate, 2516000); opt_default(NULL, minrate, 0); // 1145000; opt_default(NULL, bufsize, 1835008); // 224*1024*8; -opt_default(NULL, flags, +scan_offset); +opt_default(NULL, scan_offset, 1); opt_default(NULL, b:a, 224000); avconv works as expected. Is it possible that patch https://patches.libav.org/patch/19539/ got lost? *** Reporter, please consider answering these questions, where appropriate *** * What led up to the situation? * What exactly did you do (or not do) that was effective (or ineffective)? * What was the outcome of this action? * What outcome did you expect instead? *** End of the template - remove these template lines *** -- System Information: Debian Release: 8.0 APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages libav-tools depends on: ii dpkg 1.17.21 ii libavcodec56 6:11-2 ii libavdevice556:11-2 ii libavfilter5 6:11-2 ii libavformat566:11-2 ii libavresample2 6:11-2 ii libavutil54 6:11-2 ii libc62.19-13 ii libsdl1.2debian 1.2.15-10+b1 ii libswscale3 6:11-2 ii libvdpau10.8-3 ii libx11-6 2:1.6.2-3 libav-tools recommends no packages. Versions of packages libav-tools suggests: pn frei0r-plugins none -- no debconf information ___ pkg-multimedia-maintainers mailing list pkg-multimedia-maintain...@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers -- regards, Reinhard --- avconv_opt.c_orig 2014-12-13 20:34:41.795060988 +0100 +++ avconv_opt.c 2014-12-13 20:26:00.579042876 +0100 @@ -1825,7 +1825,7 @@ opt_default(NULL, maxrate, 2516000); opt_default(NULL, minrate, 0); // 1145000; opt_default(NULL, bufsize, 1835008); // 224*1024*8; -opt_default(NULL, flags, +scan_offset); +opt_default(NULL, scan_offset, 1); opt_default(NULL, b:a, 224000); ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avconv: Use the mpeg12 private option scan_offset
From: Julien Ramseier j.ramse...@gmail.com Introduced in aed790070486b1b01b48106310d9d0ca1730e459 Bug-Id: debian/773055 CC: libav-sta...@libav.org Signed-off-by: Luca Barbato lu_z...@gentoo.org --- avconv_opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv_opt.c b/avconv_opt.c index 2d06912..6d43bc1 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1825,7 +1825,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg) opt_default(NULL, maxrate, 2516000); opt_default(NULL, minrate, 0); // 1145000; opt_default(NULL, bufsize, 1835008); // 224*1024*8; -opt_default(NULL, flags, +scan_offset); +opt_default(NULL, scan_offset, 1); opt_default(NULL, b:a, 224000); -- 2.1.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] oggdec: add support for VP8 demuxing
On 12/12/14 5:57 PM, Vittorio Giovara wrote: From: James Almer jamr...@gmail.com Signed-off-by: James Almer jamr...@gmail.com Signed-off-by: Michael Niedermayer michae...@gmx.at Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com --- Changelog | 1 + libavformat/Makefile | 1 + libavformat/oggdec.c | 1 + libavformat/oggdec.h | 1 + libavformat/oggparsevp8.c | 142 ++ libavformat/version.h | 4 +- 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 libavformat/oggparsevp8.c [...] diff --git a/libavformat/oggparsevp8.c b/libavformat/oggparsevp8.c new file mode 100644 index 000..1256bfe --- /dev/null +++ b/libavformat/oggparsevp8.c @@ -0,0 +1,142 @@ +/* + * On2 VP8 parser for Ogg + * Copyright (C) 2013 James Almer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include libavutil/intreadwrite.h + +#include avformat.h +#include internal.h +#include oggdec.h + +#define VP8_HEADER_SIZE 26 + +static int vp8_header(AVFormatContext *s, int idx) +{ +struct ogg *ogg = s-priv_data; +struct ogg_stream *os = ogg-streams + idx; +uint8_t *p = os-buf + os-pstart; +AVStream *st = s-streams[idx]; +AVRational framerate; + +if (os-psize 7 || p[0] != 0x4f) +return 0; + +switch (p[5]){ +case 0x01: +if (os-psize VP8_HEADER_SIZE) { +av_log(s, AV_LOG_ERROR, Invalid OggVP8 header packet); +return AVERROR_INVALIDDATA; +} + +if (p[6] != 1) { +av_log(s, AV_LOG_WARNING, + Unknown OggVP8 version %d.%d\n, p[6], p[7]); +return AVERROR_INVALIDDATA; +} + +st-codec-width= AV_RB16(p + 8); +st-codec-height = AV_RB16(p + 10); +st-sample_aspect_ratio.num = AV_RB24(p + 12); +st-sample_aspect_ratio.den = AV_RB24(p + 15); +framerate.den = AV_RB32(p + 18); +framerate.num = AV_RB32(p + 22); + +avpriv_set_pts_info(st, 64, framerate.num, framerate.den); +st-codec-codec_type = AVMEDIA_TYPE_VIDEO; +st-codec-codec_id = AV_CODEC_ID_VP8; +st-need_parsing = AVSTREAM_PARSE_HEADERS; +break; +case 0x02: +if (p[6] != 0x20) +return AVERROR_INVALIDDATA; +ff_vorbis_comment(s, st-metadata, p + 7, os-psize - 7, 1); ff_vorbis_stream_comment() for consistency with the other parsers. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel