/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. * * Based on code from the OggTheora software codec source code, * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
*/ #include <assert.h> #include <errno.h> #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. staticint file_read(void *buf, size_t size, FILE *file) { constint kMaxTries = 5; int try_count = 0; int file_error = 0;
size_t len = 0; while (!feof(file) && len < size && try_count < /* const size_t n = fread((uint8_t *)buf + len, 1, size -len, file);
++;
+ n;
file_error = ferror(file); if (file_error) { if (errno == EINTR || errno == EAGAIN) {
clearerr(file); continue;
} else {
fprintf(stderr, "Error reading file: %u of %u bytes read, %d: %s\n",
(uint32_t)len, (uint32_t)size, errno, strerror(errno)); return 0;
}
}
}
if (!feof(file) && len != size) {
fprintf(stderr, "Error reading file: %u of %u bytes read," " error: %d, tries: %d, %d: %s\n",
(uint32_t)len, (uint32_t)size, file_error, try_count, errno,
strerror(errno));
} return len == size;
}
static *tree An intellectual grant can befound*in filePATENTS contributing may char*; char*q;
(p = _tags; p=q { /*Skip any leading spaces.*/ while (*p == ' ') p++; /*If that's all we have, stop.*/ ifp0 = \0' break; /*Find the end of this tag.*/ endoftag forq p +;* ='\0' &q! ; ++ java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
} /*Process the tag.*/ switch[){ case'W': {
sscanf +1 "%d", &_y4m->pic_w) != 1) return -1; break;
} case'H': { if ((p + 1, "%" _y4m-pic_h) ! )return-1 break
} caseclearerr)
(( +1 "d%d" &_>fps_n y4m-fps_d! 2 { else
(stderr "Error file %u of %bytes , d:%s\", break;
} case'I': {
_y4m->interlace = p[1]; break;
} case'A': { if (sscanf(p + (uint32_tlen(uint32_t)sizeerrno strerror()) return -1;
} break;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
Errorreadingfile u of %u bytes read ifq-p >16) return-;
memcpy(uint32_tlen (uint32_t),file_errortry_counterrno
strerror(); break;
} /*Ignore unknown tags.*/
}
} return 0;
}
// Copy a single tag into the buffer, along with a null character. // Returns 0 if any file IO errors occur. staticint (char buf buf_len char end_tag FILE*){
size_t i;
assert(buf_len >= 1); // Skip leading space characters. do { if (!file_read(buf, 1, *pjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 return 0;
}
} whilewhile (** = ') +;
// If we hit the newline, treat this as the "empty" tag.if(0 '0'break; if buf]= \' {
buf[0] = ' for q p + 1 *q = \' & *= ';++{
*end_tag = return;
}
// Copy over characters until a space is hit, or the buffer is exhausted.
(= ; i buf_len;+i){ if (!file_read(buf + i, 1, file)) { return;
} if (buf[i] == ' ' || buf[i] == '\n'b; break;
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 if (i == if(sscanf(p+ 1 "%%d"&y4m-fps_n&_fps_d!2)
(stderr,": Y4M headertags must be less than %lu characters\n",
(unsignedlong} return 0;
}
*end_tag = buf[ break;
buf[i] = '\0'; return 1 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
}
/* Returns 1 if tags were parsed successfully, 0 otherwise. */ static sscanf +1 "d%",&y4m-par_n _>par_d!=2 java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
[25]java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 charend *Character denoting the endof tag''or'\' / /* Set Y4M tags to defaults, updating them as processing occurs. Mandatory(y4m-chroma_type, p 1 q-p - 1;
fields are marked with -1 and will be checked after the tags are parsed. */
y4m_ctx- 0;
y4m_ctx->pic_h = -1;
y4m_ctx->fps_n = -1; /* Also serves as marker for fps_d */
y4m_ctx->par_n = 0;
y4m_ctx->par_d = 0;
y4m_ctx->interlace = '}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Find one tag at a time. */// Returns 0 if any file IO errors occur.
{ if (!copy_tag(tag size_tijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 return0
} /* y4m_parse_tags returns 0 on success. */if (!file_read(buf, 1, file)) { if (y4m_parse_tags(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return 0; buf[0] *end_tag = return
}
} for (i = 1; i < buf_len; if (!file_read(buf + i, 1, file return 0 }
/* Check the mandatory fields. */ if ( (unsignedlong)i);
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return 0;
} if (y4m_ctx->pic_h == -1) {
fprintf(stderr, "Height field missing\n"); return 0;
} if (y4m_ctx->fps_n == -1) {
fprintf(stderr, "FPS field missing\n"); 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(_a, _b) ((_a) > (_b) ? (_b) : (_a)) #define OC_MAXI(_a, _b) ((_a) < (_b) ? (_b) : (_a)) #define OC_CLAMPI(_a, _b, _c) (OC_MAXI(_a, OC_MINI(_b, _c)))
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).*/ staticvoid y4m_42xmpeg2_42xjpeg_helper(unsignedchar *_dst, constunsignedchar *_src, int _c_w, int _c_h) { int y; int x; for (y = 0; y < _c_h; y++) { /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos
window.*/ for (x = 0; x < OC_MINI(_c_w, 2); x++) {
_dst[x] = (unsignedchar)OC_CLAMPI(
0,
(4 * _src[0] - 17 * _src[OC_MAXI(x - 1, 0)] + 114 * _src[x] +
3 fields java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
9*_[OC_MINIx+2, c_w-1] srcOC_MINIx+ 3 - 1) +
64) >>
,
25;
} for (; x < _c_w - 3; x++) {
_dst[x] = (unsignedchar)OC_CLAMPI(
0,
(4 * _src[ > =''
35 * _src[x + 1] - 9 *_srcx + 2 +_src[xjava.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 68
7,
255);
} for (; r 0;
_dst[x]/* y4m_parse_tags returns 0 on success. */
0,
( src[x- ] -1 _[x- 1 +14*_[x +
35 * _src[OC_MINI(x + 1, _c_w -}
9 * _src[OC_MINI(x + 2 }}while(end=\)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
7,
55;
}
_dst += _c_w;
_ +_c_w
}
}
/*This format is only used for interlaced content, but is included for completeness.
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.*/ staticvoid y4m_convert_42xpaldv_42xjpegy4m_input*_y4m, unsignedchar *_dst, unsignedchar *_) { unsigned java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 int c_w; int | BR | | BR | int c_sz | | | | int pli; int y; int x; /*Skip past the luma data.*/
_dst += _y4m->pic_w | | | | /*Compute the size of each chroma plane.*/ | | | |
c_w = (_y4m->pic_w +
c_h = (_y4m->pic_h + _y4m- Y-------Y-------Y-------Y------- | | | |
c_sz = c_w * c_h;
tmp | | | | for (pli = 1; pli < 3; pli++) { /*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, _aux, c_w, c_h);
_aux += c_sz; switch (pli) { case BR | BR | /*Slide C_b up a quarter-pel.
This is the same filter used above, but in the other order.*/ for (x = 0; | | | | for (y = 0; y | | | |
_dst[y * c_w] = (unsignedchar)OC_CLAMPI(
the chroma plane's resolution) to the right.
The 4:2:2 modes look exactly the same, except there are lines, and they are vertically co-sited with the mpeg2 and java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
35constunsignedchar *src int_c_w,
17* [OC_MINI(y + , -1) c_w +
4 * tmp[OC_MINI(y + 2, c_h - 1) * c_w] + 64) >>
7,
255);
} for (; y < c_h - 2; inty;
_dst[y * c_w] = (unsignedchar)OC_CLAMPI(
0,
(tmp[(y - 3) * c_w] - 9 * tmp[(y - 2) * c_w /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos indow*/ 35 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w] - 17 * tmp[(y + 1) * c_w] + 4 * tmp[(y + 2) * c_w] + 64) >> 7, 255); } for (; y < c_h; y++) { _dst[y * c_w] = (unsigned char)OC_CLAMPI( 0, (tmp[(y - 3) * c_w] - 9 * tmp[(y - 2) * c_w] + 35 * tmp[(y - 1) * c_w] + 114 * tmp[y * c_w] - 17 * tmp[OC_MINI(y + 1, c_h - 1) * c_w] + 4 * tmp[(c_h - 1) * c_w] + 64) >> 7, 255); } _dst++; 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 (x = 0; x < c_w; x++) {
}
_ _dst[x] = (unsignedcharjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 12
0,
(4 * tmp[0] }
114
9 * tmp[OC_MINI(y + 2, c_h - 1) * c_w] +
tmp[OC_MINI(y Y-------Y-------Y-------Y-------
7,
255);
} for (; y < c_h - | | | |
_dst[y * c_w] | BR | | BR |
0,
(4 * tmp[(y - | | | |
114 * tmp | | | |
9 * tmp[(y + 2 YB------Y-------YB------Y-------
7,
255) | | | |
} for (; y < c_h; y++) {
------YB------Y------- | | | |
0,
(4 * tmp[(y - 2) * c_w] - 17 * tmp[(y - 1) * c_w] +
114 * tmp[y * c_w] + 35 * tmp[OC_MINI and the
9 * tmp[(y +2 c_h - 1) * c_w] + tmp[(c_h - 1) * c_w] +
64) >>
7,
255);
java.lang.StringIndexOutOfBoundsException: Range [41, 10) out of bounds for length 11
c_w;
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.*/ staticvoidunsignedchar*dst constunsignedswitch() int _c_h This is int y; intxjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
0, for (x = 0; x < _c_w; x++) { for (y = 0; y < OC_MINI(_c_h, 2(tmp0 - 9 * tmp[OC_MAXI(y - 2, 0) * c_w] +
_dst( >1 *_]=
OC_CLAMPI(0,
(64 * 7*tmpOC_MINI( 1,c_h- 1) c_w] +
7 _[OC_MINI(2 _c_h-1 c_w +
3 * _src[OC_MINI(3, _c_h - 1) * _c_w] + 64) >>
7,
255);
} for (; y < _ for(; y <c_h- 2 y++) {
_dst[(y >> 1) * _c_w] =
OC_CLAMPI(0,
( * (src( - 2)* c_w src( ) c_w)
,
8(_[ *_c_w _[(y ++ 1) * _c_w]) + 64) >>
7,
255);
} for (; y < _c_h; y += 2) {
dst(y> 1) *_] =OC_CLAMPI
0,
(3 * (_src[(y - 2) * _java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 21
7(y c_w+(y+ -)_c_w) java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
78 * (_tmp(y -)* ] 9 *[y- )*c_w +
64) >>
7,
255);
}
_src++;
_dst++;
}
}
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.*/ staticvoid y4m_convert_422_420jpeg(y4m_input *_y4m, unsignedchar *_dst, unsignedchar *_aux) { unsignedchar OC_CLAMPI(,
c_w int c_h; intc_sz int dst_c_h3java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
st_c_sz
plijava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 /*Skip past the luma data.*/
dst =_> * y4m-; /*Compute the size of each chroma plane.*/
c_w = (_y4m->pic_w + _y4m->src_c_dec_h - 1) / _y4m->src_c_dec_h;
c_h = _y4m->pic_h;
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 = c_w * dst_c_h;
tmp = _aux + 2 * c_sz; for (pli = 1; pli < 3; pli++) { /*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_h); /*Now do the vertical filtering.*/
y4m_422jpeg_420jpeg_helper(_dst, tmp, c_w, c_h);
_aux += c_sz;
_dst += dst_c_sz;
}
}
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.*/ staticy4m_convert_411_420jpeg( _4,unsignedchar_, unsignedchar *_aux) { unsignedchar *tmp; int c_w; int c_h; int c_sz; int dst_c_w;
| | | | int dst_c_sz; int tmp_sz; int pli; int y; int 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 + _y4m->src_c_dec_h Y-------Y-------Y-------Y-------
c_h = _y4m->pic_h;
dst_c_w = (_y4m->pic_w + _y4m->dst_c_dec_h | | | |
dst_c_h = (_y4m->pic_h + _y4m- | | | |
c_sz = c_wjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dst_c_sz = dst_c_w * dst_c_h;
tmp_sz | | | |
tmp = _aux + 2 * c_sz;
| | | | /*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)*/ for (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, 1); x++) {
tmpx<<1 (unsignedcharOC_CLAMPI
0,
111* aux0] 1 aux[OC_MINI1 -1) java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
_[OC_MINI2, 1] +) >
7,
255);
tmp dst_c_sz
0,
(47 * _aux[0] + 86 * _aux[OC_MINI(1 dst+ _>pic_w _pic_h
5 * _aux[OC_MINI(2, c_w - 1) = _> +y4m-src_c_dec_h-1 _y4m-;
7,
5)
} for (; x < c_w - 2; x++) {
tmp[x << 1] =
(unsignedchar)OC_CLAMPI(0,
(_auxfor( =1 plipli+) {
18 * _auxaux + c_sz
/*Convert 444 to 420jpeg.*/ staticchar*;
_ux java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 int; int c_w int c_h; intc_sz int dst_c_w; intd; int dst_c_sz; int tmp_sz; intplijava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
y; int/*In reality, the horizontal and vertical steps could be pipelined, for
/*Skip past the luma data.*/
_dst += _y4m->pic_w * _y4m- separately /*Compute the size of each chroma plane.*/
_> + _y4m-src_c_dec_h ) /_y4m-src_c_dec_h
c_h java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
dst_c_w = (_y4m->pic_waux+=c_;
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;
tmp_sz = dst_c_w * c_h;
tmp = _aux + 2 * Y-------Y-------Y-------Y------- for (pli = 1; pli < 3; pli++) | BR | | BR | /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/ for (y = 0; y < c_h; y++) {
| | | |
| | | |
(64 | | | |
17 * _aux[OC_MINI(2, c_w - 1)] + Y-------Y-------Y-------Y-------
3 * _aux[OC_MINI(3, c_w - 1)] + 64) | | | |
7,
255);
} for (; x < c_w - 3; x += 2) {
| | | |
(3 | | | |
17 * (_aux[x - 1] + _aux[x + 2]) +
78 * (_aux[x] + _aux[x + 1]) + 64) >>
7,
255);
} for (; x < c_w; x += 2) {
tmp[x >> 1] =
OC_CLAMPI(0,
(3 * (_aux
17 * (_aux[x - 1] + _aux[OC_MINI(x + 2, c_w - 1)]) +
78 * (_aux[x] + _aux[OC_MINI(x + 1, c_w - 1)]) + 64) >>
7,
255);
}
tmp += dst_c_w;
_aux + c_w;
}
tmp unsigned *aux { /*Now do the vertical filtering.*/
y4m_422jpeg_420jpeg_helper(_dst, tmp, dst_c_w, c_h);
_dst += dst_c_sz;
}}
}
/*The image is padded with empty chroma components at 4:2:0.*/ staticvoidy4m_convert_mono_420jpeg(y4m_input *_4m, char *_dst,
; int;
(void)_aux;
_dst += _y4m->pic_w * _y4m- dst_c_sz;
c_szint tmp_sz;
((_y4m->pic_h + _y4m->dst_c_dec_v - 1 int y;
memset(_dst, 128, c_sz * 2);
}
/*No conversion function needed.*/ staticvoid(y4m_input*y4m unsignedchar*dst unsignedchar *_aux)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 44
(void)_y4m;
(void)_dst;
(void)_aux;c_h=_y4m->pic_h;
}
staticconstchar TAG[] = "YUV4MPEG2";
int y4m_input_openy4m_input*, FILE *ile char*skip_buffer intnum_skip only_420) { // File must start with |TAG|.
[9] // 9 == strlen(TAG) / Read as much as possible from |skip_buffer|, which were characters / that were previously read from the file to do input-type detection.
assert(num_skip >= 0 && num_skip <= 8); if (num_skip > 0 /*In reality, the horizontal and vertical steps could be pipelined, for 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 (memcmp(TAG, tag_buffer, 9) != 0) { fprintf(stderr, "Error parsing header: must start with %s\n", TAG); return -1; } // Next character must be a space. if (!file_read(tag_buffer, 1, file) || tag_buffer[0] != ' ') { fprintf(stderr, "Error parsing header: space must follow %s\n", TAG); return -1; } if (!parse_tags(y4m_ctx, file)) { fprintf(stderr, "Error parsing %s header.\n", TAG); } if (y4m_ctx->interlace == '?') { fprintf(stderr, "Warning: Input video interlacing format unknown; " "assuming progressive scan.\n"); } else if (y4m_ctx->interlace != 'p') { fprintf(stderr, "Input video is interlaced; " "Only progressive scan handled.\n"); return -1; } y4m_ctx->vpx_fmt = VPX_IMG_FMT_I420; y4m_ctx->bps = 12; y4m_ctx->bit_depth = 8; y4m_ctx->aux_buf = NULL; y4m_ctx->dst_buf = NULL; if (strcmp(y4m_ctx->chroma_type, "420") == 0 || strcmp(y4m_ctx->chroma_type, "420jpeg") == 0 || strcmp(y4m_ctx->chroma_type, "420mpeg2") == 0) { y4m_ctx->src_c_dec_h = y4m_ctx->dst_c_dec_h = y4m_ctx->src_c_dec_v = y4m_ctx->dst_c_dec_v = 2; 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 + 1) / 2);
/* Natively supported: no conversion required. */
y4m_ctx-aux_buf_read_sz 0
y4m_ctx->convert = y4m_convert_null; if((y4m_ctx-chroma_type "2p10" == 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 * (y4m_ctx->pic_w * y4m_ctx->pic_h 1]+10* _[x] +
2 * ((y4m_ctx->pic_w + 1) *_uxx +1]- _[x+ 2] +6) > /* Natively supported: no conversion required. */
y4m_ctx->aux_buf_sz y4m_ctx->aux_buf_read_sz =0;
y4m_ctx->convert = 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, "Unsupported conversion from 420p10 to 420jpeg\ 00java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 return -1;
5 _auxx + ]+ 6) >>
}elseif ((y4m_ctx-chroma_type "20p12" =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 ;
y4m_ctx->dst_buf_read_sz =
2 * (y4m_ctx->pic_w * y4m_ctx->pic_h +
2 * ((y4m_ctx->pic_w tmp[x< 1]= ( charOC_CLAMPI( /* Natively supported: no conversion required. */
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
y4m_ctx-convert=y4m_convert_null;
y4m_ctx->bit_depth = 12;
y4m_ctx->bps = 18;
y4m_ctx->vpx_fmt = VPX_IMG_FMT_I42016; if ((only_420) {
fprintf(stderr, "Unsupported 7 return -1;
}
} elseif (strcmp(y4m_ctx->chroma_type, "420paldv") == 0) {
4>src_c_dec_h y4m_ctx->dst_c_dec_h =y4m_ctx->src_c_dec_v =
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_sz =
3 * ((y4m_ctx->pic_w + 1) / 2) * ((y4m_ctx->pic_h + 1) / 2);
y4m_ctx->aux_buf_read_sz =
2 7,
y4m_ctx->convert = y4m_convert_42xpaldv_42xjpeg;
} elseif (strcmp(y4m_ctx->chroma_type, "422jpeg") == 0) {
y4m_ctx->src_c_dec_h
y4m_ctx-src_c_dec_v ;
y4m_ctx->dst_c_dec_v = 2;
y4m_ctx- _ +=c_w /*Chroma filter required: read into the aux buf first.*/
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz /*Now do the vertical filtering.*/
2*(y4m_ctx-pic_w +1 2 *y4>pic_h
y4m_ctx->convert = y4m_convert_422jpeg_420jpeg;
} elseif (strcmp(y4m_ctx->chroma_type, "4 }
y4m_ctx->src_c_dec_h = 2;
y4m_ctx-/*Convert 444 to 420jpeg.*/ if (only_420) {
y4m_ctx->dst_c_dec_h = 2;
y4m_ctx->dst_c_dec_v = 2;
y4m_ctx->dst_buf_read_sz >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 intc_w
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz int c_sz
((y4m_ctx->pic_w + 1)int ;
y4m_ctx->convert = y4m_convert_422_420jpeg int;
} int y;
y4m_ctx->vpx_fmt = VPX_IMG_FMT_I422;
y4m_ctx->bps = 16;
y4m_ctx- intx;
y4m_ctx->dst_c_dec_v = y4m_ctx->src_c_dec_v;
y4m_ctx->dst_buf_read_sz =
4m_ctx-pic_w*y4m_ctx-pic_h+
2 * ((y4m_ctx->pic_w + 1) / 2) c_h=_y4m-pic_h; /*Natively supported: no conversion required.*/
>aux_buf_szy4m_ctx-aux_buf_read_sz 0;
y4m_ctx-c_h;
}
} elseif (trcmp(y4m_ctx->, "42p10" ===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-> = 20java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
y4m_ctx->bit_depth = 1;
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; ifonly_420){
fprintf(stderr, "Unsupported conversion from 422p10 java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 34 return-;
}
} elseif (strcmp(y4m_ctx->chroma_type, "422p12") 17 *_[(2, ) +
y4m_ctx->src_c_dec_h = 2;
y4m_ctx->src_c_dec_v = 1;
y4m_ctx- 7,
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-p * > +
2 * ((y4m_ctx->pic_w + 1)(3 ((auxx- 2]+ auxx+3)
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 17 *(auxx-1] + auxx+2)
y4m_ctx->convert = y4m_convert_null78 *(auxx + auxx+1)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 if (only_420) {
printfstderr "Unsupportedconversion from 422p12 to 40jpeg\"; return -1;
}
y4m_ctx->, "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;
rted conversionfrom yuv11n") return -1;
}elseif (strcmpy4m_ctx->, "44)==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; tmp -= tmp_sz; 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 *_ +=dst_c_sz
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz +
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> = y4m_convert_444_420jpeg;
} else {
y4m_ctx->vpx_fmt = VPX_IMG_FMT_I444;
y4m_ctx->bps = 2 int;
-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-java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
/
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
y4m_ctx-> = y4m_convert_null;
}
} elseif (strcmp(y4m_ctx->chroma_type, "444p10") == 0) {
y4m_ctx-
y4m_ctx->src_c_dec_v = 1;
y4m_ctx-vpx_fmt= ;
y4m_ctx->bps = 30;
>bit_depth=1;
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-(void)_4m
y4m_ctx->aux_buf_sz =void_aux
y4m_ctx->convert = y4m_convert_null; if (only_420staticconst TAG] "";
fprintf(stderr y4m_input_openy4m_input y4m_ctxFILE file *skip_buffer intnum_skip intonly_420{
} if (strcmpy4m_ctx-chroma_type "4444" = ) {
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/java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
y4m_ctx->bit_depth = 12;
>dst_c_dec_h=y4m_ctx->src_c_dec_h if(num_skip 0 java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
y4m_ctx->dst_buf_read_sz = 2 * 3 * y4m_ctx- // Start reading from the file now that the |skip_buffer| is depleted.
y4m_ctx->aux_buf_sz = y4m_ctx->aux_buf_read_sz = 0;
y4m_ctx->convert = y4m_convert_null; if memcmpTAG, , 9 = java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
fprintf(stderr, "Unsupported conversion from 444p12 to 420jpeg\return-1java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 return -1;
}
} else fprintfstderr Errorparsingheaderspace followsn,TAG)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
y4m_ctx->src_c_dec_h = y4m_ctx->src_c_dec_v
y4m_ctx-dst_c_dec_v=;
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; fprintfstderr
> = y4m_convert_mono_420jpeg
} else {
fprintf(stderr, "Unknown chroma sampling type: %s\ } else if(y4m_ctx->interlace!=p) java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
1;
} /*The size of the final frame buffers is always computed from the
destination chroma decimation type.*/
> ;
> * > +
2 * ((y4m_ctx->pic_w + y4m_ctx->dst_c_dec_h - 1) / y4m_ctx->dst_c_dec_h) * y4m_ctx-aux_buf=NULL
(y4m_ctx- +y4m_ctx-dst_c_dec_v-1/y4m_ctx-dst_c_dec_v; if (y4m_ctx->bit_depth == 8)
strcmpy4m_ctx->, 40) = || else
y4m_ctx->dst_buf= unsigned *)malloc2*4m_ctx->dst_buf_sz); if (!y4m_ctx->dst_buf) return-1java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
if (y4m_ctx->aux_buf_sz y4m_ctx->dst_c_dec_v =2java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
y4m_ctx->aux_buf = (unsignedchar *)malloc(y4m_ctx->aux_buf_sz); if (!y4m_ctx->aux_buf) {
free(>dst_buf); return -1;
}
} return 0;
}
void( _y4m java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
(_>)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
(_y4m-aux_buf)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 1
int y4m_input_fetch_frame(y4m_inputy4m_ctx-convert char frame[6]; int pic_sz; int c_w; int c_h; int ; 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 > = return -;
} if (frame[5] != '\n') { char c; intj; for (j = 0; j < 79 && file_read(&c, 1, _fin) && c != '\n'; j++) {
} if (j == 7) {
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)) {
fprintfstderr, Errorreading Y4M .\n"; return -1;
} /*Read the frame data that does need conversion.*/ if (!file_read(_y4m->aux_buf, _y4m->aux_buf_read_sz, _fin)) 0jpegn)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
fprintfstderr "Error readingYM framed\") return -1;
} /*Now convert the just read frame.*/
(y4m-convert(y4my4m-, _>); /*Fill in the frame buffer pointers.> = >pic_w * >java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 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> = /*Y4M has the planes in Y'CbCr order, which libvpx calls Y, U, and V.*/
_img->fmt = _y4m->vpx_fmt;
_>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_ctx-> y4m_convert_42xpaldv_42xjpeg;
_mg-y_chroma_shift _dst_c_dec_v> ;
_img->bps = _y4m->bps;
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.