History

avcodec/mjpegdec: avoid indirection when accessing avctx

Marton Balint committed 2 years ago

Commit 059ea1d1 parent e6b9bfa1 file · +19 −19Browse files

Unified · Split

libavcodec/mjpegdec.c+19−19
@@ -2422,7 +2422,7 @@ redo_for_pal8: · 2421 unmodified lines
2422 }2422 }
2423 2423
2424 s->start_code = start_code;2424 s->start_code = start_code;
2425 if (s->avctx->debug & FF_DEBUG_STARTCODE)2425 if (avctx->debug & FF_DEBUG_STARTCODE)
2426 av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);2426 av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
2427 2427
2428 /* process markers */2428 /* process markers */
@@ -2486,9 +2486,9 @@ redo_for_pal8: · 57 unmodified lines
2486 case SOF0:2486 case SOF0:
2487 case SOF1:2487 case SOF1:
2488 if (start_code == SOF0)2488 if (start_code == SOF0)
2489 s->avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT;2489 avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT;
2490 else2490 else
2491 s->avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT;2491 avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT;
2492 s->lossless = 0;2492 s->lossless = 0;
2493 s->ls = 0;2493 s->ls = 0;
2494 s->progressive = 0;2494 s->progressive = 0;
@@ -2496,7 +2496,7 @@ redo_for_pal8: · 1 unmodified line
2496 goto fail;2496 goto fail;
2497 break;2497 break;
2498 case SOF2:2498 case SOF2:
2499 s->avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT;2499 avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT;
2500 s->lossless = 0;2500 s->lossless = 0;
2501 s->ls = 0;2501 s->ls = 0;
2502 s->progressive = 1;2502 s->progressive = 1;
@@ -2504,8 +2504,8 @@ redo_for_pal8: · 1 unmodified line
2504 goto fail;2504 goto fail;
2505 break;2505 break;
2506 case SOF3:2506 case SOF3:
2507 s->avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS;2507 avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS;
2508 s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;2508 avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
2509 s->lossless = 1;2509 s->lossless = 1;
2510 s->ls = 0;2510 s->ls = 0;
2511 s->progressive = 0;2511 s->progressive = 0;
@@ -2513,8 +2513,8 @@ redo_for_pal8: · 1 unmodified line
2513 goto fail;2513 goto fail;
2514 break;2514 break;
2515 case SOF48:2515 case SOF48:
2516 s->avctx->profile = AV_PROFILE_MJPEG_JPEG_LS;2516 avctx->profile = AV_PROFILE_MJPEG_JPEG_LS;
2517 s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;2517 avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
2518 s->lossless = 1;2518 s->lossless = 1;
2519 s->ls = 1;2519 s->ls = 1;
2520 s->progressive = 0;2520 s->progressive = 0;
@@ -2549,8 +2549,8 @@ eoi_parser: · 28 unmodified lines
2549 s->got_picture = 0;2549 s->got_picture = 0;
2550 goto the_end_no_picture;2550 goto the_end_no_picture;
2551 }2551 }
2552 if (s->avctx->hwaccel) {2552 if (avctx->hwaccel) {
2553 ret = FF_HW_SIMPLE_CALL(s->avctx, end_frame);2553 ret = FF_HW_SIMPLE_CALL(avctx, end_frame);
2554 if (ret < 0)2554 if (ret < 0)
2555 return ret;2555 return ret;
2556 2556
@@ -2621,7 +2621,7 @@ fail: · 64 unmodified lines
2621 return ret;2621 return ret;
2622the_end:2622the_end:
2623 2623
2624 is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step > 1;2624 is16bit = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].step > 1;
2625 2625
2626 if (AV_RB32(s->upscale_h)) {2626 if (AV_RB32(s->upscale_h)) {
2627 int p;2627 int p;
@@ -2640,7 +2640,7 @@ the_end: · 12 unmodified lines
2640 avctx->pix_fmt == AV_PIX_FMT_GBRP ||2640 avctx->pix_fmt == AV_PIX_FMT_GBRP ||
2641 avctx->pix_fmt == AV_PIX_FMT_GBRAP2641 avctx->pix_fmt == AV_PIX_FMT_GBRAP
2642 );2642 );
2643 ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);2643 ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &hshift, &vshift);
2644 if (ret)2644 if (ret)
2645 return ret;2645 return ret;
2646 2646
@@ -2720,7 +2720,7 @@ the_end: · 73 unmodified lines
2720 avctx->pix_fmt == AV_PIX_FMT_GBRP ||2720 avctx->pix_fmt == AV_PIX_FMT_GBRP ||
2721 avctx->pix_fmt == AV_PIX_FMT_GBRAP2721 avctx->pix_fmt == AV_PIX_FMT_GBRAP
2722 );2722 );
2723 ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);2723 ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &hshift, &vshift);
2724 if (ret)2724 if (ret)
2725 return ret;2725 return ret;
2726 2726
@@ -2750,7 +2750,7 @@ the_end: · 23 unmodified lines
2750 }2750 }
2751 }2751 }
2752 if (s->flipped && !s->rgb) {2752 if (s->flipped && !s->rgb) {
2753 ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);2753 ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &hshift, &vshift);
2754 if (ret)2754 if (ret)
2755 return ret;2755 return ret;
2756 2756
@@ -2766,7 +2766,7 @@ the_end: · 9 unmodified lines
2766 }2766 }
2767 }2767 }
2768 2768
2769 if (s->avctx->pix_fmt == AV_PIX_FMT_GBRP) {2769 if (avctx->pix_fmt == AV_PIX_FMT_GBRP) {
2770 av_assert0(s->nb_components == 3);2770 av_assert0(s->nb_components == 3);
2771 FFSWAP(uint8_t *, frame->data[0], frame->data[2]);2771 FFSWAP(uint8_t *, frame->data[0], frame->data[2]);
2772 FFSWAP(uint8_t *, frame->data[0], frame->data[1]);2772 FFSWAP(uint8_t *, frame->data[0], frame->data[1]);
@@ -2774,7 +2774,7 @@ the_end: · 1 unmodified line
2774 FFSWAP(int, frame->linesize[0], frame->linesize[1]);2774 FFSWAP(int, frame->linesize[0], frame->linesize[1]);
2775 }2775 }
2776 2776
2777 if (s->adobe_transform == 0 && s->avctx->pix_fmt == AV_PIX_FMT_GBRAP) {2777 if (s->adobe_transform == 0 && avctx->pix_fmt == AV_PIX_FMT_GBRAP) {
2778 int w = s->picture_ptr->width;2778 int w = s->picture_ptr->width;
2779 int h = s->picture_ptr->height;2779 int h = s->picture_ptr->height;
2780 av_assert0(s->nb_components == 4);2780 av_assert0(s->nb_components == 4);
@@ -2797,7 +2797,7 @@ the_end: · 16 unmodified lines
2797 memset(dst[3], 255, w);2797 memset(dst[3], 255, w);
2798 }2798 }
2799 }2799 }
2800 if (s->adobe_transform == 2 && s->avctx->pix_fmt == AV_PIX_FMT_YUVA444P) {2800 if (s->adobe_transform == 2 && avctx->pix_fmt == AV_PIX_FMT_YUVA444P) {
2801 int w = s->picture_ptr->width;2801 int w = s->picture_ptr->width;
2802 int h = s->picture_ptr->height;2802 int h = s->picture_ptr->height;
2803 av_assert0(s->nb_components == 4);2803 av_assert0(s->nb_components == 4);
@@ -2842,7 +2842,7 @@ the_end: · 38 unmodified lines
2842 2842
2843 sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, total_size);2843 sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, total_size);
2844 if (!sd) {2844 if (!sd) {
2845 av_log(s->avctx, AV_LOG_ERROR, "Could not allocate frame side data\n");2845 av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side data\n");
2846 return AVERROR(ENOMEM);2846 return AVERROR(ENOMEM);
2847 }2847 }
2848 2848
@@ -2865,7 +2865,7 @@ the_end: · 16 unmodified lines
2865 2865
2866 sd = av_frame_new_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9);2866 sd = av_frame_new_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9);
2867 if (!sd) {2867 if (!sd) {
2868 av_log(s->avctx, AV_LOG_ERROR, "Could not allocate frame side data\n");2868 av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side data\n");
2869 return AVERROR(ENOMEM);2869 return AVERROR(ENOMEM);
2870 }2870 }
2871 2871

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t