[vlc-devel] [PATCH 2/2] avcodec: use i_aligned_width and i_aligned_height
Rémi Denis-Courmont
remi at remlab.net
Thu Dec 11 20:47:08 CET 2014
Le jeudi 11 décembre 2014, 17:08:39 Thomas Guillem a écrit :
> fix green lines when using avcodec with swscale or some vouts.
>
> (fixes #13062)
> ---
> modules/codec/avcodec/video.c | 32 ++++++++++++++------------------
> 1 file changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index 5ba6e2e..c2b466a 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -122,35 +122,31 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t
> *p_dec, AVCodecContext *p_context ) {
> decoder_sys_t *p_sys = p_dec->p_sys;
> - int width = p_context->coded_width;
> - int height = p_context->coded_height;
> + int aligned_width = p_context->coded_width;
> + int aligned_height = p_context->coded_height;
>
> if( p_sys->p_va == NULL )
> {
> int aligns[AV_NUM_DATA_POINTERS];
>
> - avcodec_align_dimensions2(p_context, &width, &height, aligns);
> + avcodec_align_dimensions2(p_context, &aligned_width,
> &aligned_height,
> + aligns);
> }
>
>
> - if( width == 0 || height == 0 || width > 8192 || height > 8192 )
> + if( aligned_width == 0 || aligned_height == 0
> + || aligned_width > 8192 || aligned_height > 8192 )
> {
> - msg_Err( p_dec, "Invalid frame size %dx%d.", width, height );
> + msg_Err( p_dec, "Invalid frame size %dx%d.", aligned_width,
> + aligned_height );
> return NULL; /* invalid display size */
> }
> - p_dec->fmt_out.video.i_width = width;
> - p_dec->fmt_out.video.i_height = height;
> -
> - if( width != p_context->width || height != p_context->height )
> - {
> - p_dec->fmt_out.video.i_visible_width = p_context->width;
> - p_dec->fmt_out.video.i_visible_height = p_context->height;
> - }
> - else
> - {
> - p_dec->fmt_out.video.i_visible_width = width;
> - p_dec->fmt_out.video.i_visible_height = height;
> - }
> + p_dec->fmt_out.video.i_aligned_width = aligned_width;
> + p_dec->fmt_out.video.i_aligned_height = aligned_height;
> + p_dec->fmt_out.video.i_width = p_context->coded_width;
> + p_dec->fmt_out.video.i_height = p_context->coded_height;
For the actual downstream pipeline, only those values make any sense:
- The vertical and horizontal offsets of the video:
To my understanding, this was never implemented in VLC (and rarely occurs in
real life, but it is definitely specified at least in H.264).
- The pixel width and height of the video.
At the moment, they are stored in i_visible_{width,height}.
- The minimum line byte pitch and line count for each plane.
They are currently stored in i_{width,height} and assumed to be proportional
to the chroma subsampling for each plane.
- The required memory alignment for lines in each planes.
Currently, this is assumed to divide 32 bytes (IIRC) in case of indirect
rendering, and to match whatever the vout display does in direct rendering
case.
The coded resolution is not the same as the video resolution. At least AVC can
specify a different video resolution via SPS VUI crop parameters As far as I
can tell, the coded resolution is of no relevance outside the decoder (other
than debugging).
> + p_dec->fmt_out.video.i_visible_width = p_context->width;
> + p_dec->fmt_out.video.i_visible_height = p_context->height;
>
> if( !p_sys->p_va && GetVlcChroma( &p_dec->fmt_out.video,
> p_context->pix_fmt ) ) {
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list