Merge commit 'c0b105756f61d253bdabcc2bb49453a2557e7c3b'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 22 Jun 2015 19:15:50 +0000 (21:15 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 22 Jun 2015 19:15:50 +0000 (21:15 +0200)
* commit 'c0b105756f61d253bdabcc2bb49453a2557e7c3b':
  txd: Use the TextureDSP module for decoding

Conflicts:
configure
libavcodec/s3tc.c
libavcodec/s3tc.h
libavcodec/txd.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
configure
libavcodec/Makefile
libavcodec/txd.c
tests/fate/video.mak

diff --cc configure
+++ b/configure
@@@ -2283,16 -1939,18 +2283,17 @@@ svq1_encoder_select="aandcttables hpeld
  svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
  svq3_decoder_suggest="zlib"
  tak_decoder_select="audiodsp"
 -tdsc_decoder_deps="zlib"
 -tdsc_decoder_select="mjpeg_decoder"
 +tdsc_decoder_select="zlib mjpeg_decoder"
  theora_decoder_select="vp3_decoder"
  thp_decoder_select="mjpeg_decoder"
 -tiff_decoder_suggest="zlib"
 +tiff_decoder_suggest="zlib lzma"
  tiff_encoder_suggest="zlib"
 -truehd_decoder_select="mlp_decoder"
 +truehd_decoder_select="mlp_parser"
  truemotion2_decoder_select="bswapdsp"
  truespeech_decoder_select="bswapdsp"
 -tscc_decoder_deps="zlib"
 -txd_decoder_select="texturedsp"
 +tscc_decoder_select="zlib"
  twinvq_decoder_select="mdct lsp sinewin"
++txd_decoder_select="texturedsp"
  utvideo_decoder_select="bswapdsp"
  utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
  vble_decoder_select="huffyuvdsp"
@@@ -482,10 -402,9 +482,10 @@@ OBJS-$(CONFIG_TRUEMOTION2_DECODER)     
  OBJS-$(CONFIG_TRUESPEECH_DECODER)      += truespeech.o
  OBJS-$(CONFIG_TSCC_DECODER)            += tscc.o msrledec.o
  OBJS-$(CONFIG_TSCC2_DECODER)           += tscc2.o
 -OBJS-$(CONFIG_TTA_DECODER)             += tta.o
 +OBJS-$(CONFIG_TTA_DECODER)             += tta.o ttadata.o ttadsp.o
 +OBJS-$(CONFIG_TTA_ENCODER)             += ttaenc.o ttadata.o
  OBJS-$(CONFIG_TWINVQ_DECODER)          += twinvqdec.o twinvq.o
- OBJS-$(CONFIG_TXD_DECODER)             += txd.o s3tc.o
+ OBJS-$(CONFIG_TXD_DECODER)             += txd.o
  OBJS-$(CONFIG_ULTI_DECODER)            += ulti.o
  OBJS-$(CONFIG_UTVIDEO_DECODER)         += utvideodec.o utvideo.o
  OBJS-$(CONFIG_UTVIDEO_ENCODER)         += utvideoenc.o utvideo.o
  
  #include "libavutil/intreadwrite.h"
  #include "libavutil/imgutils.h"
 -#include "avcodec.h"
  #include "bytestream.h"
 +#include "avcodec.h"
  #include "internal.h"
- #include "s3tc.h"
+ #include "texturedsp.h"
+ #define TXD_DXT1 0x31545844
+ #define TXD_DXT3 0x33545844
  
  static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                              AVPacket *avpkt) {
      if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
          return ret;
  
 -    if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
 -        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+     avctx->coded_width  = FFALIGN(w, 4);
+     avctx->coded_height = FFALIGN(h, 4);
 +    if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
          return ret;
 -    }
  
      p->pict_type = AV_PICTURE_TYPE_I;
  
          case 0:
              if (!(flags & 1))
                  goto unsupported;
-         case FF_S3TC_DXT1:
+         case TXD_DXT1:
 +            if (bytestream2_get_bytes_left(&gb) < FF_CEIL_RSHIFT(w, 2) * FF_CEIL_RSHIFT(h, 2) * 8)
 +                return AVERROR_INVALIDDATA;
-             ff_decode_dxt1(&gb, ptr, w, h, stride);
+             for (j = 0; j < avctx->height; j += 4) {
+                 for (i = 0; i < avctx->width; i += 4) {
+                     uint8_t *p = ptr + i * 4 + j * stride;
+                     int step = dxtc.dxt1_block(p, stride, gb.buffer);
+                     bytestream2_skip(&gb, step);
+                 }
+             }
              break;
-         case FF_S3TC_DXT3:
+         case TXD_DXT3:
 +            if (bytestream2_get_bytes_left(&gb) < FF_CEIL_RSHIFT(w, 2) * FF_CEIL_RSHIFT(h, 2) * 16)
 +                return AVERROR_INVALIDDATA;
-             ff_decode_dxt3(&gb, ptr, w, h, stride);
+             for (j = 0; j < avctx->height; j += 4) {
+                 for (i = 0; i < avctx->width; i += 4) {
+                     uint8_t *p = ptr + i * 4 + j * stride;
+                     int step = dxtc.dxt3_block(p, stride, gb.buffer);
+                     bytestream2_skip(&gb, step);
+                 }
+             }
              break;
          default:
              goto unsupported;
Simple merge