x264 的common/frame.h里有如下一段代码:

 

    int8_t  *mb_type;
    int16_t (*mv[2])[2];
    int8_t  *ref[2];
    int     i_ref[2];
    int     ref_poc[2][16];

   

苏A-Bing~Q(76633731)  14:06:58
mv为含有2个元素的指针数组,
每个元素含有2个int16_t的一维数组

 

CTCA(172350634)  13:40:32
指针数组
CTCA(172350634)  13:40:41
指向int16_t [2]

 

 实际测试一下:

void CTest3Dlg::OnButton3()
{
       // TODO: Add your control notification handler code here
 
       int (*mv[2])[2];

       int arr1[2] = {3,4};
       mv[0] = &arr1;

       CString str;
       str.Format("%d",mv[0][0][0]);
       AfxMessageBox(str);

       str.Format("%d",mv[0][0][1]);
       AfxMessageBox(str);
}

   运行结果如下:
int16_t (*mv[2])[2];这是一个指针数组,指向mv[2]
 
int16_t (*mv[2])[2];这是一个指针数组,指向mv[2]
 
弹两次麻烦,一次弹出来算了:
 

 void CTest3Dlg::OnButton3()
{
 // TODO: Add your control notification handler code here

 /*
 int (*mv[2])[2];

 int arr1[2] = {3,4};
 mv[0] = &arr1;

 CString str;
 str.Format("%d",mv[0][0][0]);
 AfxMessageBox(str);

 str.Format("%d",mv[0][0][1]);
 AfxMessageBox(str);
 */

 int (*mv[2])[2];

 int arr1[2] = {1,2};
 int arr2[2] = {3,4};

 mv[0] = &arr1;
 mv[1] = &arr2;
 CString str;
 str.Format("mv[0][0][0]=%d;mv[0][0][1]=%d;mv[0][1][0]=%d;mv[0][1][1]=%d",mv[0][0][0],mv[0][0][1],mv[1][0][0],mv[1][0][1]);
 AfxMessageBox(str);
}

   
 运行结果如下:
int16_t (*mv[2])[2];这是一个指针数组,指向mv[2]
 
如果用如下的代码:
 str.Format("%d",mv[0][1][0]);
 AfxMessageBox(str);
 
并不提示出错,但是输出的值不确定:
int16_t (*mv[2])[2];这是一个指针数组,指向mv[2]
 
 

相关文章:

  • 2021-11-29
  • 2021-11-22
  • 2021-07-18
  • 2022-01-04
  • 2021-09-13
  • 2022-03-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-18
  • 2021-06-04
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案