Re: [libav-devel] [PATCH 1/2] libavfilter/overlay_qsv: Add QSV overlay vpp filter
On 2017/8/1 17:00, Maxym Dmytrychenko wrote: seems to be working. about: enum QSVMemMode would it be possible to avoid such for the favour of MFX_MEMTYPE_* ? OK, I will remove this and submit the V2 patch. On Tue, Aug 1, 2017 at 8:10 AM, Huang, Zhengxuwrote: On 2017/7/31 19:41, Luca Barbato wrote: On 31/07/2017 03:25, Huang, Zhengxu wrote: After a first quick read I couldn't spot any specific problem, but I'm wondering if at least some of that code couldn't avoided using the device_derive functionality in hwcontext. Thanks so much for your review, Luca. Can you explain in more detail about the "using the device_derive" issue ? , ^_^ . So I can check and modify the code much better. Thanks. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] libavfilter/overlay_qsv: Add QSV overlay vpp filter
On 2017/8/1 17:25, Luca Barbato wrote: On 01/08/2017 08:10, Huang, Zhengxu wrote: On 2017/7/31 19:41, Luca Barbato wrote: On 31/07/2017 03:25, Huang, Zhengxu wrote: After a first quick read I couldn't spot any specific problem, but I'm wondering if at least some of that code couldn't avoided using the device_derive functionality in hwcontext. Thanks so much for your review, Luca. Can you explain in more detail about the "using the device_derive" issue ? , ^_^ . So I can check and modify the code much better. Thanks. Basically I was wondering if using av_hwdevice_ctx_create_derived would work for your purpose and shorten init_vpp_session. In order to support not only video memory/opaque mode but also system mode(in case inserting sw filter in the pipeline ) So the init_vpp_session function code is much longer. If we use the *av_hwframe_ctx_create_derived* to replace the follow code in init_vpp_session(If I correctly understand your meaning because I can't find where to use the *av_hwdevice_ctx_create_derived*) /AVHWFramesContext *out_frames_ctx; AVBufferRef *out_frames_ref = av_hwframe_ctx_alloc(device_ref); if (!out_frames_ref) return AVERROR(ENOMEM); out_frames_ctx = (AVHWFramesContext*)out_frames_ref->data; out_frames_hwctx = out_frames_ctx->hwctx; out_frames_ctx->format= AV_PIX_FMT_QSV; out_frames_ctx->width = FFALIGN(outlink->w, 32); out_frames_ctx->height= FFALIGN(outlink->h, 32); out_frames_ctx->sw_format = s->out_sw_format; out_frames_ctx->initial_pool_size = 64; out_frames_hwctx->frame_type = in_frames_hwctx->frame_type; s->out_mem_mode = s->in_mem_mode; ret = av_hwframe_ctx_init(out_frames_ref); if (ret < 0) { av_buffer_unref(_frames_ref); av_log(avctx, AV_LOG_ERROR, "Error creating frames_ctx for output pad.\n"); return ret; }/ It maybe will have some problem. Because the derived hwctx must have the same width and height with the src. But there maybe scale or crop in the vpp. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 01/22] h264: Add stream constraint values to the common header
On 29/07/2017 23:16, Mark Thompson wrote: > With comments describing the derivation of each value. > --- > libavcodec/h264.h | 45 + > 1 file changed, 45 insertions(+) > > diff --git a/libavcodec/h264.h b/libavcodec/h264.h > index eb3805c06..aa137b5b5 100644 > --- a/libavcodec/h264.h > +++ b/libavcodec/h264.h > @@ -44,4 +44,49 @@ enum { > H264_NAL_AUXILIARY_SLICE = 19, > }; > > + > +enum { > +// 7.4.2.1.1: seq_parameter_set_id is in [0, 31]. > +H264_MAX_SPS_COUNT = 32, > +// 7.4.2.2: pic_parameter_set_id is in [0, 255]. > +H264_MAX_PPS_COUNT = 256, > + > +// A.3: MaxDpbFrames is bounded above by 16. > +H264_MAX_DPB_FRAMES = 16, > +// 7.4.2.1.1: max_num_ref_frames is in [0, MaxDpbFrames], and > +// each reference frame can have two fields. > +H264_MAX_REFS = 2 * H264_MAX_DPB_FRAMES, > + > +// 7.4.3.1: modification_of_pic_nums_idc is not equal to 3 at most > +// num_ref_idx_lN_active_minus1 + 1 times (that is, once for each > +// possible reference), then equal to 3 once. > +H264_MAX_RPLM_COUNT = H264_MAX_REFS + 1, > + > +// 7.4.3.3: in the worst case, we begin with a full short-term > +// reference picture list. Each picture in turn is moved to the > +// long-term list (type 3) and then discarded from there (type 2). > +// Then, we set the length of the long-term list (type 4), mark > +// the current picture as long-term (type 6) and terminate the > +// process (type 0). > +H264_MAX_MMCO_COUNT = H264_MAX_REFS * 2 + 3, > + > +// A.2.1, A.2.3: profiles supporting FMO constrain > +// num_slice_groups_minus1 to be in [0, 7]. > +H264_MAX_SLICE_GROUPS = 8, > + > +// E.2.2: cpb_cnt_minus1 is in [0, 31]. > +H264_MAX_CPB_CNT = 32, > + > +// A.3: in table A-1 the highest level allows a MaxFS of 139264. > +H264_MAX_MB_PIC_SIZE = 139264, > +// A.3.1, A.3.2: PicWidthInMbs and PicHeightInMbs are constrained > +// to be not greater than sqrt(MaxFS * 8). Hence height/width are > +// bounded above by sqrt(139264 * 8) = 1055.5 macroblocks. > +H264_MAX_MB_WIDTH= 1055, > +H264_MAX_MB_HEIGHT = 1055, > +H264_MAX_WIDTH = H264_MAX_MB_WIDTH * 16, > +H264_MAX_HEIGHT = H264_MAX_MB_HEIGHT * 16, > +}; > + > + > #endif /* AVCODEC_H264_H */ > Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] lavc: Add mpeg2_metadata bitstream filter
--- To go between patches 12 and 13. doc/bitstream_filters.texi | 36 libavcodec/Makefile | 2 + libavcodec/bitstream_filters.c | 1 + libavcodec/mpeg2_metadata_bsf.c | 358 4 files changed, 397 insertions(+) create mode 100644 libavcodec/mpeg2_metadata_bsf.c diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 834cf07f6..353e687c3 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -204,6 +204,42 @@ avconv -i frame_%d.jpg -c:v copy rotated.avi @section movsub +@section mpeg2_metadata + +Modify metadata embedded in an MPEG-2 stream. + +@table @option +@item display_aspect_ratio +Set the display aspect ratio in the stream. + +The following fixed values are supported: +@table @option +@item 4/3 +@item 16/9 +@item 221/100 +@end table +Any other value will result in square pixels being signalled instead +(see H.262 section 6.3.3 and table 6-3). + +@item frame_rate +Set the frame rate in the stream. This is constructed from a table +of known values combined with a small multiplier and divisor - if +the supplied value is not exactly representable, the nearest +representable value will be used instead (see H.262 section 6.3.3 +and table 6-4). + +@item video_format +Set the video format in the stream (see H.262 section 6.3.6 and +table 6-6). + +@item colour_primaries +@item transfer_characteristics +@item matrix_coefficients +Set the colour description in the stream (see H.262 section 6.3.6 +and tables 6-7, 6-8 and 6-9). + +@end table + @section mp3_header_compress @section mp3_header_decompress diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d04237615..7ecd86d60 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -785,6 +785,8 @@ OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF)+= imx_dump_header_bsf.o OBJS-$(CONFIG_MJPEG2JPEG_BSF) += mjpeg2jpeg_bsf.o OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o OBJS-$(CONFIG_MOV2TEXTSUB_BSF)+= movsub_bsf.o +OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o \ + cbs.o cbs_mpeg2.o OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o OBJS-$(CONFIG_NULL_BSF) += null_bsf.o OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index e90919f60..784170543 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -37,6 +37,7 @@ extern const AVBitStreamFilter ff_imx_dump_header_bsf; extern const AVBitStreamFilter ff_mjpeg2jpeg_bsf; extern const AVBitStreamFilter ff_mjpega_dump_header_bsf; extern const AVBitStreamFilter ff_mov2textsub_bsf; +extern const AVBitStreamFilter ff_mpeg2_metadata_bsf; extern const AVBitStreamFilter ff_null_bsf; extern const AVBitStreamFilter ff_text2movsub_bsf; extern const AVBitStreamFilter ff_noise_bsf; diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c new file mode 100644 index 0..22ace3062 --- /dev/null +++ b/libavcodec/mpeg2_metadata_bsf.c @@ -0,0 +1,358 @@ +/* + * 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/avstring.h" +#include "libavutil/common.h" +#include "libavutil/opt.h" + +#include "bsf.h" +#include "cbs.h" +#include "cbs_mpeg2.h" + +typedef struct MPEG2MetadataContext { +const AVClass *class; + +CodedBitstreamContext cbc; +CodedBitstreamFragment fragment; + +MPEG2RawExtensionData sequence_extension; +MPEG2RawExtensionData sequence_display_extension; + +AVRational display_aspect_ratio; + +AVRational frame_rate; + +int video_format; +int colour_primaries; +int transfer_characteristics; +int matrix_coefficients; +} MPEG2MetadataContext; + + +static int mpeg2_metadata_update_fragment(AVBSFContext *bsf, + CodedBitstreamFragment *frag) +{ +MPEG2MetadataContext *ctx = bsf->priv_data; +MPEG2RawSequenceHeader*sh = NULL; +MPEG2RawSequenceExtension *se = NULL; +MPEG2RawSequenceDisplayExtension *sde = NULL; +int i, se_pos, add_sde = 0; + +for (i = 0; i <
Re: [libav-devel] [PATCH 1/2] libavfilter/overlay_qsv: Add QSV overlay vpp filter
On 01/08/2017 08:10, Huang, Zhengxu wrote: > On 2017/7/31 19:41, Luca Barbato wrote: > >> On 31/07/2017 03:25, Huang, Zhengxu wrote: >> After a first quick read I couldn't spot any specific problem, but I'm >> wondering if at least some of that code couldn't avoided using the >> device_derive functionality in hwcontext. > Thanks so much for your review, Luca. > > Can you explain in more detail about the "using the device_derive" issue > ? , ^_^ . > So I can check and modify the code much better. Thanks. Basically I was wondering if using av_hwdevice_ctx_create_derived would work for your purpose and shorten init_vpp_session. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] libavfilter/overlay_qsv: Add QSV overlay vpp filter
seems to be working. about: >enum QSVMemMode would it be possible to avoid such for the favour of MFX_MEMTYPE_* ? On Tue, Aug 1, 2017 at 8:10 AM, Huang, Zhengxuwrote: > On 2017/7/31 19:41, Luca Barbato wrote: > > On 31/07/2017 03:25, Huang, Zhengxu wrote: >> After a first quick read I couldn't spot any specific problem, but I'm >> wondering if at least some of that code couldn't avoided using the >> device_derive functionality in hwcontext. >> > Thanks so much for your review, Luca. > > Can you explain in more detail about the "using the device_derive" issue ? > , ^_^ . > So I can check and modify the code much better. Thanks. > >> >> lu >> ___ >> libav-devel mailing list >> libav-devel@libav.org >> https://lists.libav.org/mailman/listinfo/libav-devel >> > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] libavfilter/overlay_qsv: Add QSV overlay vpp filter
On 2017/7/31 19:41, Luca Barbato wrote: On 31/07/2017 03:25, Huang, Zhengxu wrote: After a first quick read I couldn't spot any specific problem, but I'm wondering if at least some of that code couldn't avoided using the device_derive functionality in hwcontext. Thanks so much for your review, Luca. Can you explain in more detail about the "using the device_derive" issue ? , ^_^ . So I can check and modify the code much better. Thanks. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel