typedef enum
{
  JPEG_SUBSAMPLING_2x2_1x1_1x1 = 0,  /* smallest file */
  JPEG_SUBSAMPLING_2x1_1x1_1x1 = 1,  /* 4:2:2         */
  JPEG_SUBSAMPLING_1x1_1x1_1x1 = 2,
  JPEG_SUBSAMPLING_1x2_1x1_1x1 = 3
} JpegSubsampling;


int main() {
    int orig_subsmp;
    int subsmp;
    int out;

    printf("OLD:\n");
    for (orig_subsmp = 0; orig_subsmp < 4; orig_subsmp++) {
        for (subsmp = 0; subsmp < 4; subsmp++) {
            out = subsmp;

            if (orig_subsmp == JPEG_SUBSAMPLING_1x1_1x1_1x1 ||
                  ((int) orig_subsmp > 0 &&
                   subsmp == JPEG_SUBSAMPLING_1x1_1x1_1x1))
            {
              out = orig_subsmp;
            }
            printf("%i ", out);
        }
        printf("\n");
    }

    printf("\n");
    printf("NEW:\n");

    for (orig_subsmp = 0; orig_subsmp < 4; orig_subsmp++) {
        for (subsmp = 0; subsmp < 4; subsmp++) {
            out = subsmp;

            /* Skip changing subsampling to original if we alredy have best
             * setting or if original have worst setting */
            if (!(subsmp == JPEG_SUBSAMPLING_1x1_1x1_1x1 ||
                orig_subsmp == JPEG_SUBSAMPLING_2x2_1x1_1x1))
            {
              out = orig_subsmp;
            }
            printf("%i ", out);
        }
        printf("\n");
    }
}