[x264-devel] commit: add AltiVec implementation of x264_pixel_var_16x16 and x264_pixel_var_8x8 (Guillaume Poirier )

Guillaume POIRIER gpoirier at mplayerhq.hu
Mon Jan 26 00:07:01 CET 2009


On Sun, Jan 25, 2009 at 11:47 PM, Jason Garrett-Glaser
<darkshikari at gmail.com> wrote:

> Um... that patch doesn't have any effect on the chroma planes.  You're
> changing pic_alloc, when you should be changing x264_frame_new.
> Furthermore, you're trying to align the chroma planes, but you're not
> aligning their stride.  You have to change:
> frame->i_stride[i] = i_stride >> !!i;
> to
> frame->i_stride[i] = ALIGN( i_stride >> !!i, 16);

Are you sure? This leads to a beautiful segfault here:

Starting program: /Users/gpoirier/x264/x264 --crf 18 -A all
../The_Big_Sleep-720x576.yuv -o /tmp/vid-modif.264 --progress
x264 [info]: file name gives 720x576
x264 [info]: using cpu capabilities: Altivec
x264 [info]: profile Main, level 3.0

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000f9000
0xffff8a6c in ?? ()
(gdb) bt
#0  0xffff8a6c in ?? ()
#1  0x00013d78 in plane_expand_border (pix=0xf6b70 '?' <repeats 200
times>..., i_stride=400, i_width=360, i_height=10, i_padh=16,
i_padv=16, b_pad_top=0, b_pad_bottom=1) at common/frame.c:234
#2  0x00013f50 in x264_frame_expand_border (h=0xb6000, frame=0x80c000,
mb_y=35, b_end=1) at common/frame.c:262
#3  0x0005583c in x264_fdec_filter_row (h=0xb6000, mb_y=36) at
#4  0x0005af88 in x264_slice_write [inlined] () at encoder/encoder.c:1281
#5  0x0005af88 in x264_slices_write (h=0xb6000) at encoder/encoder.c:1331
#6  0x0005bb78 in x264_encoder_encode (h=0xb6000, pp_nal=0xbffff3f0,
pi_nal=0xbffff3f4, pic_in=0xbffff6e8, pic_out=0xbffff3b8) at
#7  0x00002284 in Encode_frame (h=<value temporarily unavailable, due
to optimizations>, hout=0xa050a4d8, pic=<value temporarily
unavailable, due to optimizations>) at x264.c:757
#8  0x00002f78 in main (argc=<value temporarily unavailable, due to
optimizations>, argv=0x6a320) at x264.c:841

This is the change I made instead of the one in common/common.c:

diff --git a/common/frame.c b/common/frame.c
index a51dc29..130bd29 100644
--- a/common/frame.c
+++ b/common/frame.c
@@ -49,7 +49,7 @@ x264_frame_t *x264_frame_new( x264_t *h )
     frame->i_plane = 3;
     for( i = 0; i < 3; i++ )
-        frame->i_stride[i] = i_stride >> !!i;
+        frame->i_stride[i] = ALIGN( i_stride >> !!i, 16 );
         frame->i_width[i] = i_width >> !!i;
         frame->i_lines[i] = i_lines >> !!i;

Did I somehow misunderstood what you meant? Do I need to make another change?

Only a very small fraction of our DNA does anything; the rest is all
comments and ifdefs.

P. J. O'Rourke  - "You can't get rid of poverty by giving people money."

More information about the x264-devel mailing list