Hi Luca,
here is one 1920x1088 file with a cropping rectangle of "0,0,0,8":
https://dl.dropbox.com/u/24468/test1080.avi
With -flags2 ingorecrop you get a "1920x1088" resolution (and trigger the
new codepath), without such flag you get a "1920x1080" resolution from this
file.

The previous sample was only to trigger the avplay crash, but I guess it
happens only on my dev machine, sorry for the mixup.
Cheers,
Vittorio

On Thu, Jan 24, 2013 at 1:04 PM, Luca Barbato <[email protected]> wrote:

> From: Vittorio Giovara <[email protected]>
>
> Some 3D systems overload the meaning of the field for other purposes.
>
> Signed-off-by: Luca Barbato <[email protected]>
> ---
>
> I couldn't trigger problems locally, but the test sample you provided
> doesn't seem triggering that codepath at all.
>
>  libavcodec/avcodec.h       |  2 ++
>  libavcodec/h264_ps.c       | 14 ++++++++++++++
>  libavcodec/options_table.h |  1 +
>  libavcodec/version.h       |  2 +-
>  4 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index e60119e..7a24775 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -657,6 +657,8 @@ typedef struct RcOverride{
>  #define CODEC_FLAG2_FAST          0x00000001 ///< Allow non spec
> compliant speedup tricks.
>  #define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
>  #define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at
> every keyframe instead of in extradata.
> +#define CODEC_FLAG2_IGNORE_CROP   0x00010000 ///< Discard cropping
> information from SPS.
> +
>  #if FF_API_MPV_GLOBAL_OPTS
>  #define CODEC_FLAG_CBP_RD         0x04000000 ///< Use rate distortion
> optimization for cbp.
>  #define CODEC_FLAG_QP_RD          0x08000000 ///< Use rate distortion
> optimization for qp selectioon.
> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> index ff6c077..b470854 100644
> --- a/libavcodec/h264_ps.c
> +++ b/libavcodec/h264_ps.c
> @@ -425,6 +425,20 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
>          sps->crop_right = get_ue_golomb(&s->gb);
>          sps->crop_top   = get_ue_golomb(&s->gb);
>          sps->crop_bottom= get_ue_golomb(&s->gb);
> +        if (h->s.avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) {
> +            av_log(h->s.avctx, AV_LOG_ERROR,
> +                   "discarding sps cropping, "
> +                   "original values are l:%u r:%u t:%u b:%u\n",
> +                   sps->crop_left,
> +                   sps->crop_right,
> +                   sps->crop_top,
> +                   sps->crop_bottom);
> +
> +            sps->crop_left   =
> +            sps->crop_right  =
> +            sps->crop_top    =
> +            sps->crop_bottom = 0;
> +        }
>          if(sps->crop_left || sps->crop_top){
>              av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not
> completely supported, this could look slightly wrong ...\n");
>          }
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index f2e8312..7d0795a 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -76,6 +76,7 @@ static const AVOption options[]={
>  {"sgop", "Deprecated, use mpegvideo private options instead", 0,
> AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_STRICT_GOP }, INT_MIN, INT_MAX, V|E,
> "flags2"},
>  #endif
>  {"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 =
> CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"},
> +{"ignorecrop", "ignore cropping information from sps", 1,
> AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_IGNORE_CROP }, INT_MIN, INT_MAX,
> V|D, "flags2"},
>  {"local_header", "place global headers at every keyframe instead of in
> extradata", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_LOCAL_HEADER },
> INT_MIN, INT_MAX, V|E, "flags2"},
>  #if FF_API_SUB_ID
>  {"sub_id", NULL, OFFSET(sub_id), AV_OPT_TYPE_INT, {.i64 = DEFAULT },
> INT_MIN, INT_MAX},
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 62f2bcd..80da6e2 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -27,7 +27,7 @@
>   */
>
>  #define LIBAVCODEC_VERSION_MAJOR 54
> -#define LIBAVCODEC_VERSION_MINOR 40
> +#define LIBAVCODEC_VERSION_MINOR 41
>  #define LIBAVCODEC_VERSION_MICRO  0
>
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> --
> 1.8.0.2
>
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
>
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to