Go to the documentation of this file.
46 #define JP2_SIG_TYPE 0x6A502020
47 #define JP2_SIG_VALUE 0x0D0A870A
48 #define JP2_CODESTREAM 0x6A703263
49 #define JP2_HEADER 0x6A703268
143 if (
s->bit_index == 0) {
144 s->bit_index = 7 + (bytestream2_get_byte(&
s->g) != 0xFF
u);
147 res |= (bytestream2_peek_byte(&
s->g) >>
s->bit_index) & 1;
154 if (bytestream2_get_byte(&
s->g) == 0xff)
164 int sp = -1, curval = 0;
171 while (node && !node->
vis) {
179 curval = stack[
sp]->
val;
181 while (curval < threshold && sp >= 0) {
182 if (curval < stack[
sp]->
val)
183 curval = stack[
sp]->
val;
184 while (curval < threshold) {
194 stack[
sp]->
val = curval;
201 int bpc, uint32_t log2_chroma_wh,
int pal8)
208 if (
desc->nb_components != components) {
212 switch (components) {
214 match = match &&
desc->comp[3].depth >= bpc &&
215 (log2_chroma_wh >> 14 & 3) == 0 &&
216 (log2_chroma_wh >> 12 & 3) == 0;
218 match = match &&
desc->comp[2].depth >= bpc &&
219 (log2_chroma_wh >> 10 & 3) ==
desc->log2_chroma_w &&
220 (log2_chroma_wh >> 8 & 3) ==
desc->log2_chroma_h;
222 match = match &&
desc->comp[1].depth >= bpc &&
223 (log2_chroma_wh >> 6 & 3) ==
desc->log2_chroma_w &&
224 (log2_chroma_wh >> 4 & 3) ==
desc->log2_chroma_h;
227 match = match &&
desc->comp[0].depth >= bpc &&
228 (log2_chroma_wh >> 2 & 3) == 0 &&
229 (log2_chroma_wh & 3) == 0 &&
237 #define RGB_PIXEL_FORMATS AV_PIX_FMT_PAL8,AV_PIX_FMT_RGB24,AV_PIX_FMT_RGBA,AV_PIX_FMT_RGB48,AV_PIX_FMT_RGBA64
238 #define GRAY_PIXEL_FORMATS AV_PIX_FMT_GRAY8,AV_PIX_FMT_GRAY8A,AV_PIX_FMT_GRAY16,AV_PIX_FMT_YA16
239 #define YUV_PIXEL_FORMATS AV_PIX_FMT_YUV410P,AV_PIX_FMT_YUV411P,AV_PIX_FMT_YUVA420P, \
240 AV_PIX_FMT_YUV420P,AV_PIX_FMT_YUV422P,AV_PIX_FMT_YUVA422P, \
241 AV_PIX_FMT_YUV440P,AV_PIX_FMT_YUV444P,AV_PIX_FMT_YUVA444P, \
242 AV_PIX_FMT_YUV420P9,AV_PIX_FMT_YUV422P9,AV_PIX_FMT_YUV444P9, \
243 AV_PIX_FMT_YUVA420P9,AV_PIX_FMT_YUVA422P9,AV_PIX_FMT_YUVA444P9, \
244 AV_PIX_FMT_YUV420P10,AV_PIX_FMT_YUV422P10,AV_PIX_FMT_YUV444P10, \
245 AV_PIX_FMT_YUVA420P10,AV_PIX_FMT_YUVA422P10,AV_PIX_FMT_YUVA444P10, \
246 AV_PIX_FMT_YUV420P12,AV_PIX_FMT_YUV422P12,AV_PIX_FMT_YUV444P12, \
247 AV_PIX_FMT_YUV420P14,AV_PIX_FMT_YUV422P14,AV_PIX_FMT_YUV444P14, \
248 AV_PIX_FMT_YUV420P16,AV_PIX_FMT_YUV422P16,AV_PIX_FMT_YUV444P16, \
249 AV_PIX_FMT_YUVA420P16,AV_PIX_FMT_YUVA422P16,AV_PIX_FMT_YUVA444P16
250 #define XYZ_PIXEL_FORMATS AV_PIX_FMT_XYZ12
268 uint32_t log2_chroma_wh = 0;
270 int possible_fmts_nb = 0;
278 s->avctx->profile = bytestream2_get_be16u(&
s->g);
279 s->width = bytestream2_get_be32u(&
s->g);
280 s->height = bytestream2_get_be32u(&
s->g);
281 s->image_offset_x = bytestream2_get_be32u(&
s->g);
282 s->image_offset_y = bytestream2_get_be32u(&
s->g);
283 s->tile_width = bytestream2_get_be32u(&
s->g);
284 s->tile_height = bytestream2_get_be32u(&
s->g);
285 s->tile_offset_x = bytestream2_get_be32u(&
s->g);
286 s->tile_offset_y = bytestream2_get_be32u(&
s->g);
287 ncomponents = bytestream2_get_be16u(&
s->g);
289 if (
s->image_offset_x ||
s->image_offset_y) {
298 if (ncomponents <= 0) {
304 if (ncomponents > 4) {
310 if (
s->tile_offset_x < 0 ||
s->tile_offset_y < 0 ||
311 s->image_offset_x <
s->tile_offset_x ||
312 s->image_offset_y <
s->tile_offset_y ||
313 s->tile_width + (int64_t)
s->tile_offset_x <=
s->image_offset_x ||
314 s->tile_height + (int64_t)
s->tile_offset_y <=
s->image_offset_y
320 s->ncomponents = ncomponents;
322 if (
s->tile_width <= 0 ||
s->tile_height <= 0) {
324 s->tile_width,
s->tile_height);
329 av_log(
s->avctx,
AV_LOG_ERROR,
"Insufficient space for %d components in SIZ\n",
s->ncomponents);
333 for (
i = 0;
i <
s->ncomponents;
i++) {
334 uint8_t x = bytestream2_get_byteu(&
s->g);
335 s->cbps[
i] = (
x & 0x7f) + 1;
336 s->precision =
FFMAX(
s->cbps[
i],
s->precision);
337 s->sgnd[
i] = !!(
x & 0x80);
338 s->cdx[
i] = bytestream2_get_byteu(&
s->g);
339 s->cdy[
i] = bytestream2_get_byteu(&
s->g);
340 if ( !
s->cdx[
i] ||
s->cdx[
i] == 3 ||
s->cdx[
i] > 4
341 || !
s->cdy[
i] ||
s->cdy[
i] == 3 ||
s->cdy[
i] > 4) {
345 log2_chroma_wh |=
s->cdy[
i] >> 1 <<
i * 4 |
s->cdx[
i] >> 1 <<
i * 4 + 2;
352 if (
s->numXtiles * (uint64_t)
s->numYtiles > INT_MAX/
sizeof(*
s->tile) ||
355 s->numXtiles =
s->numYtiles = 0;
361 s->numXtiles =
s->numYtiles = 0;
365 for (
i = 0;
i <
s->numXtiles *
s->numYtiles;
i++) {
376 s->reduction_factor),
378 s->reduction_factor));
387 switch (
s->colour_space) {
407 && !
pix_fmt_match(
s->avctx->pix_fmt, ncomponents,
s->precision, log2_chroma_wh,
s->pal8))
410 for (
i = 0;
i < possible_fmts_nb; ++
i) {
411 if (
pix_fmt_match(possible_fmts[
i], ncomponents,
s->precision, log2_chroma_wh,
s->pal8)) {
412 s->avctx->pix_fmt = possible_fmts[
i];
417 if (
i == possible_fmts_nb) {
418 if (ncomponents == 4 &&
419 s->cdy[0] == 1 &&
s->cdx[0] == 1 &&
420 s->cdy[1] == 1 &&
s->cdx[1] == 1 &&
421 s->cdy[2] ==
s->cdy[3] &&
s->cdx[2] ==
s->cdx[3]) {
422 if (
s->precision == 8 &&
s->cdy[2] == 2 &&
s->cdx[2] == 2 && !
s->pal8) {
434 if (
i == possible_fmts_nb) {
436 "Unknown pix_fmt, profile: %d, colour_space: %d, "
437 "components: %d, precision: %d\n"
438 "cdx[0]: %d, cdy[0]: %d\n"
439 "cdx[1]: %d, cdy[1]: %d\n"
440 "cdx[2]: %d, cdy[2]: %d\n"
441 "cdx[3]: %d, cdy[3]: %d\n",
442 s->avctx->profile,
s->colour_space, ncomponents,
s->precision,
445 ncomponents > 1 ?
s->cdx[1] : 0,
446 ncomponents > 1 ?
s->cdy[1] : 0,
447 ncomponents > 2 ?
s->cdx[2] : 0,
448 ncomponents > 2 ?
s->cdy[2] : 0,
449 ncomponents > 3 ?
s->cdx[3] : 0,
450 ncomponents > 3 ?
s->cdy[3] : 0);
453 s->avctx->bits_per_raw_sample =
s->precision;
469 c->nreslevels = bytestream2_get_byteu(&
s->g) + 1;
475 if (
c->nreslevels <=
s->reduction_factor) {
480 av_log(
s->avctx,
AV_LOG_ERROR,
"reduction_factor too large for this bitstream, max is %d\n",
c->nreslevels - 1);
481 s->reduction_factor =
c->nreslevels - 1;
486 c->nreslevels2decode =
c->nreslevels -
s->reduction_factor;
488 c->log2_cblk_width = (bytestream2_get_byteu(&
s->g) & 15) + 2;
489 c->log2_cblk_height = (bytestream2_get_byteu(&
s->g) & 15) + 2;
491 if (
c->log2_cblk_width > 10 ||
c->log2_cblk_height > 10 ||
492 c->log2_cblk_width +
c->log2_cblk_height > 12) {
497 c->cblk_style = bytestream2_get_byteu(&
s->g);
498 if (
c->cblk_style != 0) {
503 c->transform = bytestream2_get_byteu(&
s->g);
513 for (
i = 0;
i <
c->nreslevels;
i++) {
514 byte = bytestream2_get_byte(&
s->g);
515 c->log2_prec_widths[
i] =
byte & 0x0F;
516 c->log2_prec_heights[
i] = (
byte >> 4) & 0x0F;
518 if (
c->log2_prec_widths[
i] == 0 ||
c->log2_prec_heights[
i] == 0) {
520 c->log2_prec_widths[
i],
c->log2_prec_heights[
i]);
521 c->log2_prec_widths[
i] =
c->log2_prec_heights[
i] = 1;
526 memset(
c->log2_prec_widths , 15,
sizeof(
c->log2_prec_widths ));
527 memset(
c->log2_prec_heights, 15,
sizeof(
c->log2_prec_heights));
544 tmp.csty = bytestream2_get_byteu(&
s->g);
547 tmp.prog_order = bytestream2_get_byteu(&
s->g);
549 tmp.nlayers = bytestream2_get_be16u(&
s->g);
550 tmp.mct = bytestream2_get_byteu(&
s->g);
552 if (
tmp.mct &&
s->ncomponents < 3) {
554 "MCT %"PRIu8
" with too few components (%d)\n",
555 tmp.mct,
s->ncomponents);
562 for (compno = 0; compno <
s->ncomponents; compno++)
563 if (!(properties[compno] &
HAD_COC))
564 memcpy(
c + compno, &
tmp,
sizeof(
tmp));
581 compno = bytestream2_get_byteu(&
s->g);
583 if (compno >=
s->ncomponents) {
585 "Invalid compno %d. There are %d components in the image.\n",
586 compno,
s->ncomponents);
592 c->csty = bytestream2_get_byteu(&
s->g);
605 compno = (
s->ncomponents < 257)? bytestream2_get_byte(&
s->g):
606 bytestream2_get_be16u(&
s->g);
607 if (bytestream2_get_byte(&
s->g)) {
614 if (compno < s->ncomponents) {
616 if (
s->curtileno == -1) {
617 v = bytestream2_get_byte(&
s->g);
620 s->roi_shift[compno] = v;
622 if (
s->tile[
s->curtileno].tp_idx != 0)
624 v = bytestream2_get_byte(&
s->g);
627 s->tile[
s->curtileno].comp[compno].roi_shift = v;
642 x = bytestream2_get_byteu(&
s->g);
652 for (
i = 0;
i < n;
i++)
653 q->
expn[
i] = bytestream2_get_byteu(&
s->g) >> 3;
657 x = bytestream2_get_be16u(&
s->g);
658 q->
expn[0] =
x >> 11;
659 q->
mant[0] =
x & 0x7ff;
661 int curexpn =
FFMAX(0, q->
expn[0] - (
i - 1) / 3);
662 q->
expn[
i] = curexpn;
670 for (
i = 0;
i < n;
i++) {
671 x = bytestream2_get_be16u(&
s->g);
686 memset(&
tmp, 0,
sizeof(
tmp));
690 for (compno = 0; compno <
s->ncomponents; compno++)
691 if (!(properties[compno] &
HAD_QCC))
692 memcpy(q + compno, &
tmp,
sizeof(
tmp));
706 compno = bytestream2_get_byteu(&
s->g);
708 if (compno >=
s->ncomponents) {
710 "Invalid compno %d. There are %d components in the image.\n",
711 compno,
s->ncomponents);
716 return get_qcx(
s, n - 1, q + compno);
722 int elem_size =
s->ncomponents <= 257 ? 7 : 9;
735 tmp.nb_poc = (
size - 2) / elem_size;
741 for (
i = 0;
i<
tmp.nb_poc;
i++) {
743 e->
RSpoc = bytestream2_get_byteu(&
s->g);
744 e->
CSpoc = bytestream2_get_byteu(&
s->g);
745 e->
LYEpoc = bytestream2_get_be16u(&
s->g);
746 e->
REpoc = bytestream2_get_byteu(&
s->g);
747 e->
CEpoc = bytestream2_get_byteu(&
s->g);
748 e->
Ppoc = bytestream2_get_byteu(&
s->g);
751 if (e->
CEpoc >
s->ncomponents)
752 e->
CEpoc =
s->ncomponents;
792 Isot = bytestream2_get_be16u(&
s->g);
793 if (Isot >=
s->numXtiles *
s->numYtiles)
797 Psot = bytestream2_get_be32u(&
s->g);
798 TPsot = bytestream2_get_byteu(&
s->g);
801 bytestream2_get_byteu(&
s->g);
816 s->tile[Isot].tp_idx = TPsot;
817 tp =
s->tile[Isot].tile_part + TPsot;
819 tp->
tp_end =
s->g.buffer + Psot - n - 2;
827 memcpy(&tile->
poc , &
s->poc ,
sizeof(tile->
poc));
836 if (
s->ncomponents*4 != n - 2) {
854 bytestream2_get_byte(&
s->g);
855 Stlm = bytestream2_get_byte(&
s->g);
858 ST = (Stlm >> 4) & 0x03;
864 SP = (Stlm >> 6) & 0x01;
865 tile_tlm = (n - 4) / ((
SP + 1) * 2 + ST);
866 for (
i = 0;
i < tile_tlm;
i++) {
871 bytestream2_get_byte(&
s->g);
874 bytestream2_get_be16(&
s->g);
877 bytestream2_get_be32(&
s->g);
881 bytestream2_get_be16(&
s->g);
883 bytestream2_get_be32(&
s->g);
900 bytestream2_get_byte(&
s->g);
902 for (
i = 0;
i < n - 3;
i++) {
903 v = bytestream2_get_byte(&
s->g);
920 if (
s->curtileno < 0)
923 tile = &
s->tile[
s->curtileno];
926 "PPT marker can occur only on first tile part of a tile.\n");
931 bytestream2_get_byte(&
s->g);
950 int tilex = tileno %
s->numXtiles;
951 int tiley = tileno /
s->numXtiles;
957 tile->
coord[0][0] = av_clip(tilex * (int64_t)
s->tile_width +
s->tile_offset_x,
s->image_offset_x,
s->width);
958 tile->
coord[0][1] = av_clip((tilex + 1) * (int64_t)
s->tile_width +
s->tile_offset_x,
s->image_offset_x,
s->width);
959 tile->
coord[1][0] = av_clip(tiley * (int64_t)
s->tile_height +
s->tile_offset_y,
s->image_offset_y,
s->height);
960 tile->
coord[1][1] = av_clip((tiley + 1) * (int64_t)
s->tile_height +
s->tile_offset_y,
s->image_offset_y,
s->height);
962 for (compno = 0; compno <
s->ncomponents; compno++) {
973 comp->coord_o[0][0] /=
s->cdx[compno];
974 comp->coord_o[0][1] /=
s->cdx[compno];
975 comp->coord_o[1][0] /=
s->cdy[compno];
976 comp->coord_o[1][1] /=
s->cdy[compno];
984 if (!
comp->roi_shift)
985 comp->roi_shift =
s->roi_shift[compno];
988 s->cbps[compno],
s->cdx[compno],
989 s->cdy[compno],
s->avctx))
1004 return num < 0 ? num : 3 + num;
1006 return num < 0 ? num : 6 + num;
1008 return num < 0 ? num : 37 + num;
1038 int layno,
uint8_t *expn,
int numgbits)
1040 int bandno, cblkno,
ret, nb_code_blocks;
1043 if (layno < rlevel->band[0].prec[precno].decoded_layers)
1058 for (bandno = 0; bandno < rlevel->
nbands; bandno++) {
1062 if (band->
coord[0][0] == band->
coord[0][1] ||
1067 for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
1069 int incl, newpasses, llen;
1082 int v = expn[bandno] + numgbits - 1 -
1084 if (v < 0 || v > 30) {
1086 "nonzerobits %d invalid or unsupported\n", v);
1102 "Block with length beyond 16 bits");
1121 while (newpasses1 < newpasses) {
1147 newpasses -= newpasses1;
1157 av_log(
s->avctx,
AV_LOG_ERROR,
"EPH marker not found. instead %X\n", bytestream2_peek_be32(&
s->g));
1165 for (bandno = 0; bandno < rlevel->
nbands; bandno++) {
1170 for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
1174 for (cwsno = 0; cwsno < cblk->
nb_lengthinc; cwsno ++) {
1187 "Block length %"PRIu16
" or lengthinc %d is too large, left %d\n",
1219 int RSpoc,
int CSpoc,
1220 int LYEpoc,
int REpoc,
int CEpoc,
1221 int Ppoc,
int *tp_index)
1224 int layno, reslevelno, compno, precno, ok_reslevel;
1232 for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) {
1234 for (layno = 0; layno < LYEpoc; layno++) {
1235 for (compno = CSpoc; compno < CEpoc; compno++) {
1238 if (reslevelno < codsty->nreslevels) {
1246 qntsty->
expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),
1257 for (layno = 0; layno < LYEpoc; layno++) {
1259 for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) {
1261 for (compno = CSpoc; compno < CEpoc; compno++) {
1264 if (reslevelno < codsty->nreslevels) {
1272 qntsty->
expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),
1283 for (compno = CSpoc; compno < CEpoc; compno++) {
1293 for (reslevelno = RSpoc; reslevelno <
FFMIN(codsty->
nreslevels, REpoc); reslevelno++) {
1299 if (step_x >= 31 || step_y >= 31){
1306 for (y = tile->
coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) {
1307 for (
x = tile->
coord[0][0]; x < tile->coord[0][1];
x = (
x/step_x + 1)*step_x) {
1308 for (reslevelno = RSpoc; reslevelno <
FFMIN(codsty->
nreslevels, REpoc); reslevelno++) {
1309 unsigned prcx, prcy;
1312 int xc =
x /
s->cdx[compno];
1313 int yc = y /
s->cdy[compno];
1335 for (layno = 0; layno < LYEpoc; layno++) {
1338 qntsty->
expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),
1351 for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) {
1355 for (compno = CSpoc; compno < CEpoc; compno++) {
1359 if (reslevelno < codsty->nreslevels) {
1369 for (y = tile->
coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) {
1370 for (
x = tile->
coord[0][0]; x < tile->coord[0][1];
x = (
x/step_x + 1)*step_x) {
1371 for (compno = CSpoc; compno < CEpoc; compno++) {
1377 unsigned prcx, prcy;
1379 int xc =
x /
s->cdx[compno];
1380 int yc = y /
s->cdy[compno];
1406 for (layno = 0; layno < LYEpoc; layno++) {
1410 qntsty->
expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),
1424 for (compno = CSpoc; compno < CEpoc; compno++) {
1428 for (reslevelno = RSpoc; reslevelno <
FFMIN(codsty->
nreslevels, REpoc); reslevelno++) {
1435 if (step_x >= 31 || step_y >= 31){
1442 for (y = tile->
coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) {
1443 for (
x = tile->
coord[0][0]; x < tile->coord[0][1];
x = (
x/step_x + 1)*step_x) {
1444 for (compno = CSpoc; compno < CEpoc; compno++) {
1448 int xc =
x /
s->cdx[compno];
1449 int yc = y /
s->cdy[compno];
1451 for (reslevelno = RSpoc; reslevelno <
FFMIN(codsty->
nreslevels, REpoc); reslevelno++) {
1452 unsigned prcx, prcy;
1476 for (layno = 0; layno < LYEpoc; layno++) {
1479 qntsty->
expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0),
1534 int bpno,
int bandno,
1535 int vert_causal_ctx_csty_symbol)
1537 int mask = 3 << (bpno - 1), y0,
x, y;
1539 for (y0 = 0; y0 <
height; y0 += 4)
1541 for (y = y0; y <
height && y < y0 + 4; y++) {
1542 int flags_mask = -1;
1543 if (vert_causal_ctx_csty_symbol && y == y0 + 3)
1556 t1->data[(y) *
t1->stride +
x] < 0);
1564 int bpno,
int vert_causal_ctx_csty_symbol)
1569 phalf = 1 << (bpno - 1);
1572 for (y0 = 0; y0 <
height; y0 += 4)
1574 for (y = y0; y <
height && y < y0 + 4; y++)
1576 int flags_mask = (vert_causal_ctx_csty_symbol && y == y0 + 3) ?
1580 t1->mqc.cx_states + ctxno)
1582 t1->data[(y) *
t1->stride +
x] +=
t1->data[(y) *
t1->stride +
x] < 0 ? -
r :
r;
1589 int seg_symbols,
int vert_causal_ctx_csty_symbol)
1591 int mask = 3 << (bpno - 1), y0,
x, y, runlen, dec;
1593 for (y0 = 0; y0 <
height; y0 += 4) {
1595 int flags_mask = -1;
1596 if (vert_causal_ctx_csty_symbol)
1616 for (y = y0 + runlen; y < y0 + 4 && y <
height; y++) {
1617 int flags_mask = -1;
1618 if (vert_causal_ctx_csty_symbol && y == y0 + 3)
1631 t1->mqc.cx_states + ctxno) ^
1649 "Segmentation symbol value incorrect\n");
1666 memset(
t1->data, 0,
t1->stride *
height *
sizeof(*
t1->data));
1672 memset(
t1->flags, 0,
t1->stride * (
height + 2) *
sizeof(*
t1->flags));
1679 if (bpno < 0 || bpno > 29) {
1686 vert_causal_ctx_csty_symbol);
1695 vert_causal_ctx_csty_symbol);
1723 if (cblk->
data + cblk->
length - 2*(term_cnt < cblk->nb_terminations) !=
t1->mqc.bp) {
1725 cblk->
data + cblk->
length - 2*(term_cnt < cblk->nb_terminations) -
t1->mqc.bp);
1736 roi_shift =
comp->roi_shift;
1737 val = (quan_parameter < 0)?-quan_parameter:quan_parameter;
1739 if (
val > (1 << roi_shift))
1740 return (quan_parameter < 0)?-(
val >> roi_shift):(
val >> roi_shift);
1741 return quan_parameter;
1757 for (j = 0; j < (cblk->
coord[1][1] - cblk->
coord[1][0]); ++j) {
1758 float *datap = &
comp->f_data[(
comp->coord[0][1] -
comp->coord[0][0]) * (y + j) +
x];
1759 int *
src =
t1->data + j*
t1->stride;
1760 for (
i = 0;
i <
w; ++
i)
1772 for (j = 0; j < (cblk->
coord[1][1] - cblk->
coord[1][0]); ++j) {
1774 int *
src =
t1->data + j*
t1->stride;
1776 for (
i = 0;
i <
w; ++
i)
1777 datap[
i] =
src[
i] / 2;
1780 for (
i = 0;
i <
w; ++
i)
1792 for (j = 0; j < (cblk->
coord[1][1] - cblk->
coord[1][0]); ++j) {
1794 int *
src =
t1->data + j*
t1->stride;
1795 for (
i = 0;
i <
w; ++
i)
1805 for (
i = 1;
i < 3;
i++) {
1816 for (
i = 0;
i < 3;
i++)
1822 for (
i = 0;
i < 2;
i++)
1834 for (j = 0; j < (cblk->
coord[1][1] - cblk->
coord[1][0]); ++j) {
1835 int *
src =
t1->data + j*
t1->stride;
1836 for (
i = 0;
i <
w; ++
i)
1845 int compno, reslevelno, bandno;
1848 for (compno = 0; compno <
s->ncomponents; compno++) {
1859 for (bandno = 0; bandno < rlevel->
nbands; bandno++) {
1860 int nb_precincts, precno;
1862 int cblkno = 0, bandpos;
1864 bandpos = bandno + (reslevelno > 0);
1866 if (band->
coord[0][0] == band->
coord[0][1] ||
1872 for (precno = 0; precno < nb_precincts; precno++) {
1884 bandpos,
comp->roi_shift);
1892 if (
comp->roi_shift)
1912 #define WRITE_FRAME(D, PIXEL) \
1913 static inline void write_frame_ ## D(Jpeg2000DecoderContext * s, Jpeg2000Tile * tile, \
1914 AVFrame * picture, int precision) \
1916 const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(s->avctx->pix_fmt); \
1917 int planar = !!(pixdesc->flags & AV_PIX_FMT_FLAG_PLANAR); \
1918 int pixelsize = planar ? 1 : pixdesc->nb_components; \
1923 for (compno = 0; compno < s->ncomponents; compno++) { \
1924 Jpeg2000Component *comp = tile->comp + compno; \
1925 Jpeg2000CodingStyle *codsty = tile->codsty + compno; \
1927 float *datap = comp->f_data; \
1928 int32_t *i_datap = comp->i_data; \
1929 int cbps = s->cbps[compno]; \
1930 int w = tile->comp[compno].coord[0][1] - s->image_offset_x; \
1934 plane = s->cdef[compno] ? s->cdef[compno]-1 : (s->ncomponents-1); \
1936 y = tile->comp[compno].coord[1][0] - s->image_offset_y / s->cdy[compno]; \
1937 line = (PIXEL *)picture->data[plane] + y * (picture->linesize[plane] / sizeof(PIXEL));\
1938 for (; y < tile->comp[compno].coord[1][1] - s->image_offset_y; y++) { \
1941 x = tile->comp[compno].coord[0][0] - s->image_offset_x / s->cdx[compno]; \
1942 dst = line + x * pixelsize + compno*!planar; \
1944 if (codsty->transform == FF_DWT97) { \
1945 for (; x < w; x++) { \
1946 int val = lrintf(*datap) + (1 << (cbps - 1)); \
1948 val = av_clip(val, 0, (1 << cbps) - 1); \
1949 *dst = val << (precision - cbps); \
1954 for (; x < w; x++) { \
1955 int val = *i_datap + (1 << (cbps - 1)); \
1957 val = av_clip(val, 0, (1 << cbps) - 1); \
1958 *dst = val << (precision - cbps); \
1963 line += picture->linesize[plane] / sizeof(PIXEL); \
1975 int jobnr,
int threadnr)
1988 for (
x = 0;
x <
s->ncomponents;
x++) {
1989 if (
s->cdef[
x] < 0) {
1990 for (
x = 0;
x <
s->ncomponents;
x++) {
1993 if ((
s->ncomponents & 1) == 0)
1994 s->cdef[
s->ncomponents-1] = 0;
1999 if (
s->precision <= 8) {
2000 write_frame_8(
s, tile, picture, 8);
2007 write_frame_16(
s, tile, picture, precision);
2016 for (tileno = 0; tileno <
s->numXtiles *
s->numYtiles; tileno++) {
2017 if (
s->tile[tileno].comp) {
2018 for (compno = 0; compno <
s->ncomponents; compno++) {
2025 av_freep(&
s->tile[tileno].packed_headers);
2026 s->tile[tileno].packed_headers_size = 0;
2030 memset(
s->codsty, 0,
sizeof(
s->codsty));
2031 memset(
s->qntsty, 0,
sizeof(
s->qntsty));
2032 memset(
s->properties, 0,
sizeof(
s->properties));
2033 memset(&
s->poc , 0,
sizeof(
s->poc));
2034 s->numXtiles =
s->numYtiles = 0;
2043 uint8_t *properties =
s->properties;
2055 marker = bytestream2_get_be16u(&
s->g);
2066 if (
s->curtileno < 0) {
2071 tile =
s->tile +
s->curtileno;
2073 if (tp->
tp_end <
s->g.buffer) {
2090 len = bytestream2_get_be16(&
s->g);
2102 if (
s->ncomponents) {
2108 s->numXtiles =
s->numYtiles = 0;
2131 codsty =
s->tile[
s->curtileno].codsty;
2132 qntsty =
s->tile[
s->curtileno].qntsty;
2133 poc = &
s->tile[
s->curtileno].poc;
2134 properties =
s->tile[
s->curtileno].properties;
2160 "unsupported marker 0x%.4"PRIX16
" at pos 0x%X\n",
2167 "error during processing marker segment %.4"PRIx16
"\n",
2181 for (tileno = 0; tileno <
s->numXtiles *
s->numYtiles; tileno++) {
2196 uint32_t atom_size, atom, atom_end;
2197 int search_range = 10;
2202 atom_size = bytestream2_get_be32u(&
s->g);
2203 atom = bytestream2_get_be32u(&
s->g);
2204 if (atom_size == 1) {
2205 if (bytestream2_get_be32u(&
s->g)) {
2209 atom_size = bytestream2_get_be32u(&
s->g);
2223 uint32_t atom2_size, atom2, atom2_end;
2225 atom2_size = bytestream2_get_be32u(&
s->g);
2226 atom2 = bytestream2_get_be32u(&
s->g);
2228 if (atom2_size < 8 || atom2_end > atom_end || atom2_end < atom2_size)
2233 }
else if (atom2 ==
MKBETAG(
'c',
'o',
'l',
'r') && atom2_size >= 7) {
2234 int method = bytestream2_get_byteu(&
s->g);
2237 s->colour_space = bytestream2_get_be32u(&
s->g);
2239 }
else if (atom2 ==
MKBETAG(
'p',
'c',
'l',
'r') && atom2_size >= 6) {
2240 int i,
size, colour_count, colour_channels, colour_depth[3];
2241 colour_count = bytestream2_get_be16u(&
s->g);
2242 colour_channels = bytestream2_get_byteu(&
s->g);
2244 colour_depth[0] = (bytestream2_get_byteu(&
s->g) & 0x7f) + 1;
2245 colour_depth[1] = (bytestream2_get_byteu(&
s->g) & 0x7f) + 1;
2246 colour_depth[2] = (bytestream2_get_byteu(&
s->g) & 0x7f) + 1;
2247 size = (colour_depth[0] + 7 >> 3) * colour_count +
2248 (colour_depth[1] + 7 >> 3) * colour_count +
2249 (colour_depth[2] + 7 >> 3) * colour_count;
2251 colour_channels != 3 ||
2252 colour_depth[0] > 16 ||
2253 colour_depth[1] > 16 ||
2254 colour_depth[2] > 16 ||
2255 atom2_size <
size) {
2261 for (
i = 0;
i < colour_count;
i++) {
2263 if (colour_depth[0] <= 8) {
2264 r = bytestream2_get_byteu(&
s->g) << 8 - colour_depth[0];
2265 r |=
r >> colour_depth[0];
2267 r = bytestream2_get_be16u(&
s->g) >> colour_depth[0] - 8;
2269 if (colour_depth[1] <= 8) {
2270 g = bytestream2_get_byteu(&
s->g) << 8 - colour_depth[1];
2271 g |=
g >> colour_depth[1];
2273 g = bytestream2_get_be16u(&
s->g) >> colour_depth[1] - 8;
2275 if (colour_depth[2] <= 8) {
2276 b = bytestream2_get_byteu(&
s->g) << 8 - colour_depth[2];
2277 b |=
b >> colour_depth[2];
2279 b = bytestream2_get_be16u(&
s->g) >> colour_depth[2] - 8;
2281 s->palette[
i] = 0xff
u << 24 |
r << 16 |
g << 8 |
b;
2283 }
else if (atom2 ==
MKBETAG(
'c',
'd',
'e',
'f') && atom2_size >= 2) {
2284 int n = bytestream2_get_be16u(&
s->g);
2286 int cn = bytestream2_get_be16(&
s->g);
2287 int av_unused typ = bytestream2_get_be16(&
s->g);
2288 int asoc = bytestream2_get_be16(&
s->g);
2289 if (cn < 4 && asoc < 4)
2292 }
else if (atom2 ==
MKBETAG(
'r',
'e',
's',
' ') && atom2_size >= 18) {
2293 int64_t vnum, vden, hnum, hden, vexp, hexp;
2296 resx = bytestream2_get_be32u(&
s->g);
2297 if (resx !=
MKBETAG(
'r',
'e',
's',
'c') && resx !=
MKBETAG(
'r',
'e',
's',
'd')) {
2301 vnum = bytestream2_get_be16u(&
s->g);
2302 vden = bytestream2_get_be16u(&
s->g);
2303 hnum = bytestream2_get_be16u(&
s->g);
2304 hden = bytestream2_get_be16u(&
s->g);
2305 vexp = bytestream2_get_byteu(&
s->g);
2306 hexp = bytestream2_get_byteu(&
s->g);
2307 if (!vnum || !vden || !hnum || !hden) {
2319 if ( INT64_MAX / (hnum * vden) > pow(10, hexp)
2320 && INT64_MAX / (vnum * hden) > pow(10, vexp))
2322 hnum * vden * pow(10, hexp),
2323 vnum * hden * pow(10, vexp),
2327 }
while (atom_end - atom2_end >= 8);
2365 memset(
s->cdef, -1,
sizeof(
s->cdef));
2374 (bytestream2_get_be32u(&
s->g) == 12) &&
2379 "Could not find Jpeg2000 codestream atom.\n");
2414 memcpy(picture->
data[1],
s->palette, 256 *
sizeof(uint32_t));
2415 if (
s->sar.num &&
s->sar.den)
2417 s->sar.num =
s->sar.den = 0;
2426 #define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
2427 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
2430 {
"lowres",
"Lower the decoding resolution by a power of two",
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
static const AVOption options[]
static av_cold int init(AVCodecContext *avctx)
int ff_dwt_decode(DWTContext *s, void *t)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
#define JPEG2000_MAX_RESLEVELS
#define u(width, name, range_min, range_max)
int ff_jpeg2000_init_component(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty, Jpeg2000QuantStyle *qntsty, int cbps, int dx, int dy, AVCodecContext *avctx)
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
static av_cold int end(AVCodecContext *avctx)
static int needs_termination(int style, int passno)
static void decode_refpass(Jpeg2000T1Context *t1, int width, int height, int bpno, int vert_causal_ctx_csty_symbol)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure describes decoded (raw) audio or video data.
#define YUV_PIXEL_FORMATS
Jpeg2000TgtNode * zerobits
#define JPEG2000_CSTY_PREC
static int getlblockinc(Jpeg2000DecoderContext *s)
const AVProfile ff_jpeg2000_profiles[]
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
struct Jpeg2000TgtNode * parent
static int jpeg2000_decode_tile(AVCodecContext *avctx, void *td, int jobnr, int threadnr)
static void select_stream(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int *tp_index)
static int ff_jpeg2000_getrefctxno(int flag)
static int getnpasses(Jpeg2000DecoderContext *s)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static void tile_codeblocks(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
void ff_mqc_initdec(MqcState *mqc, uint8_t *bp, int raw, int reset)
Initialize MQ-decoder.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in AVCodec caps_internal and use ff_thread_get_buffer() to allocate frames. The frames must then be freed with ff_thread_release_buffer(). Otherwise decode directly into the user-supplied frames. Call ff_thread_report_progress() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
static int get_poc(Jpeg2000DecoderContext *s, int size, Jpeg2000POC *p)
static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, int width, int height, int bandpos, uint8_t roi_shift)
int key_frame
1 -> keyframe, 0-> not
static void decode_sigpass(Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int vert_causal_ctx_csty_symbol)
static double val(void *priv, double ch)
static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int RSpoc, int CSpoc, int LYEpoc, int REpoc, int CEpoc, int Ppoc, int *tp_index)
#define AV_PIX_FMT_GRAY16
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s)
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
static const AVClass jpeg2000_class
static int read_crg(Jpeg2000DecoderContext *s, int n)
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_CODEC_PROPERTY_LOSSLESS
static int get_siz(Jpeg2000DecoderContext *s)
static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
static const uint16_t mask[17]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Jpeg2000CodingStyle codsty[4]
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
GetByteContext packed_headers_stream
static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
static int roi_shift_param(Jpeg2000Component *comp, int quan_parameter)
#define JPEG2000_PGOD_RPCL
av_cold void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVCodec ff_jpeg2000_decoder
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static enum AVPixelFormat pix_fmt
static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
#define JPEG2000_PGOD_CPRL
static enum AVPixelFormat gray_pix_fmts[]
Jpeg2000ResLevel * reslevel
#define JPEG2000_CBLK_BYPASS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static int init_tile(Jpeg2000DecoderContext *s, int tileno)
static int get_qcd(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define JPEG2000_T1_SIG_S
void av_cold ff_mqc_init_context_tables(void)
MQ-coder Initialize context tables (QE, NLPS, NMPS)
#define AV_PIX_FMT_RGBA64
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static av_cold int jpeg2000_decode_init(AVCodecContext *avctx)
#define PTRDIFF_SPECIFIER
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Rational number (pair of numerator and denominator).
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PICTURE_TYPE_I
Intra.
static int get_ppt(Jpeg2000DecoderContext *s, int n)
static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define JPEG2000_CBLK_RESET
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
#define JPEG2000_T1_SIG_NB
static av_always_inline int bytestream2_tell(GetByteContext *g)
static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node, int threshold)
#define JPEG2000_T1_SIG_SE
void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
#define JPEG2000_T1_SIG_SW
Jpeg2000CodingStyle codsty[4]
enum AVPictureType pict_type
Picture type of the frame.
Jpeg2000TgtNode * cblkincl
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_always_inline int bytestream2_size(GetByteContext *g)
Jpeg2000POCEntry poc[MAX_POCS]
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
static void roi_scale_cblk(Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1)
Jpeg2000QuantStyle qntsty[4]
#define MKBETAG(a, b, c, d)
static enum AVPixelFormat xyz_pix_fmts[]
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
static int get_rgn(Jpeg2000DecoderContext *s, int n)
static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int *tp_index, Jpeg2000CodingStyle *codsty, Jpeg2000ResLevel *rlevel, int precno, int layno, uint8_t *expn, int numgbits)
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, uint8_t *properties)
static int ff_jpeg2000_getsgnctxno(int flag, int *xorbit)
static enum AVPixelFormat all_pix_fmts[]
#define JPEG2000_PGOD_LRCP
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static int pix_fmt_match(enum AVPixelFormat pix_fmt, int components, int bpc, uint32_t log2_chroma_wh, int pal8)
#define JPEG2000_PGOD_RLCP
#define i(width, name, range_min, range_max)
static int get_plt(Jpeg2000DecoderContext *s, int n)
static int jp2_find_codestream(Jpeg2000DecoderContext *s)
static av_cold void jpeg2000_init_static_data(void)
uint8_t expn[JPEG2000_MAX_DECLEVELS *3]
static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, uint8_t *properties)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define JPEG2000_SOP_FIXED_BYTES
#define FF_PROFILE_JPEG2000_DCINEMA_4K
#define WRITE_FRAME(D, PIXEL)
const char * name
Name of the codec implementation.
static int ff_jpeg2000_getsigctxno(int flag, int bandno)
static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band)
#define JPEG2000_MAX_PASSES
#define GRAY_PIXEL_FORMATS
uint16_t mant[JPEG2000_MAX_DECLEVELS *3]
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
#define FF_ARRAY_ELEMS(a)
main external API structure.
static int ff_jpeg2000_ceildiv(int a, int b)
#define JPEG2000_CBLK_VSC
static int ff_jpeg2000_ceildivpow2(int a, int b)
static void jpeg2000_flush(Jpeg2000DecoderContext *s)
#define RGB_PIXEL_FORMATS
void av_cold ff_jpeg2000_init_tier1_luts(void)
static const AVProfile profiles[]
#define JPEG2000_T1_SGN_S
#define JPEG2000_CSTY_EPH
#define XYZ_PIXEL_FORMATS
Jpeg2000TilePart tile_part[32]
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
#define JPEG2000_PGOD_PCRL
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define JPEG2000_MAX_DECLEVELS
int ff_mqc_decode(MqcState *mqc, uint8_t *cxstate)
MQ decoder.
#define avpriv_request_sample(...)
static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int get_sot(Jpeg2000DecoderContext *s, int n)
static enum AVPixelFormat yuv_pix_fmts[]
This structure stores compressed data.
static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols, int vert_causal_ctx_csty_symbol)
void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, int x, int y, int negative)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static uint64_t SP[8][256]
#define JPEG2000_SOP_BYTE_LENGTH
static enum AVPixelFormat rgb_pix_fmts[]
#define FF_PROFILE_JPEG2000_DCINEMA_2K
static int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q)
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Jpeg2000QuantStyle qntsty[4]
static int get_tlm(Jpeg2000DecoderContext *s, int n)
static void dequantization_float(int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band)
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
void ff_mqc_init_contexts(MqcState *mqc)
MQ-coder context initialisations.
static int get_bits(Jpeg2000DecoderContext *s, int n)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
#define JPEG2000_CBLK_SEGSYM
static void dequantization_int_97(int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band)