I think this function generate a low resolution version of the current frame for encoding usage. Not 100 percent sure.<br><br><div><span class="gmail_quote">On 1/7/07, <b class="gmail_sendername">$B2&>.@E(B</b> <<a href="mailto:wangxiaojing.hnu@gmail.com">
wangxiaojing.hnu@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I'm a newbie of x264,and I have confused by the x264_frame_init_lowres routine in the file
mc.c.<br>The routine is called by x264_encoder_encode when h->frames.b_have_lowres is true.<br>I wonder what does the h->
frames.b_have_lowres stand by and what's the function of x264_frame_init_lowres?<br>I will be grateful with any reply.Thanks.<br>the source of this routine is following:<br>void x264_frame_init_lowres( int cpu, x264_frame_t *frame )
<br>{ // FIXME: tapfilter?<br> const int i_stride = frame->i_stride[0];<br> const int i_stride2 = frame->i_stride_lowres;<br> const int i_width2 = i_stride2 - 64;<br> int x, y, i;<br> for( y = 0; y < frame->i_lines_lowres - 1; y++ )
<br> {<br> uint8_t *src0 = &frame->plane[0][2*y*i_stride];<br> uint8_t *src1 = src0+i_stride;<br> uint8_t *src2 = src1+i_stride;<br> uint8_t *dst0 = &frame->lowres[0][y*i_stride2];
<br> uint8_t *dsth = &frame->lowres[1][y*i_stride2];<br> uint8_t *dstv = &frame->lowres[2][y*i_stride2];<br> uint8_t *dstc = &frame->lowres[3][y*i_stride2];<br> for( x = 0; x < i_width2 - 1; x++ )
<br> {<br> dst0[x] = (src0[2*x ] + src0[2*x+1] + src1[2*x ] + src1[2*x+1] + 2) >> 2;<br> dsth[x] = (src0[2*x+1] + src0[2*x+2] + src1[2*x+1] + src1[2*x+2] + 2) >> 2;<br> dstv[x] = (src1[2*x ] + src1[2*x+1] + src2[2*x ] + src2[2*x+1] + 2) >> 2;
<br> dstc[x] = (src1[2*x+1] + src1[2*x+2] + src2[2*x+1] + src2[2*x+2] + 2) >> 2;<br> }<br> dst0[x] = (src0[2*x ] + src0[2*x+1] + src1[2*x ] + src1[2*x+1] + 2) >> 2;<br> dstv[x] = (src1[2*x ] + src1[2*x+1] + src2[2*x ] + src2[2*x+1] + 2) >> 2;
<br> dsth[x] = (src0[2*x+1] + src1[2*x+1] + 1) >> 1;<br> dstc[x] = (src1[2*x+1] + src2[2*x+1] + 1) >> 1;<br> }<br> for( i = 0; i < 4; i++ )<br> memcpy( &frame->lowres[i][y*i_stride2], &frame->lowres[i][(y-1)*i_stride2], i_width2 );
<br><br> for( y = 0; y < 16; y++ )<br> for( x = 0; x < 16; x++ )<br> frame->i_cost_est[x][y] = -1;<br><br> x264_frame_expand_border_lowres( frame );<br>}<br>
</blockquote></div><br>