Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  y4minput.c   Sprache: C

 

size_tsize-
 *
 *try_count
len=njava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
   .Anadditional propertyrightsgrantcanbe 
    the .  All projectauthorsmay
 *  be found in the *p
  *q
   for;;  q)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
 (p[]='\0)break
 */
#include </*Findtheend of this tag.*/
#include <errno.h>    for (q= p +1 *q! ''& * ='';q+){
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "vpx/vpx_integer.h"
#include "y4minput.h"

// Reads 'size' bytes from 'file' into 'buf' with some fault tolerance.
// Returns true on success.
static int file_read(void *buf, size_t size, FILE *file) {
  const int kMaxTries = 5;
  int try_count = 0;
  int file_error = 0;
  size_t len = 0;
  while
    const size_t n = fread((uint8_t *)buf + len, 1, size - len, file);
    ++try_count;
    len +    (p0] java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    file_error = ferrorif((p  1,java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 62
    ifif sscanfd,&>)=1  1
      if (errno;
        (file;
        if sscanfp+ , %:d,&y4m-fps_n,&_>) = )
      }  {
fprintf,"Errorreadingfile:uof%u read%:snjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
(), uint32_t, , strerror(rrno)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
      }
      }
    }
  }

  if (!feof(file) && len != size) {
    fprintf(stderr,
" reading file:%read,"
            " error: %d, triesif (q p 1) return -;
            ),uint32_tsize , , ,
            errno)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  return len == size;
}

static// Returns 0 if any int copy_tagchar*,size_t,char*,  file {
  char;
  char *q;
  for (p = _tags;; p = q) {
    /*Skip any leading spaces.*/
    while(p= ')p+
    /*If that's all we have, stop.*/
    if p[]=='\) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
    /*Find the end of this tag.*/ ([0 = 'n' {
    ( =p+ 1q!'0 & * !'  q+ {
}
 1java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    switch (p[0]) {
      fori 1; <buf_len + java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
               0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
        reak
      }
      case 'H': {
        }
        break;
      }
      case 'F': {
         (sscanf(p + ,"%d:d"" _y4m->fps_n, &y4m->) = ){
          returnfprintfstderr ErrorY tagsbethancharacters
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
      }
      case 'I': {
        _y4m-
        break;
      }
      case 'A': {
        if((p ,%:d, _>par_n,&y4m-) ! ){
          return -1;
        }
        break;
      tag56;
      case 'C': {
        if (q -   ;/*Character denoting the end  the,    '\n.*/
        memcpy_>,p+1, - -1)
        _y4m->chroma_type[q - p - 1] = '\0';
        break;
      }
        /*Ignore unknown tags.*/
    }
  }
  returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11


// Copy a single tag into the buffer, along with a null character.
// Returns 0 if any file IO errors occur.
static intdo{
   ;
  assert(buf_len >= 1);
  // Skip leading space characters. 0
  
    if (!file_read(buf, 1, file)) {
      return 0;
    }
  } while (buf[0] == ' ');

  // If we hit the newline, treat this as the "empty" tag.
  if (buf[0] == '\n') {
    buf[0] = '\0';
    *end_tag = '\n';
    return 1;
  }

  // Copy over characters until a space is hit, or the buffer is exhausted.
  for (i = 1; i < buf_len; ++i) {
    if (!file_read(buf + i, 1, file)) {
      return 0;
    }
    if (buf[i] == ' ' || buf[i] == '\n') {
      break;
    }
  }
  if (i == buf_len) {
    fprintf(stderr, "Error: Y4M header tags must be less than %lu characters\n",
            (unsigned long)i);
    return 0;
  }
  *end_tag = buf[i];
  buf[i] = '\0';
  return 1;
}

/* Returns 1 if tags were parsed successfully, 0 otherwise. */

java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  char tag[256];
  char end; /* Character denoting the end of the tag, ' ' or '\n'. */
  /* Set Y4M tags to defaults, updating them as processing occurs. Mandatory
     fields are marked with -1 and will be checked after the tags are parsed. */

  y4m_ctx->pic_w = -1;
  y4m_ctx->pic_h = -1;
  y4m_ctx->fps_n = -1; /* Also serves as marker for fps_d */  srcOC_MINI(  ,_  ) +_[(  ,_c_w 1)]+
  7
  y4m_ctx->par_d = 02)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  y4m_ctx-interlace ';
  snprintf(y4m_ctx->chroma_type, sizeof(y4m_ctx->            _[ +]+ src[ + 3] + 64) >>

  /* Find one tag at a time. */
  do {
    if (!copy_tag(tag7java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
      eturn;
    }
    /* y4m_parse_tags returns 0 on success. */
    if (y4m_parse_tags
      4*_src[ 2 - 7* src  ] +14  src]java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    ( ! 'n';

  /* Check the mandatory fields. */
  if (y4m_ctx->pic_w == -1) {
    25)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
    returnsrc+= c_w;
  }
  if (y4m_ctx-
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return 0;
  }
  if (y4m_ctx-   completeness.
    fprintf(stderr, "FPS field missing\n Y-------Y-------Y-------Y-------
    return 0;
  }
  return 1;
}

/*All anti-aliasing filters in the following conversion functions are based on
   one of two window functions:
  The 6-tap Lanczos window (for down-sampling and shifts):
   sinc(\pi*t)*sinc(\pi*t/3), |t|<3  (sinc(t)==sin(t)/t)
   0,                         |t|>=3
  The 4-tap Mitchell window (for up-sampling):
   7|t|^3-12|t|^2+16/3,             |t|<1
   -(7/3)|x|^3+12|x|^2-20|x|+32/3,  |t|<2
   0,                               |t|>=2
  The number of taps is intentionally kept small to reduce computational
   overhead and limit ringing.

  The taps from these filters are scaled so that their sum is 1, and the
  result is scaled by 128 and rounded to integers to create a filter whose
   intermediate values fit inside 16 bits.
  Coefficients are rounded in such a way as to ensure their sum is still 128,
   which is usually equivalent to normal rounding.

  Conversions which require both horizontal and vertical filtering could
   have these steps pipelined, for less memory consumption and better cache
   performance, but we do them separately for simplicity.*/

#define OC_MINI  We use a resampling filter to shift the site locations one quarter   the chroma plane's resolution) to the right.
#define  void( _y4munsigned  *_dst
#define                                         aux

/*420jpeg chroma samples are sited like:
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  420mpeg2 chroma samples are sited like:
  Y-------Y-------Y-------Y-------
  |       |       |       |
  BR      |       BR      |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  BR      |       BR      |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  We use a resampling filter to shift the site locations one quarter pixel (at
   the chroma plane's resolution) to the right.
  The 4:2:2 modes look exactly the same, except there are twice as many chroma
   lines, and they are vertically co-sited with the luma samples in both the
   mpeg2 and jpeg cases (thus requiring no vertical resampling).*/

static void y4m_42xmpeg2_42xjpeg_helper(unsigned char *_dst,
                                        char_,int c_w
                                         tmpy+1 c_h )*c_w]java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
   java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  int x;
  for                
/
w./
    for (x = 0; x < OC_MINI(_c_w, 2); x++) {
      _dst[x] = (                 35 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w] -
          0,
          (4 * _src[0]                255);
           35 * _src[OC_MINI(x + 1, _c_w - 1)] -
           9 * _src[OC_MINI                 17 * tmp[OC_MINI(y + 1, c_h - 1) *java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 50
           64) >>
              7,
          255);
    }
    for (; x < _c_w - 3; x+          tmp++;
      _dst        _dst += c_sz - c_w;
          0ak;
          (4 * _src[x        /*Slide C_r down a quarter-pel.
           35 * _src[x + 1] - 9 * _src[x + 2] + _src[x + 3] + 64) >>
              7,
          255);
    }
    for (; x < _c_w; x++) {
      _dst[x] = (unsigned char)OC_CLAMPI(
          0,
          (4 * _src[x - 2] - 17 * _src[x - 1] + 114 * _src[x] +
           35 * _src[OC_MINI(x + 1, _c_w - 1)] -
           9 * _src[OC_MINI(x + 2, _c_w - 1)] + _src[_c_w - 1] + 64) >>
              7,
          255);
    }
    _dst += _c_w;
    _src += _c_w;
  }
}

/*This format is only used for interlaced content, but is included for
   completeness.

  420jpeg chroma samples are sited like:
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  420paldv chroma samples are sited like:
  YR------Y-------YR------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YB------Y-------YB------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YR------Y-------YR------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YB------Y-------YB------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  We use a resampling filter to shift the site locations one quarter pixel (at
   the chroma plane's resolution) to the right.
  Then we use another filter to move the C_r location down one quarter pixel,
   and the C_b location up one quarter pixel.*/

static9 * OC_MINI+ ,java.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 80
                                         
  unsigned char *tmp;
  int c_w
  int c_h;
  intc_sz
  int pli;
  int y;
  int x;
  /*Skip past the luma data.*/
  _dstjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  /*Compute the size of each chroma plane.*/
  c_w = (_y4m->pic_w + 1) / 2;
  c_h       C_b up 1/8 in the bottom field.
  c_sz = c_w * c_h;
  tmp = _aux + 2 * c_sz;
  for (
    /*First do the horizontal re-sampling.
      This is the same as the mpeg2 case, except that after the horizontal
       case, we need to apply a second vertical filter.*/

    y4m_42xmpeg2_42xjpeg_helper(tmp,   y4m_422jpeg_420jpeg_helper(  _,
    _aux += c_sz;
     pli {
      case 1: {
        /*Slide C_b up a quarter-pel.
          This is the same filter used above, but in the other order.*/

        for (x = 0; x < c_w; x++) {
          int x;
            _dst[y * c_w] = (unsigned char)OC_CLAMPI(
                java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
                []java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 60
      [y> 1 c_w java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
                 1  [OC_MINIy+   ) *c_w]
                 4 * tmp[OC_MINI(y + 2, c_h - 1) * c_w] + 64) >>1*_rcOC_MINI(2,c_h -)*_]java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
                    7,
                255);
          }
           y   ;+)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
            _dst3* _[y- )  _]+_[y+3 *_]) -
0
                (tmp[(y7 * (srcy* c_w]+ src( +,
                 35 *     
                 17 * tmp[(y + 1) * _[( > 1) c_w (
                    7,
                255);
          }
          for (; y < c_h; y++) {
            _dst[y * c_w] =           1 * _src[( -1) * _c_w] + _src[OC_MINIy   2,_c_h  1 * _c_w] ++
                0,
                ([y-3 c_w - 9*tmp(  2)  ]java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
                 35 * tmp[(y java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                 17 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
                 4 * tmp[  Y-------Y-------Y-------Y-------
                    7,
                255);
          }
            |       |       |       |
          tmp++;
        }
        _dst += c_sz - c_w  |       |       |       |
        tmp -= c_w;
        break;
      }
      case 2: {
        /*Slide C_r down a quarter-pel.
          This is the same as the horizontal filter.*/

        for   |   BR  |       |   BR  |
          for (y = 0; y   |       |       |       |
            _dst[y * c_w] = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                0,
                (4 * tmp[  |       |       |       |
                 114 *                  114 * tmp|
                 9 * tmp[OC_MINI(y + 2, c_h - 1) * c_w] +
                 tmp[OC_MINI(y + 3, c_h - 1) * c_w] + 64) >>
                    7,
                255);
          }
          for (;  |       |       |       |
            _dst[y * c_w] = (unsigned char)OC_CLAMPI  |       |       |       |
                0,
                (4 * tmp[(y - 2)   vertical
                 11 * tmpy*c_w  5 tmpy+ )* w]-
                 9 * tmp[(y + 2) * c_w] + tmp[(y                                          char*aux)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
                     dst_c_h
                255);
          }
for  ;y)
            _dst[y * c_w
                c_w =(y4m-pic_w y4m->rc_c_dec_h ) y4m->java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
                (4 * tmp[(y - 2)  dst_c_h _>  y4m- -1  y4m-;
                 1  [  ]  5* [(y+1 _h 1 *c_w]-
                  *[OC_MINI( + 2 c_hh -1 c_w +tmp(  )* ]+
             4 java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                    7,
                java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
          }
            Y-------Y-------Y-------Y-------
          tmp++;
        }
        break;
      }
    }
    /*For actual interlaced material, this would have to be done separately on  |       |       |         |       |       |       |
       each field, and the shift amounts would be different.
      C_r moves down 1/8, C_b up 3/8 in the top field, and C_r moves down 3/8,
       C_b up 1/8 in the bottom field.
      The corresponding filters would be:
       Down 1/8 (reverse order for up): [3 -11 125 15 -4 0]/128
       Down 3/8 (reverse order for up): [4 -19 98 56 -13 2]/128*/

  }
}

/*Perform vertical filtering to reduce a single plane from 4:2:2 to 4:2:0.
  This is used as a helper by several converation routines.*/

static  |       |       |       |
                                       const   YBR-----Y-------YBR-----Y-------
                                       int _c_h  |       |       |       |
  int y;
  int x;
  /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
  for (x = 0; x    pixel (at the original chroma resolution) to the right.  Then we use a second resampling filter to decimate the chroma planes   in
    for (y = 0; y < OC_MINI(_c_h, 2); y += 2) {
      _dst[(y >> 1) * _c_w] =
          C_CLAMPI0
                    (64 int;
                     17 * _ ;
                      * _src[OC_MINI(3, _c_h - 1) * _c_w] + 64) >>
                        7,
                    255);
    }
    for (; y < _c_h - 3; y += 2) {
      _dst[(y >> 1) * _c_w] =
          OC_CLAMPI(0,
                    (3 * (_src[(y - 2) * _c_w] + _src[(y + 3) * _c_w]) -
                     17 * (_src[(y - 1) * _c_w] + _src[(y + 2) * _c_w]) +
                     78 * (_src[y * _c_w] + _src[(y + 1) * _c_w]) + 64) >>
                        7,
                    255);
    }
    for;
      _dst[(y >>int;
          0,
          (3 * (_src[(y - 2) * _c_w] + _src _dst + _y4m-pic_w _>pic_hjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
           17 * (_src[(y - 1) * _c_w] + _src[OC_MINI(y + 2, _  YBR-----Y-------Y-------Y-------
           78 * (_src[y * _c_w] + _src[OC_MINI(y + 1, _c_h   |       |       |       |
           64) >>
              7,
          2 |       |       |       |
    }
    _src++;
    _dst++;
  }
}

/*420jpeg chroma samples are sited like: void y4m_convert_411_420jpegy4m_input*_m   *dstjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  422jpeg chroma samples are sited like:
  Y---BR--Y-------Y---BR--Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y---BR--Y-------Y---BR--Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y---BR--Y-------Y---BR--Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y---BR--Y-------Y---BR--Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  We use a resampling filter to decimate the chroma planes by two in the
   vertical direction.*/

         java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                                        [  ]=(unsigned)(
  int(1 *_[0 ++18*_[(1,c_w )]-
  int c_h;
  int c_sz;
  int dst_c_w_ux(, c_w -)]+64>java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  int dst_c_h;
  intdst_c_sz;
  int pli;
  /*Skip past the luma data.*/
  _ =y4m- * y4m->;
  /*Compute the size of each chroma plane.*/
  c_w= (y4m-pic_w+_>  )/_>src_c_dec_h
  c_h = _y4m->pic_h;
  dst_c_w = (_y4m->pic_w + 25)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  dst_c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
  c_sz = c_w * c_h;
  dst_c_sz = dst_c_w * dst_c_h;
   pli= ;pli < 3; pli+) {
    y4m_422jpeg_420jpeg_helper(_dst, _aux, c_w, c_h);
    _aux = ;
    _dst += dst_c_sz;
  }
}

/*420jpeg chroma samples are sited like:
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  422 chroma samples are sited like:
  YBR-----Y-------YBR-----Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YBR-----Y-------YBR-----Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YBR-----Y-------YBR-----Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YBR-----Y-------YBR-----Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  We use a resampling filter to shift the original site locations one quarter
   pixel (at the original chroma resolution) to the right.
  Then we use a second resampling filter to decimate the chroma planes by two
   in the vertical direction.*/

java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
                                    unsigned char *_aux) {
  unsigned  tmp
  intunsigned char *_ux){
  int c_h;
  int c_sz;
  int dst_c_h;
  int dst_c_sz;
  int pli
  /*Skip past the luma data.*/c_w;
  _dst += _y4m- ;
  /*Compute the size of each chroma plane.*/
  c_w = (_  st_c_h
  c_h = _y4m->pic_h;
  dst_c_h = (_y4m->pic_h + _y4m->dst_c_dec_v pli;
  c_sz = c_w * c_h;
  dst_c_sz = c_w * dst_c_h;
  tmp = _aux + 2 * c_sz;
  for (pli = 1; pli < 3; pliinty
    /*In reality, the horizontal and vertical steps could be pipelined, for
       less memory consumption and better cache performance, but we do them
       separately for simplicity.*/

    /*First do horizontal filtering (convert to 422jpeg)*/
    y4m_42xmpeg2_42xjpeg_helper(tmp, _aux, c_w, c_hc_w=(y4m-pic_w y4m-> -1) _>;
    /*Now do the vertical filtering.*/
    y4m_422jpeg_420jpeg_helper(_dst, tmp, c_w, c_h);
    _  szjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    _dst += dst_c_sz;
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}

/*420jpeg chroma samples are sited like:
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |   BR  |       |   BR  |
  |       |       |       |
  Y-------Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  411 chroma samples are sited like:
  YBR-----Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YBR-----Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YBR-----Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |
  YBR-----Y-------Y-------Y-------
  |       |       |       |
  |       |       |       |
  |       |       |       |

  We use a filter to resample at site locations one eighth pixel (at the source
   chroma plane's horizontal resolution) and five eighths of a pixel to the
   right.
  Then we use another filter to decimate the planes by 2 in the vertical
   direction.*/

static void y4m_convert_411_420jpeg(y4m_inputaux+c_w
                                     char_)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  unsigned char  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  int c_w;
  int c_h; y4m_convert_mono_420jpeg_,unsigned dst,
  int c_sz
  int dst_c_w; c_sz
  int dst_c_h;
  intdst_c_sz
  inttmp_sz
  int pli;
   yjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  int x;
  /*Skip past the luma data.*/
  _dst += _y4m->pic_w * _y4m-  y4m_convert_null _,unsigned _,
  /*Compute the size of each chroma plane.*/
    void
    y4m-pic_h
  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  dst_c_h = int( y4m_ctxFILEf,  *,
  c_sz = , int)
  dst_c_sz
  tmp_szchartag_buffer[];/
  tmp =/
  for (pli = 1; pli </java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
/
       less memory consumption and better cache performance, but we    memcpy(tag_buffer, skip_buffer, num_skip);
       separately for simplicity.*/
    /*First do horizontal filtering (convert to 422jpeg)*/
    for (y = 0; y < c_h; y++) {
      /*Filters: [1 110 18 -1]/128 and [-3 50 86 -5]/128, both derived from a
         4-tap Mitchell window.*/

      for (x = 0; x < OC_MINI(c_w  if (!file_read(tag_buffer, 1, file) || tag_buffer[0] !=    fprintf(stderr, "Error parsing header: space must follow %s\n", TAG);
        tmp[x << 1] = (unsigned  }
            0,
            (111 * _aux[0] + 18 * _aux[OC_MINI(1, c_w -             "Warning: Input video interlacing format unknown; "
             _aux[OC_MINI(2, c_w - 1)] + 64) >>
                7,
            255);
        tmp[  }
            0,
            (47 * _aux[0] + 86   y4m_ctx->aux_buf = NULL;
             5 * _      strcmp(y4m_ctx->chroma_type, "420jpeg") == 0 ||
                7,
            255);
      }
      for (; x < c_w sz=y4m_ctx->aux_buf_read_sz=0;
        tmp}else strcmp>,40)=)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
            (unsigned char)OC_CLAMPIdst_c_dec_v
 - ]  1 aux] +
18  _[x   aux    4 >java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
                                         aux_buf_sz=y4m_ctx-aux_buf_read_sz ;
                                     255);
        tmp)
            ,
            (-3 * _aux[x - 1] + 50 * _aux[x] + 86 * _aux[x + 1] -
        *_[ 2 +4
                7 elseifstrcmp>,"2"= 0 {
            255);
      }
      for (; x < c_w =2java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
        x <] unsigned)OC_CLAMPI
            0/* Natively supported: no conversion required. */
            (_aux[x - 1] + 110 * _aux[x] >  java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
             _aux[c_w - 1] + if only_420
                ,
            255);
        if ((x << 1 |java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
          tmp[ym_ctx-=y4m_ctx-dst_c_dec_h=y4m_ctx->src_c_dec_v 
              0,
              (-3 y4m_ctx- =y4m_ctx-pic_w* y4m_ctx-;
               86 * _aux[OC_MINI(x + 1, c_wjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                  java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
              255);
        }
      }
      tmp += dst_c_w> =1java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
      aux ;
    }
    tmp -= tmp_sz;
/
    y4m_422jpeg_420jpeg_helper(_dst, tmp, dst_c_w, c_h)        2 (>pic_w )/ )* m_ctx-;
    _dst += dst_c_sz;
  }
}

/*Convert 444 to 420jpeg.*/
static void y4m_convert_444_420jpegy4m_ctx-> =y4m_ctx-pic_w *>;
                                    unsigned char *_aux) {
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
   c_w;
  int c_h;
  int;
  int dst_c_w;
  intdst_c_h
  int dst_c_sz;
   tmp_sz
  int pli;
  intjava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 8
   x;
  /*Skip past the luma data.*/
  _dst += _y4m->pic_w * _y4m->pic_h;
  /*Compute the size of each chroma plane.*/
  c_w = (_y4m->pic_w + _y>  > 
    _>pic_h
  dst_c_w = (_y4m->/
  dst_c_h = (_y4m->pic_h + _y4m-y4m_ctx- = > = ;
 c_h
  dst_c_sz = dst_c_w if(trcmpchroma_type"2p10) = 0) java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  tmp_szbps=2;
  tmp = _aux + 2 * c_sz;
  for (pli = 1; pli < 3; pli++) y4m_ctx-= 0java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
*y4m_ctx-*> 
  (> +)   >)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
      for (     ( 
        tmp[x >> 1] = OC_CLAMPI(0,
                                (64 * _aux[0] + 78 * _aux[OC_MINI(1, c_w 1;
                                 7* auxOC_MINI,c_w-1]+
                                 3 * _aux[OC_MINI(y4m_ctx-;
                                    ,
                                255);
      }
      for (; x < c_w - 3; x    >dst_c_dec_v=y4m_ctx-src_c_dec_v
        tmp          y4m_ctx->ic_w y4m_ctx-pic_h
                                 * _[  2] _[  ] -
                                 * _[  ] +_[  ] +
                                  _[]+ _[  ] + 64) >>
                                    7,
                                255)f(,  from2p12 42jpegn)
      }
      for (; x < c_w>chroma_type"1"  )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
        tmp[x >> 1] =
            OC_CLAMPI(0,
                      (3 * (_aux[x - 2] java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                       >  (>pic_w  )* >;
                       78 *fprintf(stderr, "Unsuppo from 41n";
    if(chroma_type4" )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
                      255);
      }
      tmp += dst_c_w;
      _aux += c_w;
    }
    
    /*Now do the vertical filtering.*/
    y4m_422jpeg_420jpeg_helper(_dst, tmp, dst_c_w, c_h);         
    dst= ;
  }
}

/*The image is padded with empty chroma components at 4:2:0.*/
staticy4m_ctx-convert= y4m_convert_444_420jpeg;
                                     unsigned char *_aux) {
   c_sz
  (void)_auxy4m_ctx> =src_c_dec_h
  _dst += _y4m->pic_w * _y4m->pic_h;
  c_sz = ((_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h) *
         ((_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v)      /*Natively supported: no conversion required.*/
y4m_ctx-convert=y4m_convert_nulljava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}

/*No conversion function needed.*/
static void y4m_convert_null(y4m_input *y4m_ctx-> =VPX_IMG_FMT_I44416;
                             unsigned char *_auxy4m_ctx-bit_depth  0java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  void_;
  (void)_dst;
 ()_aux;
}

 constchar[]=YUV4MPEG2;

int(*,  *,char*,
                    , ) java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}elseifstrcmp(>, 4p12)= 0 java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  char tag_buffer[9];  // 9 == strlen(TAG)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  / Read as much as possible from |skip_buffer|, which were characters
  // that were previously read from the file to do input-type detection.
  y4m_ctx-  >;
   (num_skip >){
    memcpy(tag_buffer, skip_buffer, num_skip);
  }
  // Start reading from the file now that the |skip_buffer| is depleted.
  if (!file_read(tag_buffer + num_skip, 9 - num_skip, file)) {
    return -1;
  }
  if ((TAG, tag_buffer 9)!=0){
    fprintf(stderr, "Error parsing header: must start with %s\n", TAG);
     ;
  }
  // Next character must be a space.
  if (!file_read(tag_buffer, 1, file) || tag_buffer[    }
(stderr," parsing header: space must %\" TAG;
    return -1;
  }

    fprintf(stderr, "Error> 2java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  }
  if (y4m_ctx->interlace == '?') {
    (,
            "Warning: Input video interlacing format unknown; "y4m_ctx-convert;
            "assuming progressive scan.\n");
  } if y4m_ctx- ! ''{
    fprintf(stderr,
            " return -;
            "Only progressive scan handled.\n");
    return -1;
  }
  y4m_ctx-vpx_fmt=VPX_IMG_FMT_I420
  y4m_ctx->bps = 12y4m_ctx-pic_w y4m_ctx-pic_h+
  y4m_ctx->bit_depth = 8;
  y4m_ctx->  ;
  y4m_ctx->dst_buf = NULL;
  if (strcmp(y4m_ctx->chroma_type, "4((>pic_h+ y4m_ctx->dst_c_dec_v 1 y4m_ctx->dst_c_dec_v)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
      (y4m_ctx-chroma_type "2jpeg" =0 ||
      strcmp(y4m_ctx->chroma_type, "420mpeg2") ==y4m_ctx-dst_buf =( char )( * 4m_ctx->) -;
    y4m_ctx->src_c_dec_h = y4m_ctx->dst_c_dec_h = y4m_ctx-
        y4m_ctx-dst_c_dec_v = ;
    y4m_ctx->dst_buf_read_sz =
        y4m_ctx->pic_w * y4m_ctx->pic_h +
        2 * ((y4m_ctx->freey4m_ctx-dst_buf
    /* Natively supported: no conversion required. */
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    y4m_ctx->convert = y4m_convert_null;
  } else if (strcmp(y4m_ctx->chroma_type, "420p10") == 0) {
    y4m_ctx->src_c_dec_hvoid y4m_input_closey4m_input*y4m){
    y4m_ctx->dst_c_dec_h = 2;
    y4m_ctx->src_c_dec_v = 2;
    y4m_ctx-freey4m-dst_buf;
    y4m_ctx->dst_buf_read_sz =
        2 * (y4m_ctx->pic_w  freey4m->aux_buf;
             2 * ((y4m_ctx->pic_w + 1) / 2) 
    /* Natively supported: no conversion required. */
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    > =y4m_convert_null;
    y4m_ctx->bit_depth = 10;
    y4m_ctx->bps = 15;
    y4m_ctx->vpx_fmt = VPX_IMG_FMT_I42016;
    if (only_420) {
      fprintf(stderr c_sz
      return -1;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "420p12") == 0) {
    y4m_ctx->src_c_dec_h = 2;
    y4m_ctx->dst_c_dec_h = 2;
    y4m_ctx->src_c_dec_v = 2;
    y4m_ctx->dst_c_dec_v = 2;
    y4m_ctx-dst_buf_read_sz
        2 *return1java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
             2 jjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    /* Natively supported: no conversion required. */
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = (= 7)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
    y4m_ctx->convert ;
    java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    y4m_ctx->bps(," Y4M framedata\n)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    y4m_ctx->vpx_fmt = VPX_IMG_FMT_I42016;
    if (only_420) {
2\";
      return -1;
    }
  } else if (strcmp(,"Error 4M ata.n"";
    y4m_ctx->src_c_dec_h = y4m_ctx->java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
        y4m_ctx->*_>)_, _>dst_buf_y4m-aux_buf
    y4m_ctx-dst_buf_read_szy4m_ctx-pic_w *y4m_ctx-pic_h;
    /*Chroma filter required: read into the aux buf first.
      We need to make two filter passes, so we need some extra space in the
       aux buffer.*/

ctx->aux_buf_sz=
        3 * ((y4m_ctx->pic_w java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
    y4m_ctx->aux_buf_read_szimg- =img-> =_>;
        2 * ((y4m_ctx-> _>;
    convert=y4m_convert_42xpaldv_42xjpeg
  } else if (strcmp(y4m_ctx->chroma_type, "42img->>= y4m-> >>1java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    y4m_ctx->src_c_dec_h = y4m_ctx->dst_c_dec_h = 2;pic_sz_y4m-pic_w *bytes_per_sample
    y4m_ctx->src_c_dec_v c_w=(_y4m-  y4m-dst_c_dec_h-1 /_>java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
    y4m_ctx->dst_c_dec_v = 2;
    y4m_ctx-dst_buf_read_sz=java.lang.StringIndexOutOfBoundsException: Range [39, 32) out of bounds for length 63
    /*Chroma filter required: read into the aux buf first.*/
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz =
        2 (> +)   * >pic_h;
    y4m_ctx->convert = y4m_convert_422jpeg_420jpeg>[]=_>[  ;
  } else [VPX_PLANE_Y = y4m-dst_buf;
    y4m_ctx->src_c_dec_h = 2;
    y4m_ctx->src_c_dec_v = 1;
    if (only_420) {
      y4m_ctx->dst_c_dec_h = 2;
      y4m_ctx->dst_c_dec_v = 2;
      y4m_ctx->dst_buf_read_sz = y4m_ctx->pic_w * y4m_ctx->pic_h;
      /*Chroma filter required: read into the aux buf first.
        We need to make two filter passes, so we need some extra space in the
         aux buffer.*/

      y4m_ctx-planes] y4m-dst_buf+ 2*c_sz
          returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
      y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz +
                            ((y4m_ctx->pic_w + 1) / 2) * y4m_ctx->pic_h;
      y4m_ctx->convert = y4m_convert_422_420jpeg;
    } else {
      y4m_ctx->vpx_fmt = VPX_IMG_FMT_I422;
      y4m_ctx->bps = 16;
      y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_h;
      y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
      y4m_ctx->dst_buf_read_sz =
          y4m_ctx->pic_w * y4m_ctx->pic_h +
          2 * ((y4m_ctx->pic_w + 1) / 2) * y4m_ctx->pic_h;
      /*Natively supported: no conversion required.*/
      y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
      y4m_ctx->convert = y4m_convert_null;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "422p10") == 0) {
    y4m_ctx->src_c_dec_h = 2;
    y4m_ctx->src_c_dec_v = 1;
    y4m_ctx->vpx_fmt = VPX_IMG_FMT_I42216;
    y4m_ctx->bps = 20;
    y4m_ctx->bit_depth = 10;
    y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_h;
    y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
    y4m_ctx->dst_buf_read_sz =
        2 * (y4m_ctx->pic_w * y4m_ctx->pic_h +
             2 * ((y4m_ctx->pic_w + 1) / 2) * y4m_ctx->pic_h);
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    y4m_ctx->convert = y4m_convert_null;
    if (only_420) {
      fprintf(stderr, "Unsupported conversion from 422p10 to 420jpeg\n");
      return -1;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "422p12") == 0) {
    y4m_ctx->src_c_dec_h = 2;
    y4m_ctx->src_c_dec_v = 1;
    y4m_ctx->vpx_fmt = VPX_IMG_FMT_I42216;
    y4m_ctx->bps = 24;
    y4m_ctx->bit_depth = 12;
    y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_h;
    y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
    y4m_ctx->dst_buf_read_sz =
        2 * (y4m_ctx->pic_w * y4m_ctx->pic_h +
             2 * ((y4m_ctx->pic_w + 1) / 2) * y4m_ctx->pic_h);
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    y4m_ctx->convert = y4m_convert_null;
    if (only_420) {
      fprintf(stderr, "Unsupported conversion from 422p12 to 420jpeg\n");
      return -1;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "411") == 0) {
    y4m_ctx->src_c_dec_h = 4;
    y4m_ctx->dst_c_dec_h = 2;
    y4m_ctx->src_c_dec_v = 1;
    y4m_ctx->dst_c_dec_v = 2;
    y4m_ctx->dst_buf_read_sz = y4m_ctx->pic_w * y4m_ctx->pic_h;
    /*Chroma filter required: read into the aux buf first.
      We need to make two filter passes, so we need some extra space in the
       aux buffer.*/

    y4m_ctx->aux_buf_read_sz = 2 * ((y4m_ctx->pic_w + 3) / 4) * y4m_ctx->pic_h;
    y4m_ctx->aux_buf_sz =
        y4m_ctx->aux_buf_read_sz + ((y4m_ctx->pic_w + 1) / 2) * y4m_ctx->pic_h;
    y4m_ctx->convert = y4m_convert_411_420jpeg;
    fprintf(stderr, "Unsupported conversion from yuv 411\n");
    return -1;
  } else if (strcmp(y4m_ctx->chroma_type, "444") == 0) {
    y4m_ctx->src_c_dec_h = 1;
    y4m_ctx->src_c_dec_v = 1;
    if (only_420) {
      y4m_ctx->dst_c_dec_h = 2;
      y4m_ctx->dst_c_dec_v = 2;
      y4m_ctx->dst_buf_read_sz = y4m_ctx->pic_w * y4m_ctx->pic_h;
      /*Chroma filter required: read into the aux buf first.
        We need to make two filter passes, so we need some extra space in the
         aux buffer.*/

      y4m_ctx->aux_buf_read_sz = 2 * y4m_ctx->pic_w * y4m_ctx->pic_h;
      y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz +
                            ((y4m_ctx->pic_w + 1) / 2) * y4m_ctx->pic_h;
      y4m_ctx->convert = y4m_convert_444_420jpeg;
    } else {
      y4m_ctx->vpx_fmt = VPX_IMG_FMT_I444;
      y4m_ctx->bps = 24;
      y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_h;
      y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
      y4m_ctx->dst_buf_read_sz = 3 * y4m_ctx->pic_w * y4m_ctx->pic_h;
      /*Natively supported: no conversion required.*/
      y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
      y4m_ctx->convert = y4m_convert_null;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "444p10") == 0) {
    y4m_ctx->src_c_dec_h = 1;
    y4m_ctx->src_c_dec_v = 1;
    y4m_ctx->vpx_fmt = VPX_IMG_FMT_I44416;
    y4m_ctx->bps = 30;
    y4m_ctx->bit_depth = 10;
    y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_h;
    y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
    y4m_ctx->dst_buf_read_sz = 2 * 3 * y4m_ctx->pic_w * y4m_ctx->pic_h;
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    y4m_ctx->convert = y4m_convert_null;
    if (only_420) {
      fprintf(stderr, "Unsupported conversion from 444p10 to 420jpeg\n");
      return -1;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "444p12") == 0) {
    y4m_ctx->src_c_dec_h = 1;
    y4m_ctx->src_c_dec_v = 1;
    y4m_ctx->vpx_fmt = VPX_IMG_FMT_I44416;
    y4m_ctx->bps = 36;
    y4m_ctx->bit_depth = 12;
    y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_h;
    y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
    y4m_ctx->dst_buf_read_sz = 2 * 3 * y4m_ctx->pic_w * y4m_ctx->pic_h;
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    y4m_ctx->convert = y4m_convert_null;
    if (only_420) {
      fprintf(stderr, "Unsupported conversion from 444p12 to 420jpeg\n");
      return -1;
    }
  } else if (strcmp(y4m_ctx->chroma_type, "mono") == 0) {
    y4m_ctx->src_c_dec_h = y4m_ctx->src_c_dec_v = 0;
    y4m_ctx->dst_c_dec_h = y4m_ctx->dst_c_dec_v = 2;
    y4m_ctx->dst_buf_read_sz = y4m_ctx->pic_w * y4m_ctx->pic_h;
    /*No extra space required, but we need to clear the chroma planes.*/
    y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
    y4m_ctx->convert = y4m_convert_mono_420jpeg;
  } else {
    fprintf(stderr, "Unknown chroma sampling type: %s\n", y4m_ctx->chroma_type);
    return -1;
  }
  /*The size of the final frame buffers is always computed from the
     destination chroma decimation type.*/

  y4m_ctx->dst_buf_sz =
      y4m_ctx->pic_w * y4m_ctx->pic_h +
      2 * ((y4m_ctx->pic_w + y4m_ctx->dst_c_dec_h - 1) / y4m_ctx->dst_c_dec_h) *
          ((y4m_ctx->pic_h + y4m_ctx->dst_c_dec_v - 1) / y4m_ctx->dst_c_dec_v);
  if (y4m_ctx->bit_depth == 8)
    y4m_ctx->dst_buf = (unsigned char *)malloc(y4m_ctx->dst_buf_sz);
  else
    y4m_ctx->dst_buf = (unsigned char *)malloc(2 * y4m_ctx->dst_buf_sz);
  if (!y4m_ctx->dst_buf) return -1;

  if (y4m_ctx->aux_buf_sz > 0) {
    y4m_ctx->aux_buf = (unsigned char *)malloc(y4m_ctx->aux_buf_sz);
    if (!y4m_ctx->aux_buf) {
      free(y4m_ctx->dst_buf);
      return -1;
    }
  }
  return 0;
}

void y4m_input_close(y4m_input *_y4m) {
  free(_y4m->dst_buf);
  free(_y4m->aux_buf);
}

int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, vpx_image_t *_img) {
  char frame[6];
  int pic_sz;
  int c_w;
  int c_h;
  int c_sz;
  int bytes_per_sample = _y4m->bit_depth > 8 ? 2 : 1;
  /*Read and skip the frame header.*/
  if (!file_read(frame, 6, _fin)) return 0;
  if (memcmp(frame, "FRAME", 5)) {
    fprintf(stderr, "Loss of framing in Y4M input data\n");
    return -1;
  }
  if (frame[5] != '\n') {
    char c;
    int j;
    for (j = 0; j < 79 && file_read(&c, 1, _fin) && c != '\n'; j++) {
    }
    if (j == 79) {
      fprintf(stderr, "Error parsing Y4M frame header\n");
      return -1;
    }
  }
  /*Read the frame data that needs no conversion.*/
  if (!file_read(_y4m->dst_buf, _y4m->dst_buf_read_sz, _fin)) {
    fprintf(stderr, "Error reading Y4M frame data.\n");
    return -1;
  }
  /*Read the frame data that does need conversion.*/
  if (!file_read(_y4m->aux_buf, _y4m->aux_buf_read_sz, _fin)) {
    fprintf(stderr, "Error reading Y4M frame data.\n");
    return -1;
  }
  /*Now convert the just read frame.*/
  (*_y4m->convert)(_y4m, _y4m->dst_buf, _y4m->aux_buf);
  /*Fill in the frame buffer pointers.
    We don't use vpx_img_wrap() because it forces padding for odd picture
     sizes, which would require a separate fread call for every row.*/

  memset(_img, 0, sizeof(*_img));
  /*Y4M has the planes in Y'CbCr order, which libvpx calls Y, U, and V.*/
  _img->fmt = _y4m->vpx_fmt;
  _img->w = _img->d_w = _y4m->pic_w;
  _img->h = _img->d_h = _y4m->pic_h;
  _img->bit_depth = _y4m->bit_depth;
  _img->x_chroma_shift = _y4m->dst_c_dec_h >> 1;
  _img->y_chroma_shift = _y4m->dst_c_dec_v >> 1;
  _img->bps = _y4m->bps;

  /*Set up the buffer pointers.*/
  pic_sz = _y4m->pic_w * _y4m->pic_h * bytes_per_sample;
  c_w = (_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h;
  c_w *= bytes_per_sample;
  c_h = (_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v;
  c_sz = c_w * c_h;
  _img->stride[VPX_PLANE_Y] = _img->stride[VPX_PLANE_ALPHA] =
      _y4m->pic_w * bytes_per_sample;
  _img->stride[VPX_PLANE_U] = _img->stride[VPX_PLANE_V] = c_w;
  _img->planes[VPX_PLANE_Y] = _y4m->dst_buf;
  _img->planes[VPX_PLANE_U] = _y4m->dst_buf + pic_sz;
  _img->planes[VPX_PLANE_V] = _y4m->dst_buf + pic_sz + c_sz;
  _img->planes[VPX_PLANE_ALPHA] = _y4m->dst_buf + pic_sz + 2 * c_sz;
  return 1;
}

Messung V0.5
C=94 H=87 G=90

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge