summaryrefslogtreecommitdiff
path: root/libavcodec/libopenjpegenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-22 22:10:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-22 22:18:18 +0200
commit9023de342f88e961a3741753aff68925eebf884e (patch)
treec45518b146273fb14210f02cd41fa2c52624e39d /libavcodec/libopenjpegenc.c
parent4f4eb380f0f96dbb7cdd2b812fa92b8b47a0f27c (diff)
parent1470ce21cec5ee26e106e2a884c26bbf84e5aaea (diff)
Merge commit '1470ce21cec5ee26e106e2a884c26bbf84e5aaea'
* commit '1470ce21cec5ee26e106e2a884c26bbf84e5aaea': Bump libavcodec and libavformat minor versions for G.723.1 decoder and demuxer G.723.1 demuxer and decoder Add a shift parameter to celp_lp_synthesis_filter() libopenjpeg: K&R formatting cosmetics yadif: use emms_c() instead of inline assembly for emms invocations. ac3: don't use different names for option tables in the template file. lavfi: use const for AVFilterPad declarations in all filters. adpcm: don't duplicate identical AVSampleFmt array for each encoder. configure: cosmetics: Group test dependencies together configure: add more passthrough flags in tms470 filter configure: move flag filtering functions out of if/else blocks Conflicts: Changelog configure doc/general.texi libavcodec/Makefile libavcodec/ac3enc_fixed.c libavcodec/allcodecs.c libavcodec/eac3enc.c libavcodec/g723_1.c libavcodec/g723_1_data.h libavcodec/libopenjpegdec.c libavcodec/libopenjpegenc.c libavcodec/v210dec.h libavcodec/version.h libavfilter/af_anull.c libavfilter/asrc_anullsrc.c libavfilter/f_settb.c libavfilter/fifo.c libavfilter/split.c libavfilter/src_movie.c libavfilter/vf_aspect.c libavfilter/vf_blackframe.c libavfilter/vf_boxblur.c libavfilter/vf_copy.c libavfilter/vf_crop.c libavfilter/vf_cropdetect.c libavfilter/vf_delogo.c libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_fieldorder.c libavfilter/vf_format.c libavfilter/vf_frei0r.c libavfilter/vf_gradfun.c libavfilter/vf_hflip.c libavfilter/vf_hqdn3d.c libavfilter/vf_libopencv.c libavfilter/vf_lut.c libavfilter/vf_null.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_pixdesctest.c libavfilter/vf_scale.c libavfilter/vf_select.c libavfilter/vf_setpts.c libavfilter/vf_showinfo.c libavfilter/vf_slicify.c libavfilter/vf_transpose.c libavfilter/vf_unsharp.c libavfilter/vf_vflip.c libavfilter/vf_yadif.c libavfilter/vsrc_color.c libavfilter/vsrc_testsrc.c libavformat/Makefile libavformat/allformats.c libavformat/g723_1.c libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libopenjpegenc.c')
-rw-r--r--libavcodec/libopenjpegenc.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index bd741df985..82d28665b5 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -20,18 +20,18 @@
*/
/**
-* @file
-* JPEG 2000 encoder using libopenjpeg
-*/
+ * @file
+ * JPEG 2000 encoder using libopenjpeg
+ */
#define OPJ_STATIC
#include <openjpeg.h>
-#include "libavutil/opt.h"
-#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
-#include "avcodec.h"
+#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
#include "internal.h"
typedef struct {
@@ -284,9 +284,8 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *fram
for (y = 0; y < height; ++y) {
image_index = y * width;
frame_index = y * frame->linesize[compno];
- for (x = 0; x < width; ++x) {
+ for (x = 0; x < width; ++x)
image->comps[compno].data[image_index++] = frame->data[compno][frame_index++];
- }
}
}
@@ -319,9 +318,8 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *fra
for (y = 0; y < height; ++y) {
image_index = y * width;
frame_index = y * (frame->linesize[compno] / 2);
- for (x = 0; x < width; ++x) {
+ for (x = 0; x < width; ++x)
image->comps[compno].data[image_index++] = frame_ptr[frame_index++];
- }
}
}
@@ -333,7 +331,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
{
LibOpenJPEGContext *ctx = avctx->priv_data;
opj_cinfo_t *compress = ctx->compress;
- opj_image_t *image = ctx->image;
+ opj_image_t *image = ctx->image;
opj_cio_t *stream;
int cpyresult = 0;
int ret, len;
@@ -342,7 +340,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
// x1, y1 is the width, height of the reference grid
image->x0 = 0;
image->y0 = 0;
- image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
+ image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
image->y1 = (avctx->height - 1) * ctx->enc_params.subsampling_dy + 1;
switch (avctx->pix_fmt) {
@@ -432,7 +430,7 @@ static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
opj_destroy_compress(ctx->compress);
opj_image_destroy(ctx->image);
av_freep(&avctx->coded_frame);
- return 0 ;
+ return 0;
}
#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
@@ -456,11 +454,11 @@ static const AVOption options[] = {
{ "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { RPCL }, 0, 0, VE, "prog_order" },
{ "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { PCRL }, 0, 0, VE, "prog_order" },
{ "cprl", NULL, 0, AV_OPT_TYPE_CONST, { CPRL }, 0, 0, VE, "prog_order" },
- { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { 6 }, 1, 10, VE },
- { "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { 1 }, 1, 10, VE },
- { "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { 1 }, 0, 1, VE },
- { "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
- { "fixed_quality", NULL, OFFSET(fixed_quality), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+ { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { 6 }, 1, 10, VE },
+ { "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { 1 }, 1, 10, VE },
+ { "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { 1 }, 0, 1, VE },
+ { "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+ { "fixed_quality", NULL, OFFSET(fixed_quality), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
{ NULL },
};
@@ -480,7 +478,7 @@ AVCodec ff_libopenjpeg_encoder = {
.encode2 = libopenjpeg_encode_frame,
.close = libopenjpeg_encode_close,
.capabilities = 0,
- .pix_fmts = (const enum PixelFormat[]){
+ .pix_fmts = (const enum PixelFormat[]) {
PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_RGB48, PIX_FMT_RGBA64,
PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16,
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUVA420P,