请问这样生成出的yuv文件为什么是原来的1/20?

代码如下,是我的储存方式有问题嘛?

```c++

#include<iostream>
#include<fstream>

using namespace std;
typedef struct YUVPixel {
    int Y;
    int U;
    int V;
} YUVPixel;
int main()
{
    FILE* orignal_data = fopen("ParkScene_1920x1080_24_16bit_444.yuv", "r");
    FILE* f_r = fopen("r_data.yuv", "w");
    if (orignal_data == NULL)
        printf("open file error:\n");
    unsigned int width = 1920, height = 1080;
    unsigned char* raw_16bit_pixels = (unsigned char*)malloc(width * height * 3 * sizeof(unsigned char));
    fread(raw_16bit_pixels, 1, width * height * 3, orignal_data); //暂时忽略其返回值
    YUVPixel yuv_pixel;
    unsigned char Ylow, Yhigh,Ulow,Uhigh,Vlow,Vhigh;
    unsigned int Ytemp,Utemp,Vtemp;
    for (int j = 0;j < height;j++)
        for (int i = 0;i < width;i++)
        {
            yuv_pixel.Y = raw_16bit_pixels[1920 * j + i];//读入Y
            yuv_pixel.U = raw_16bit_pixels[1920 * j + i + 1920 * 1080];//读入U
            yuv_pixel.V = raw_16bit_pixels[1920 * j + i + 1920 * 1080 * 2];//读入V
            Ylow = (yuv_pixel.Y )& 0xff;
            Yhigh = (yuv_pixel.Y )>> 8;
            Ytemp = Yhigh;
            Ytemp <<= 8;
            Ytemp += Ylow;//Y的合成
            Ulow = (yuv_pixel.U) & 0xff;
            Uhigh = (yuv_pixel.U) >> 8;
            Utemp = Uhigh;
            Utemp <<= 8;
            Utemp += Ulow;//U的合成
            Vlow = (yuv_pixel.V) & 0xff;
            Vhigh = (yuv_pixel.V) >> 8;
            Vtemp = Uhigh;
            Vtemp <<= 8;
            Vtemp += Vlow;//V的合成
          //  cout << Utemp << "比较" << yuv_pixel.U << endl;
            fputc(Ytemp, f_r);//写入Y
            fputc(Utemp, f_r);//写入U
            fputc(Vtemp, f_r);//写入V
        }
    fclose(f_r);
    return 0;
}

```

之前文件中颜色分量0-255是用整形存储的,每个分量4字节,改写后,颜色分量改用字符型存储,每个分量1个字节。

先来看读取文件的地方,

fread(raw_16bit_pixels, 1, width * height * 3, orignal_data);

读取的字符个数是 weight * height *3个字节。
再来看写文件的地方,也就是双层for循环中的3个fputc
所以写入文件的字节数也是 weight * height *3个字节。

也就是说: 这段代码中,从文件中读取了多少个字节,实际写入新文件的就是多少个字节,如果新写的文件是原来文件的1/20,那只能说明你读文件的时候,只读取了源文件的1/20