[vlc-commits] [Git][videolan/vlc][master] 2 commits: codec :vpx: fix encoding for non-power of 2 pitch videos

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Thu Feb 23 16:32:49 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
623cceed by Tristan Matthews at 2023-02-23T16:06:33+00:00
codec :vpx: fix encoding for non-power of 2 pitch videos

Instead pass a dummy value to vpx_img_wrap and explicitly set the values after.

- - - - -
da1c3a13 by Tristan Matthews at 2023-02-23T16:06:33+00:00
codec: aom: fix encoding for non power of-two pitch videos

Instead pass a dummy value to aom_img_wrap and explicitly set the values after.

- - - - -


2 changed files:

- modules/codec/aom.c
- modules/codec/vpx.c


Changes:

=====================================
modules/codec/aom.c
=====================================
@@ -605,15 +605,16 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
     const aom_img_fmt_t img_fmt = p_enc->fmt_in.i_codec == VLC_CODEC_I420_10L ?
         AOM_IMG_FMT_I42016 : AOM_IMG_FMT_I420;
 
-    /* Create and initialize the aom_image */
-    if (!aom_img_wrap(&img, img_fmt, i_w, i_h, p_pict->p[0].i_pitch, p_pict->p[0].p_pixels))
+    /* Create and initialize the aom_image (use 1 and correct later to avoid getting
+       rejected for non-power of 2 pitch) */
+    if (!aom_img_wrap(&img, img_fmt, i_w, i_h, 1, p_pict->p[0].p_pixels))
     {
         AOM_ERR(p_enc, ctx, "Failed to wrap image");
         return NULL;
     }
 
-    /* Correct chroma plane offsets. */
-    for (int plane = 1; plane < p_pict->i_planes; plane++) {
+    /* Fill in real plane/stride values. */
+    for (int plane = 0; plane < p_pict->i_planes; plane++) {
         img.planes[plane] = p_pict->p[plane].p_pixels;
         img.stride[plane] = p_pict->p[plane].i_pitch;
     }


=====================================
modules/codec/vpx.c
=====================================
@@ -498,14 +498,15 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
     unsigned i_w = p_enc->fmt_in.video.i_visible_width;
     unsigned i_h = p_enc->fmt_in.video.i_visible_height;
 
-    /* Create and initialize the vpx_image */
-    if (!vpx_img_wrap(&img, VPX_IMG_FMT_I420, i_w, i_h, p_pict->p[0].i_pitch, p_pict->p[0].p_pixels)) {
+    /* Create and initialize the vpx_image (use 1 and correct later to avoid getting
+       rejected for non-power of 2 pitch) */
+    if (!vpx_img_wrap(&img, VPX_IMG_FMT_I420, i_w, i_h, 1, p_pict->p[0].p_pixels)) {
         VPX_ERR(p_enc, ctx, "Failed to wrap image");
         return NULL;
     }
 
-    /* Correct chroma plane offsets. */
-    for (int plane = 1; plane < p_pict->i_planes; plane++) {
+    /* Fill in real plane/stride values. */
+    for (int plane = 0; plane < p_pict->i_planes; plane++) {
         img.planes[plane] = p_pict->p[plane].p_pixels;
         img.stride[plane] = p_pict->p[plane].i_pitch;
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a47798f25eeba8e18283d48fe7f6b237400b1352...da1c3a137c1c35fc47a6717d285b29ba4069006a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a47798f25eeba8e18283d48fe7f6b237400b1352...da1c3a137c1c35fc47a6717d285b29ba4069006a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list