diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2022-03-02 18:03:01 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2022-03-02 18:03:01 +0300 |
commit | a41c2a513761e8884e92526b069ff6eed8168676 (patch) | |
tree | e624093127815a09d2807dccddaabea35510e154 /source/blender/imbuf | |
parent | a23b4429915ca8597510b57353c4df331487c620 (diff) | |
parent | c23ec04b4e30f300a670f1cb1dc882e0608d09ad (diff) |
Merge branch 'master' into temp-image-buffer-rasterizertemp-image-buffer-rasterizer
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/IMB_imbuf.h | 15 | ||||
-rw-r--r-- | source/blender/imbuf/intern/IMB_anim.h | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 145 | ||||
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 83 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 15 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 84 | ||||
-rw-r--r-- | source/blender/imbuf/intern/util.c | 2 |
7 files changed, 210 insertions, 136 deletions
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 23b9c85bd5b..8929a467670 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -560,6 +560,9 @@ bool IMB_alpha_affects_rgb(const struct ImBuf *ibuf); * Create char buffer, color corrected if necessary, for ImBufs that lack one. */ void IMB_rect_from_float(struct ImBuf *ibuf); +void IMB_float_from_rect_ex(struct ImBuf *dst, + const struct ImBuf *src, + const struct rcti *region_to_update); void IMB_float_from_rect(struct ImBuf *ibuf); /** * No profile conversion. @@ -897,16 +900,16 @@ typedef enum eIMBTransformMode { /** * \brief Transform source image buffer onto destination image buffer using a transform matrix. * - * \param src Image buffer to read from. - * \param dst Image buffer to write to. rect or rect_float must already be initialized. + * \param src: Image buffer to read from. + * \param dst: Image buffer to write to. rect or rect_float must already be initialized. * - dst buffer must be a 4 channel buffers. * - Only one data type buffer will be used (rect_float has priority over rect) - * \param mode Cropping/Wrap repeat effect to apply during transformation. - * \param filter Interpolation to use during sampling. - * \param transform_matrix Transformation matrix to use. + * \param mode: Cropping/Wrap repeat effect to apply during transformation. + * \param filter: Interpolation to use during sampling. + * \param transform_matrix: Transformation matrix to use. * The given matrix should transform between dst pixel space to src pixel space. * One unit is one pixel. - * \param src_crop cropping region how to crop the source buffer. Should only be passed when mode + * \param src_crop: Cropping region how to crop the source buffer. Should only be passed when mode * is set to #IMB_TRANSFORM_MODE_CROP_SRC. For any other mode this should be empty. * * During transformation no data/color conversion will happens. diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index bad2081448f..e99572adbb0 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -108,7 +108,7 @@ struct anim { #ifdef WITH_FFMPEG AVFormatContext *pFormatCtx; AVCodecContext *pCodecCtx; - AVCodec *pCodec; + const AVCodec *pCodec; AVFrame *pFrame; int pFrameComplete; AVFrame *pFrameRGB; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 4125662d35f..f97a50ecf47 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -492,7 +492,7 @@ static int startffmpeg(struct anim *anim) { int i, video_stream_index; - AVCodec *pCodec; + const AVCodec *pCodec; AVFormatContext *pFormatCtx = NULL; AVCodecContext *pCodecCtx; AVRational frame_rate; @@ -867,6 +867,17 @@ static void ffmpeg_decode_store_frame_pts(struct anim *anim) (int64_t)anim->cur_pts); } +static int ffmpeg_read_video_frame(struct anim *anim, AVPacket *packet) +{ + int ret = 0; + while (ret = av_read_frame(anim->pFormatCtx, packet) >= 0) { + if (packet->stream_index == anim->videoStream) { + break; + } + } + return ret; +} + /* decode one video frame also considering the packet read into cur_packet */ static int ffmpeg_decode_video_frame(struct anim *anim) { @@ -887,7 +898,7 @@ static int ffmpeg_decode_video_frame(struct anim *anim) anim->cur_packet->stream_index = -1; } - while ((rval = av_read_frame(anim->pFormatCtx, anim->cur_packet)) >= 0) { + while ((rval = ffmpeg_read_video_frame(anim, anim->cur_packet)) >= 0) { av_log(anim->pFormatCtx, AV_LOG_DEBUG, "%sREAD: strID=%d (VID: %d) dts=%" PRId64 " pts=%" PRId64 " %s\n", @@ -897,14 +908,13 @@ static int ffmpeg_decode_video_frame(struct anim *anim) (anim->cur_packet->dts == AV_NOPTS_VALUE) ? -1 : (int64_t)anim->cur_packet->dts, (anim->cur_packet->pts == AV_NOPTS_VALUE) ? -1 : (int64_t)anim->cur_packet->pts, (anim->cur_packet->flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); - if (anim->cur_packet->stream_index == anim->videoStream) { - avcodec_send_packet(anim->pCodecCtx, anim->cur_packet); - anim->pFrameComplete = avcodec_receive_frame(anim->pCodecCtx, anim->pFrame) == 0; - if (anim->pFrameComplete) { - ffmpeg_decode_store_frame_pts(anim); - break; - } + avcodec_send_packet(anim->pCodecCtx, anim->cur_packet); + anim->pFrameComplete = avcodec_receive_frame(anim->pCodecCtx, anim->pFrame) == 0; + + if (anim->pFrameComplete) { + ffmpeg_decode_store_frame_pts(anim); + break; } av_packet_unref(anim->cur_packet); anim->cur_packet->stream_index = -1; @@ -1159,13 +1169,59 @@ static int ffmpeg_generic_seek_workaround(struct anim *anim, return av_seek_frame(anim->pFormatCtx, anim->videoStream, current_pts, AVSEEK_FLAG_BACKWARD); } +/* Read packet until timestamp matches `anim->cur_packet`, thus recovering internal `anim` stream + * position state. */ +static void ffmpeg_seek_recover_stream_position(struct anim *anim) +{ + AVPacket *temp_packet = av_packet_alloc(); + while (ffmpeg_read_video_frame(anim, temp_packet)) { + int64_t current_pts = timestamp_from_pts_or_dts(anim->cur_packet->pts, anim->cur_packet->dts); + int64_t temp_pts = timestamp_from_pts_or_dts(temp_packet->pts, temp_packet->dts); + av_packet_unref(temp_packet); + + if (current_pts == temp_pts) { + break; + } + } + av_packet_free(&temp_packet); +} + +/* Check if seeking and mainly flushing codec buffers is needed. */ +static bool ffmpeg_seek_buffers_need_flushing(struct anim *anim, int position, int64_t seek_pos) +{ + /* Get timestamp of packet read after seeking. */ + AVPacket *temp_packet = av_packet_alloc(); + ffmpeg_read_video_frame(anim, temp_packet); + int64_t gop_pts = timestamp_from_pts_or_dts(temp_packet->pts, temp_packet->dts); + av_packet_unref(temp_packet); + av_packet_free(&temp_packet); + + /* Seeking gives packet, that is currently read. No seeking was necessary, so buffers don't have + * to be flushed. */ + if (gop_pts == timestamp_from_pts_or_dts(anim->cur_packet->pts, anim->cur_packet->dts)) { + return false; + } + + /* Packet after seeking is same key frame as current, and further in time. No seeking was + * necessary, so buffers don't have to be flushed. But stream position has to be recovered. */ + if (gop_pts == anim->cur_key_frame_pts && position > anim->cur_position) { + ffmpeg_seek_recover_stream_position(anim); + return false; + } + + /* Seeking was necessary, but we have read packets. Therefore we must seek again. */ + av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, AVSEEK_FLAG_BACKWARD); + anim->cur_key_frame_pts = gop_pts; + return true; +} + /* Seek to last necessary key frame. */ static int ffmpeg_seek_to_key_frame(struct anim *anim, int position, struct anim_index *tc_index, int64_t pts_to_search) { - int64_t pos; + int64_t seek_pos; int ret; if (tc_index) { @@ -1180,23 +1236,23 @@ static int ffmpeg_seek_to_key_frame(struct anim *anim, uint64_t pts; uint64_t dts; - pos = IMB_indexer_get_seek_pos(tc_index, new_frame_index); + seek_pos = IMB_indexer_get_seek_pos(tc_index, new_frame_index); pts = IMB_indexer_get_seek_pos_pts(tc_index, new_frame_index); dts = IMB_indexer_get_seek_pos_dts(tc_index, new_frame_index); anim->cur_key_frame_pts = timestamp_from_pts_or_dts(pts, dts); - av_log(anim->pFormatCtx, AV_LOG_DEBUG, "TC INDEX seek pos = %" PRId64 "\n", pos); + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "TC INDEX seek seek_pos = %" PRId64 "\n", seek_pos); av_log(anim->pFormatCtx, AV_LOG_DEBUG, "TC INDEX seek pts = %" PRIu64 "\n", pts); av_log(anim->pFormatCtx, AV_LOG_DEBUG, "TC INDEX seek dts = %" PRIu64 "\n", dts); if (ffmpeg_seek_by_byte(anim->pFormatCtx)) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, "... using BYTE pos\n"); + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "... using BYTE seek_pos\n"); - ret = av_seek_frame(anim->pFormatCtx, -1, pos, AVSEEK_FLAG_BYTE); + ret = av_seek_frame(anim->pFormatCtx, -1, seek_pos, AVSEEK_FLAG_BYTE); } else { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, "... using PTS pos\n"); + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "... using PTS seek_pos\n"); ret = av_seek_frame( anim->pFormatCtx, anim->videoStream, anim->cur_key_frame_pts, AVSEEK_FLAG_BACKWARD); } @@ -1204,58 +1260,25 @@ static int ffmpeg_seek_to_key_frame(struct anim *anim, else { /* We have to manually seek with ffmpeg to get to the key frame we want to start decoding from. */ - pos = ffmpeg_get_seek_pts(anim, pts_to_search); - av_log(anim->pFormatCtx, AV_LOG_DEBUG, "NO INDEX final seek pos = %" PRId64 "\n", pos); + seek_pos = ffmpeg_get_seek_pts(anim, pts_to_search); + av_log( + anim->pFormatCtx, AV_LOG_DEBUG, "NO INDEX final seek seek_pos = %" PRId64 "\n", seek_pos); AVFormatContext *format_ctx = anim->pFormatCtx; if (format_ctx->iformat->read_seek2 || format_ctx->iformat->read_seek) { - ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, pos, AVSEEK_FLAG_BACKWARD); + ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, AVSEEK_FLAG_BACKWARD); } else { - ret = ffmpeg_generic_seek_workaround(anim, &pos, pts_to_search); - av_log(anim->pFormatCtx, AV_LOG_DEBUG, "Adjusted final seek pos = %" PRId64 "\n", pos); + ret = ffmpeg_generic_seek_workaround(anim, &seek_pos, pts_to_search); + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + "Adjusted final seek seek_pos = %" PRId64 "\n", + seek_pos); } - if (ret >= 0) { - /* Double check if we need to seek and decode all packets. */ - AVPacket *current_gop_start_packet = av_packet_alloc(); - while (av_read_frame(anim->pFormatCtx, current_gop_start_packet) >= 0) { - if (current_gop_start_packet->stream_index == anim->videoStream) { - break; - } - av_packet_unref(current_gop_start_packet); - } - int64_t gop_pts = timestamp_from_pts_or_dts(current_gop_start_packet->pts, - current_gop_start_packet->dts); - - av_packet_free(¤t_gop_start_packet); - bool same_gop = gop_pts == anim->cur_key_frame_pts; - - if (same_gop && position > anim->cur_position) { - /* Change back to our old frame position so we can simply continue decoding from there. */ - int64_t cur_pts = timestamp_from_pts_or_dts(anim->cur_packet->pts, anim->cur_packet->dts); - - if (cur_pts == gop_pts) { - /* We are already at the correct position. */ - return 0; - } - AVPacket *temp = av_packet_alloc(); - - while (av_read_frame(anim->pFormatCtx, temp) >= 0) { - int64_t temp_pts = timestamp_from_pts_or_dts(temp->pts, temp->dts); - if (temp->stream_index == anim->videoStream && temp_pts == cur_pts) { - break; - } - av_packet_unref(temp); - } - av_packet_free(&temp); - return 0; - } - - anim->cur_key_frame_pts = gop_pts; - /* Seek back so we are at the correct position after we decoded a frame. */ - av_seek_frame(anim->pFormatCtx, anim->videoStream, pos, AVSEEK_FLAG_BACKWARD); + if (ret <= 0 && !ffmpeg_seek_buffers_need_flushing(anim, position, seek_pos)) { + return 0; } } @@ -1265,7 +1288,7 @@ static int ffmpeg_seek_to_key_frame(struct anim *anim, "FETCH: " "error while seeking to DTS = %" PRId64 " (frameno = %d, PTS = %" PRId64 "): errcode = %d\n", - pos, + seek_pos, position, pts_to_search, ret); @@ -1290,7 +1313,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ return NULL; } - av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position); + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: seek_pos=%d\n", position); struct anim_index *tc_index = IMB_anim_open_index(anim, tc); int64_t pts_to_search = ffmpeg_get_pts_to_search(anim, tc_index, position); diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 0bf50937674..588c92d748d 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -6,6 +6,7 @@ */ #include "BLI_math.h" +#include "BLI_rect.h" #include "BLI_utildefines.h" #include "IMB_filter.h" @@ -752,6 +753,61 @@ void IMB_rect_from_float(ImBuf *ibuf) ibuf->userflags &= ~IB_RECT_INVALID; } +void IMB_float_from_rect_ex(struct ImBuf *dst, + const struct ImBuf *src, + const rcti *region_to_update) +{ + BLI_assert_msg(dst->rect_float != NULL, + "Destination buffer should have a float buffer assigned."); + BLI_assert_msg(src->rect != NULL, "Source buffer should have a byte buffer assigned."); + BLI_assert_msg(dst->x == src->x, "Source and destination buffer should have the same dimension"); + BLI_assert_msg(dst->y == src->y, "Source and destination buffer should have the same dimension"); + BLI_assert_msg(dst->channels = 4, "Destination buffer should have 4 channels."); + BLI_assert_msg(region_to_update->xmin >= 0, + "Region to update should be clipped to the given buffers."); + BLI_assert_msg(region_to_update->ymin >= 0, + "Region to update should be clipped to the given buffers."); + BLI_assert_msg(region_to_update->xmax <= dst->x, + "Region to update should be clipped to the given buffers."); + BLI_assert_msg(region_to_update->ymax <= dst->y, + "Region to update should be clipped to the given buffers."); + + float *rect_float = dst->rect_float; + rect_float += (region_to_update->xmin + region_to_update->ymin * dst->x) * 4; + unsigned char *rect = (unsigned char *)src->rect; + rect += (region_to_update->xmin + region_to_update->ymin * dst->x) * 4; + const int region_width = BLI_rcti_size_x(region_to_update); + const int region_height = BLI_rcti_size_y(region_to_update); + + /* Convert byte buffer to float buffer without color or alpha conversion. */ + IMB_buffer_float_from_byte(rect_float, + rect, + IB_PROFILE_SRGB, + IB_PROFILE_SRGB, + false, + region_width, + region_height, + src->x, + dst->x); + + /* Perform color space conversion from rect color space to linear. */ + float *float_ptr = rect_float; + for (int i = 0; i < region_height; i++) { + IMB_colormanagement_colorspace_to_scene_linear( + float_ptr, region_width, 1, dst->channels, src->rect_colorspace, false); + float_ptr += 4 * dst->x; + } + + /* Perform alpha conversion. */ + if (IMB_alpha_affects_rgb(src)) { + float_ptr = rect_float; + for (int i = 0; i < region_height; i++) { + IMB_premultiply_rect_float(float_ptr, dst->channels, region_width, 1); + float_ptr += 4 * dst->x; + } + } +} + void IMB_float_from_rect(ImBuf *ibuf) { float *rect_float; @@ -775,33 +831,14 @@ void IMB_float_from_rect(ImBuf *ibuf) } ibuf->channels = 4; - } - - /* first, create float buffer in non-linear space */ - IMB_buffer_float_from_byte(rect_float, - (unsigned char *)ibuf->rect, - IB_PROFILE_SRGB, - IB_PROFILE_SRGB, - false, - ibuf->x, - ibuf->y, - ibuf->x, - ibuf->x); - - /* then make float be in linear space */ - IMB_colormanagement_colorspace_to_scene_linear( - rect_float, ibuf->x, ibuf->y, ibuf->channels, ibuf->rect_colorspace, false); - - /* byte buffer is straight alpha, float should always be premul */ - if (IMB_alpha_affects_rgb(ibuf)) { - IMB_premultiply_rect_float(rect_float, ibuf->channels, ibuf->x, ibuf->y); - } - - if (ibuf->rect_float == NULL) { ibuf->rect_float = rect_float; ibuf->mall |= IB_rectfloat; ibuf->flags |= IB_rectfloat; } + + rcti region_to_update; + BLI_rcti_init(®ion_to_update, 0, ibuf->x, 0, ibuf->y); + IMB_float_from_rect_ex(ibuf, ibuf, ®ion_to_update); } /** \} */ diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 2cf82ca5c48..c1e00642a6d 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -478,7 +478,7 @@ struct proxy_output_ctx { AVFormatContext *of; AVStream *st; AVCodecContext *c; - AVCodec *codec; + const AVCodec *codec; struct SwsContext *sws_ctx; AVFrame *frame; int cfra; @@ -510,12 +510,9 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( rv->st = avformat_new_stream(rv->of, NULL); rv->st->id = 0; - rv->c = avcodec_alloc_context3(NULL); - rv->c->codec_type = AVMEDIA_TYPE_VIDEO; - rv->c->codec_id = AV_CODEC_ID_H264; + rv->codec = avcodec_find_encoder(AV_CODEC_ID_H264); - rv->of->oformat->video_codec = rv->c->codec_id; - rv->codec = avcodec_find_encoder(rv->c->codec_id); + rv->c = avcodec_alloc_context3(rv->codec); if (!rv->codec) { fprintf(stderr, @@ -527,8 +524,6 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( return NULL; } - avcodec_get_context_defaults3(rv->c, rv->codec); - rv->c->width = width; rv->c->height = height; rv->c->gop_size = 10; @@ -779,7 +774,7 @@ typedef struct FFmpegIndexBuilderContext { AVFormatContext *iFormatCtx; AVCodecContext *iCodecCtx; - AVCodec *iCodec; + const AVCodec *iCodec; AVStream *iStream; int videoStream; @@ -1167,7 +1162,7 @@ static int indexer_performance_get_max_gop_size(FFmpegIndexBuilderContext *conte } /* Assess scrubbing performance of provided file. This function is not meant to be very exact. - * It compares number number of frames decoded in reasonable time with largest detected GOP size. + * It compares number of frames decoded in reasonable time with largest detected GOP size. * Because seeking happens in single GOP, it means, that maximum seek time can be detected this * way. * Since proxies use GOP size of 10 frames, skip building if detected GOP size is less or diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index a47009e3abd..418a4724c00 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -16,30 +16,46 @@ #include <stdexcept> #include <string> -#include <Iex.h> -#include <ImathBox.h> -#include <ImfArray.h> -#include <ImfChannelList.h> -#include <ImfCompression.h> -#include <ImfCompressionAttribute.h> -#include <ImfIO.h> -#include <ImfInputFile.h> -#include <ImfOutputFile.h> -#include <ImfPixelType.h> -#include <ImfStandardAttributes.h> -#include <ImfStringAttribute.h> -#include <ImfVersion.h> -#include <half.h> +/* The OpenEXR version can reliably be found in this header file from OpenEXR, + * for both 2.x and 3.x: + */ +#include <OpenEXR/OpenEXRConfig.h> +#define COMBINED_OPENEXR_VERSION \ + ((10000 * OPENEXR_VERSION_MAJOR) + (100 * OPENEXR_VERSION_MINOR) + OPENEXR_VERSION_PATCH) + +#if COMBINED_OPENEXR_VERSION >= 20599 +/* >=2.5.99 -> OpenEXR >=3.0 */ +# include <Imath/half.h> +# include <OpenEXR/ImfFrameBuffer.h> +# define exr_file_offset_t uint64_t +#else +/* OpenEXR 2.x, use the old locations. */ +# include <OpenEXR/half.h> +# define exr_file_offset_t Int64 +#endif + +#include <OpenEXR/Iex.h> +#include <OpenEXR/ImfArray.h> +#include <OpenEXR/ImfChannelList.h> +#include <OpenEXR/ImfCompression.h> +#include <OpenEXR/ImfCompressionAttribute.h> +#include <OpenEXR/ImfIO.h> +#include <OpenEXR/ImfInputFile.h> +#include <OpenEXR/ImfOutputFile.h> +#include <OpenEXR/ImfPixelType.h> +#include <OpenEXR/ImfStandardAttributes.h> +#include <OpenEXR/ImfStringAttribute.h> +#include <OpenEXR/ImfVersion.h> /* multiview/multipart */ -#include <ImfInputPart.h> -#include <ImfMultiPartInputFile.h> -#include <ImfMultiPartOutputFile.h> -#include <ImfMultiView.h> -#include <ImfOutputPart.h> -#include <ImfPartHelper.h> -#include <ImfPartType.h> -#include <ImfTiledOutputPart.h> +#include <OpenEXR/ImfInputPart.h> +#include <OpenEXR/ImfMultiPartInputFile.h> +#include <OpenEXR/ImfMultiPartOutputFile.h> +#include <OpenEXR/ImfMultiView.h> +#include <OpenEXR/ImfOutputPart.h> +#include <OpenEXR/ImfPartHelper.h> +#include <OpenEXR/ImfPartType.h> +#include <OpenEXR/ImfTiledOutputPart.h> #include "DNA_scene_types.h" /* For OpenEXR compression constants */ @@ -115,12 +131,12 @@ class IMemStream : public Imf::IStream { return false; } - Int64 tellg() override + exr_file_offset_t tellg() override { return _exrpos; } - void seekg(Int64 pos) override + void seekg(exr_file_offset_t pos) override { _exrpos = pos; } @@ -130,8 +146,8 @@ class IMemStream : public Imf::IStream { } private: - Int64 _exrpos; - Int64 _exrsize; + exr_file_offset_t _exrpos; + exr_file_offset_t _exrsize; unsigned char *_exrbuf; }; @@ -166,12 +182,12 @@ class IFileStream : public Imf::IStream { return check_error(); } - Int64 tellg() override + exr_file_offset_t tellg() override { return std::streamoff(ifs.tellg()); } - void seekg(Int64 pos) override + void seekg(exr_file_offset_t pos) override { ifs.seekg(pos); check_error(); @@ -215,19 +231,19 @@ class OMemStream : public OStream { ibuf->encodedsize += n; } - Int64 tellp() override + exr_file_offset_t tellp() override { return offset; } - void seekp(Int64 pos) override + void seekp(exr_file_offset_t pos) override { offset = pos; ensure_size(offset); } private: - void ensure_size(Int64 size) + void ensure_size(exr_file_offset_t size) { /* if buffer is too small increase it. */ while (size > ibuf->encodedbuffersize) { @@ -238,7 +254,7 @@ class OMemStream : public OStream { } ImBuf *ibuf; - Int64 offset; + exr_file_offset_t offset; }; /* File Output Stream */ @@ -268,12 +284,12 @@ class OFileStream : public OStream { check_error(); } - Int64 tellp() override + exr_file_offset_t tellp() override { return std::streamoff(ofs.tellp()); } - void seekp(Int64 pos) override + void seekp(exr_file_offset_t pos) override { ofs.seekp(pos); check_error(); diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index cabd6070400..241f1a736f4 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -250,7 +250,7 @@ static int isffmpeg(const char *filepath) AVFormatContext *pFormatCtx = NULL; unsigned int i; int videoStream; - AVCodec *pCodec; + const AVCodec *pCodec; if (BLI_path_extension_check_n(filepath, ".swf", |