1

The first part is to open the file and load it to yuv1 buffer. The next stage is reading the YUV420p data correctly i use this formula from wiki

  size.total = size.width * size.height;
      y = yuv[position.y * size.width + position.x];
      u = yuv[(position.y / 2) * (size.width / 2) + (position.x / 2) + size.total];
      v = yuv[(position.y / 2) * (size.width / 2) + (position.x / 2) + size.total + (size.total / 4)];

next stage is to take the values from y u v and convert to rgb using the formula below

B = 1.164(Y - 16) + 2.018(U - 128)

G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)

R = 1.164(Y - 16) + 1.596(V - 128)

After getting RGB we load them back to buffer correctly and close the file.

But i am getting this error error C2064: term does not evaluate to a function taking 302 arguments in the three formula lines.

Can someone help me out

Error code

        r1 = 1.164(y1 - 16) + 1.596(v1 - 128) +     0;
        g1 = 1.164(y1 - 16) - 0.813(v1 - 128) - 0.391(u1 - 128);
        b1 = 1.164(y1 - 16)+          0         + 2.018(u1 - 128);
4

1 回答 1

1

Did you just paste the mathematical formula into your C code? That won't work.

You'll need to fix the upper/lower case writing of your variables. And you'll need an explicit multiplication sign:

b = 1.164 * (y - 16) + 2.018 * (u - 128);
g = 1.164 * (y - 16) - 0.813 * (v - 128) - 0.391 * (u - 128);
r = 1.164 * (y - 16) + 1.596 * (v - 128);

And depending on the type of the b, g and r variables, you'll need to cast or round the floating point result to an integer value.

于 2012-07-03T08:15:11.897 回答