summaryrefslogtreecommitdiff
path: root/libavcodec/libopenjpegenc.c
diff options
context:
space:
mode:
authorMichael Bradshaw <mbradshaw@sorensonmedia.com>2012-01-17 12:01:42 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-01-17 12:01:42 +0100
commit56af084cb5478bc3c0eb2d47d47e82bbe40fbf2d (patch)
treebbb33934472d4132e4bf410e82299b95a19d5692 /libavcodec/libopenjpegenc.c
parenta02694c92618fae98e5ce85b0a5eed71988a9d40 (diff)
libopenjpegenc: Remove two redundant function parameters.
Diffstat (limited to 'libavcodec/libopenjpegenc.c')
-rw-r--r--libavcodec/libopenjpegenc.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index b0dca03669..188dbb9ac4 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -197,13 +197,12 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
return 0;
}
-static int libopenjpeg_copy_packed8(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image, int numcomps)
+static int libopenjpeg_copy_packed8(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image)
{
int compno;
int x;
int y;
-
- av_assert0(numcomps == 1 || numcomps == 3 || numcomps == 4);
+ const int numcomps = image->numcomps;
for (compno = 0; compno < numcomps; ++compno) {
if (image->comps[compno].w > frame->linesize[0] / numcomps) {
@@ -223,15 +222,14 @@ static int libopenjpeg_copy_packed8(AVCodecContext *avctx, AVFrame *frame, opj_i
return 1;
}
-static int libopenjpeg_copy_packed16(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image, int numcomps)
+static int libopenjpeg_copy_packed16(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image)
{
int compno;
int x;
int y;
+ const int numcomps = image->numcomps;
uint16_t *frame_ptr = (uint16_t*)frame->data[0];
- av_assert0(numcomps == 1 || numcomps == 3 || numcomps == 4);
-
for (compno = 0; compno < numcomps; ++compno) {
if (image->comps[compno].w > frame->linesize[0] / numcomps) {
av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
@@ -329,16 +327,12 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf
switch (avctx->pix_fmt) {
case PIX_FMT_RGB24:
- cpyresult = libopenjpeg_copy_packed8(avctx, frame, image, 3);
- break;
case PIX_FMT_RGBA:
- cpyresult = libopenjpeg_copy_packed8(avctx, frame, image, 4);
+ cpyresult = libopenjpeg_copy_packed8(avctx, frame, image);
break;
case PIX_FMT_RGB48:
- cpyresult = libopenjpeg_copy_packed16(avctx, frame, image, 3);
- break;
case PIX_FMT_RGBA64:
- cpyresult = libopenjpeg_copy_packed16(avctx, frame, image, 4);
+ cpyresult = libopenjpeg_copy_packed16(avctx, frame, image);
break;
case PIX_FMT_GRAY8:
case PIX_FMT_YUV420P: