Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Dmitrii Ovchinnikov <ovchinnikov.dmitrii@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [crop support for matroska demuxer, V3 1/3] libavcodec: Add crop related fields to structure AVCodecContext and AVCodecParameters.
Date: Wed, 12 Oct 2022 17:21:31 +0200
Message-ID: <CADXbNkTn6QR-=NiA76zYjT8fBwYAvQ+j0q5-3qjAV0YW=iqDcQ@mail.gmail.com> (raw)
In-Reply-To: <a0419830-6356-5980-58d0-cef172cc88d0@rothenpieler.org>

>>Why does an encoder or decoder need to care about this, given it's
>>container level information?
>>Do you plan on implementing cropping support into all the encoders?



This implementation takes a reference of the h.264 supporting cropping. In
h264, if width (stored in ACCodecContext) parsed from container is
different from width parsed from elementary, it will trigger cropping. This
is essentially a kind of cropping that related with container. It will
infer parameters cb(crop bottom), cr(crop right), and then finally assigned
them to AVFrame.

This gives the inspiration when we get direct cropping parameters from
container. We can us the same methodology.

Parser cropping parameters from container in demuxer -> stored container
cropping parameters in AVCodec -> pass container cropping parameters to
AVFrame-> Apply Crop in frame.c of libavutil.



Container cropping can both be implemented in libavutil, or libavfilter.
The as-is implementation of H.264 gave a detailed implement reference that
we can put cropping in libavcode and libavutil. My implementation just
follows that methodology.



From the another point of view, there are some benefit as well: cropping is
a light weight process (only copy yuv data), comparing with some module
such as edge_common,  colorspacedsp etc. in libavfilter. Put container
cropping in libavcodec and libavutil is very concise.



Currently we are supporting the matroska codec. Matroska will be the first
one that use submitted code in decoder.c and AVCodecContext to support
container cropping. Because container cropping parameters I added are 0 by
default, it will not affect any existing container or future container
which don’t support crop. If other developers plan to add container crop
supporting for certain container, those codes in public section (such as
codes in in decoder.c and AVCodecContext ) are possible shared by them.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      parent reply	other threads:[~2022-10-12 15:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 14:59 OvchinnikovDmitrii
2022-10-07 14:59 ` [FFmpeg-devel] [crop support for matroska demuxer, V3 2/3] libavcodec: Public code to support container crop OvchinnikovDmitrii
2022-10-07 14:59 ` [FFmpeg-devel] [crop support for matroska demuxer, V3 3/3] libavformat\matroskadec.c: crop support for matroska demuxer OvchinnikovDmitrii
2022-10-11 11:59 ` [FFmpeg-devel] [crop support for matroska demuxer, V3 1/3] libavcodec: Add crop related fields to structure AVCodecContext and AVCodecParameters Anton Khirnov
2022-10-12 15:20   ` Dmitrii Ovchinnikov
2022-10-11 12:43 ` Timo Rothenpieler
2022-10-11 12:51   ` James Almer
2022-10-12 17:08     ` Anton Khirnov
2022-10-12 15:21   ` Dmitrii Ovchinnikov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADXbNkTn6QR-=NiA76zYjT8fBwYAvQ+j0q5-3qjAV0YW=iqDcQ@mail.gmail.com' \
    --to=ovchinnikov.dmitrii@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git