[FFmpeg-devel] [PATCH 1/2] add av_dv_codec_profile2 : uses framerate to select best matching profile. default on first matching profile
Michael Niedermayer
michaelni at gmx.at
Wed Dec 3 18:36:20 CET 2014
On Wed, Dec 03, 2014 at 05:10:16PM +0100, Steve Jiekak wrote:
> Signed-off-by: Steve Jiekak <devaureshy at gmail.com>
> ---
> doc/APIchanges | 3 +++
> libavcodec/dv_profile.c | 27 +++++++++++++++++++++++----
> libavcodec/dv_profile.h | 6 ++++++
> libavcodec/version.h | 2 +-
> 4 files changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 5915ad3..a81c3b9 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil: 2014-08-09
>
> API changes, most recent first:
>
> +2014-12-03 - xxxxxxx - lavc 56.14.100 - dv_profile.h
> + Add av_dv_codec_profile2().
> +
> 2014-11-21 - xxxxxxx - lavu 54.15.100 - dict.h
> Add av_dict_get_string().
>
> diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c
> index b301cbf..362afe4 100644
> --- a/libavcodec/dv_profile.c
> +++ b/libavcodec/dv_profile.c
> @@ -311,19 +311,38 @@ const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
> return ff_dv_frame_profile(NULL, sys, frame, buf_size);
> }
>
> -const AVDVProfile *av_dv_codec_profile(int width, int height,
> - enum AVPixelFormat pix_fmt)
> +const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt)
> {
> #if CONFIG_DVPROFILE
> + return av_dv_codec_profile2(width, height, pix_fmt, (AVRational){0, 0});
> +#endif
> +
> + return NULL;
> +}
> +
> +const AVDVProfile *av_dv_codec_profile2(int width, int height,
> + enum AVPixelFormat pix_fmt,
> + AVRational frame_rate)
> +{
> + const AVDVProfile *p = NULL;
> +#if CONFIG_DVPROFILE
> int i;
> + /* frame rate is necessary to select between 720p50 and 720p60 profiles */
> + int invalid_framerate = frame_rate.num == 0 || frame_rate.den == 0;
>
> for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
> if (height == dv_profiles[i].height &&
> pix_fmt == dv_profiles[i].pix_fmt &&
> width == dv_profiles[i].width)
> - return &dv_profiles[i];
> + {
> + if( !invalid_framerate || av_div_q(dv_profiles[i].time_base, frame_rate).num == 1 )
> + return &dv_profiles[i];
this looks wrong
if valid frame_rate or check frame_rate
a check on the framerate should be done if its valid not if its
invalid
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141203/2f34055a/attachment.asc>
More information about the ffmpeg-devel
mailing list