summaryrefslogtreecommitdiff
path: root/macros/idct1.sci
diff options
context:
space:
mode:
authorRashpat932024-08-09 11:47:44 +0530
committerGitHub2024-08-09 11:47:44 +0530
commitaf6fe82f90dcb2314a3d37a9a1e297fb0fc447f3 (patch)
tree80effebb59b2042de6635493f4831ba215f19eee /macros/idct1.sci
parentb10cff2c07747b039e3c3ee83a34d437e958356b (diff)
parent2e21edde1c1a251a60739b15e1c699172401f044 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-af6fe82f90dcb2314a3d37a9a1e297fb0fc447f3.tar.gz
FOSSEE-Signal-Processing-Toolbox-af6fe82f90dcb2314a3d37a9a1e297fb0fc447f3.tar.bz2
FOSSEE-Signal-Processing-Toolbox-af6fe82f90dcb2314a3d37a9a1e297fb0fc447f3.zip
Merge pull request #17 from avinashlalotra/masterHEADmaster
Abinash's Work
Diffstat (limited to 'macros/idct1.sci')
-rw-r--r--macros/idct1.sci62
1 files changed, 37 insertions, 25 deletions
diff --git a/macros/idct1.sci b/macros/idct1.sci
index 5015187..3f007fa 100644
--- a/macros/idct1.sci
+++ b/macros/idct1.sci
@@ -1,27 +1,39 @@
+/*Description
+ This function computes the inverse discrete cosine transform of input X.
+ If N is given, then X is padded or trimmed to length N before computing the transform.
+ If X is a matrix, compute the transform along the columns of the the matrix.
+ The transform is faster if X is real-valued and even length.
+Calling Sequence
+ Y = idct1(X)
+ Y = idct1(X, N)
+Parameters
+ X: Matrix or integer
+ N: If N is given, then X is padded or trimmed to length N before computing the transform.
+Examples
+ idct1([1,3,6])
+ ans =
+ 5.1481604 - 4.3216292 0.9055197
+*/
function y = idct1(x,n)
-//Compute the inverse discrete cosine transform of input.
-//Calling Sequence
-//Y = idct1(X)
-//Y = idct1(X, N)
-//Parameters
-//X: Matrix or integer
-//N: If N is given, then X is padded or trimmed to length N before computing the transform.
-//Description
-// This function computes the inverse discrete cosine transform of input X. If N is given, then X is padded or trimmed to length N before computing the transform. If X is a matrix, compute the transform along the columns of the the matrix. The transform is faster if X is real-valued and even length.
-//Examples
-//idct1([1,3,6])
-//ans =
-// 5.1481604 - 4.3216292 0.9055197
-funcprot(0);
-rhs=argn(2);
-if (rhs<1 | rhs>2) then
- error("Wrong number of input arguments.");
-end
-select(rhs)
-case 1 then
- y=callOctave("idct",x);
-case 2 then
- y=callOctave("idct",x,n);
-end
-
+ funcprot(0);
+ rhs=argn(2);
+ if (rhs<1 | rhs>2) then
+ error("Wrong number of input arguments.");
+ end
+ nsdim=1;
+ siz=size(x);
+ len=length(siz);
+ for i=1:len
+ if siz(i) ~= 1 then
+ nsdim=i//calculating along non-singlton dimension
+ break;
+ end;
+ end;
+ select(rhs)
+ case 1 then
+ y=idct(x,nsdim);
+ case 2 then
+ siz(nsdim)=n;
+ y=idct(resize_matrix(x,siz),nsdim)
+ end;
endfunction