⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gen_colorspace_tables.c

📁 这个库实现了录象功能
💻 C
📖 第 1 页 / 共 2 页
字号:
  printf("#endif // HAVE_RGB_TO_YUV\n\n");  printf("#ifdef HAVE_RGB_TO_YUVJ\n\n");    printf("static int r_to_yj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)((0.29900)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int g_to_yj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)((0.58700)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int b_to_yj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)((0.11400)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");      printf("static int r_to_uj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-(0.16874)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int g_to_uj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-(0.33126)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int b_to_uj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)( (0.50000)*0x10000 * i + 0x800000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");      printf("static int r_to_vj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)( (0.50000)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int g_to_vj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-(0.41869)*0x10000 * i + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int b_to_vj[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-(0.08131)*0x10000 * i + 0x800000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("#endif // HAVE_RGB_TO_YUVJ\n\n");      printf("/* YUV -> RGB conversions */\n");  // YCbCr (8bit) -> R'G'B' (integer) according to CCIR 601  printf("#ifdef HAVE_YUV_TO_RGB\n\n");   printf("static int y_to_rgb[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");        printf("%d, ", (int)(255.0/219.0*(i-16) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");    printf("static int v_to_r[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)( 1.40200*255.0/224.0 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int u_to_g[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-0.34414*255.0/224.0 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int v_to_g[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-0.71414*255.0/224.0 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int u_to_b[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)( 1.77200*255.0/224.0 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("#endif // HAVE_YUV_TO_RGB\n\n");      /* JPEG Quantization */  printf("#ifdef HAVE_YUVJ_TO_RGB\n\n");    printf("static int yj_to_rgb[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(i * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");      printf("static int vj_to_r[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)( 1.40200 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int uj_to_g[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-0.34414 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int vj_to_g[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)(-0.71414 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static int uj_to_b[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%d, ", (int)( 1.77200 * (i - 0x80) * 0x10000 + 0.5));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("#endif // HAVE_YUVJ_TO_RGB\n\n");    // YCbCr (8bit) -> R'G'B' (float) according to CCIR 601  printf("#ifdef HAVE_YUV_TO_RGB_FLOAT\n\n");      printf("static float y_to_rgb_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");        printf("%f, ", 1.0/219.0*(i-16));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");    printf("static float v_to_r_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ",  1.40200/224.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static float u_to_g_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ", -0.34414/224.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static float v_to_g_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ", -0.71414/224.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static float u_to_b_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ",  1.77200/224.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("#endif // HAVE_YUV_TO_RGB_FLOAT\n\n");      /* JPEG Quantization */  printf("#ifdef HAVE_YUVJ_TO_RGB_FLOAT\n\n");    printf("static float yj_to_rgb_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ", (float)i/255.0);    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");      printf("static float vj_to_r_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ",  1.40200/255.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static float uj_to_g_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ", -0.34414/255.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static float vj_to_g_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ", -0.71414/255.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("static float uj_to_b_float[256] = \n{\n");  for(i = 0; i < 0x100; i++)    {    if(!((i)%8))      printf("  ");    printf("%f, ",  1.77200/255.0 * (i - 0x80));    if(!((i+1)%8))      printf("\n");    }  printf("};\n\n");  printf("#endif // HAVE_YUVJ_TO_RGB_FLOAT\n\n");  return 0;  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -